PICAXE Digital Clock

This was just a small project that I did for fun. I had the spare 7 segment displays from another project, a PICAXE Microcontroller lying around and some other components. When I was thinking of what I could make, the first thing that came to my mind was a clock! I then began to research the different methods of making a clock from scratch and found that there were three:


 1 - Use the microcontroller's built-in pause command to make it flash the LEDs every second for half a second, and count up the half-seconds to make a minute. Then count up the minutes to make an hour. (Basically just use the microcontroller's timer)

2 - Make a 1Hz oscillator (must be accurate and precise) by using a 32.768Khz Crystal Oscillator and dividing it down to 1Hz by using flip flops. (This is explained in more detail here)

3 - Use a RTC (Real Time Clock) IC to do ALL the timing and simply send the data to the PICAXE IC... but where's the fun in that? 


I went with number 1, however I might try number 2 sometime just to see how well it works. The difference is, when using the microcontroller to keep time, the timing is NOT exact. For whatever reason, "pause 1000" really means something like "pause 1100" (roughly). Therefore the timing is slightly out and the time MUST be calibrated to get close enough to suit your needs e.g. I used: "pause 495" twice (so 990). I had to use 495 twice to get the LEDs to flash every 0.5 seconds, like so:
pause 495
high 5
pause 495
low 5

I only did this project for fun so I do not need the timing to be constantly accurate, however if you ever want to make a clock that is as accurate as a commercially bought clock, I strongly suggest to use number 2 or 3. The downside with this however, is that you will need more components and will need a larger piece of PCB, it isn't a huge downside, but it was enough to make me choose option 1 simply because I didn't need a clock that could last years before needing calibrated again, and I did it mainly because I had the parts lying around anyway!


Here is the parts list:

- 1 x 20M2 PICAXE microcontroller (I didn't need that many inputs and outputs, but this was only £1 and it has more memory, 8 inputs and 8 outputs, just in case I want to add anything later on)
- 1 x 3AAA battery box (I will add a 3v lithium coin cell later so the microcontroller can keep the time even when the rest of the circuit is switched off)
- 4 x 4026 Decade counters
- 4 x 7 segment displays
- 2 x LEDs
- 2 x Tact switches (I used squishy ones... because they feel awesome)
- 2 x 10K resistors (pull down resistors for the tact switches)
- Resistor(s) for the LEDs (you may use 1 or 2 depending on how you wire them and the required resistance would be different depending on which LEDs you use and how bright you want them to be)
- Perfboard/Prototyping PCB

- A LOT OF WIRE (I used general purpose wire, the same thin wire that is sometimes used to relocate cartridge slots, because it is very flexible, thin, and is generally very easy to use) 


Overall, I am very happy with how well the concept worked in practice. And it looks great in the dark! I will make a case for it later, however it is not urgently required so I will think about the different ideas before I start. Maybe a Portal themed case... or maybe a personalised Electro Modder case... who knows!