Intro: The Not So Crap Clock
First, why call it the Crap Clock? Well, it lowers expectations with the hope of exceeding them :-) I joke of course, the clock represents many of my failures and successes in equal measure. The physical representation of the underdog in electronics.
Second, this ain't really a how to make the 'thing' more a reflection on design choices and all the materials you need to go about building your own.
The Crap Clock is a clock running from a ATMEGA328 which drives 82 LEDs via a 74HC595 driving the rows and a TLC5940 sinking the current across the columns. As DS3231 keeps the time and can be kept running with the battery input terminals. The clock has several ‘modes’ to view the time, date, year, temperature and then modes for setting the time and date with the two buttons. The LEDs can be dimmed with the TLC5940 and the seconds display (Pink LEDs above) can be used to display a contextual letter alongside the mode the clock is in.
There are a couple of features I have not used or have taken out of the PCB like Li-ion battery charging, I did that in this version to reduce the cost of the parts and because the DS3231 really only sips a small amount of current. There are still pins for the inbuilt DS3231 alarm INT/SQW pin and a buzzer pin from the ATMEGA. Pin 10 is broken out for general use and there is also an analog pin available for a feature like a LDR to alter brightness based on the ambient light.
I put together a playlist of all the videos where I can remember talking about or designing the Crap Clock.
Step 1: Step 1: the PCB and Schematic
The PCB layout and schematic was designed in Eagle, it took a loooong time ;-) but it was also a lot of fun and really taught me a lot about design. Don't worry there are still plenty of mistakes if every other project I have made, including all the ones I don't know about in this one.
I wanted the the clock to have a matrix display and for it all to exist on one board so I set about creating a round board to emulate an analog clock. Yeah.... that didn't stick, it was a terrible shape to route around and demanded millions (perhaps hundreds) of LEDs. Next I decided to make a matrix style display using the LEDs, originally all driven with shift registers (The venerable 74HC595) but I decided in the end that the familiar TLC5940 LED driver would be great to sink the current from those LEDs and gives the awesome feature of PWM dimming.
Here is the Bill of materials:
1 x 16 MHz crystal SM49
82 x 0603 LEDs (Pretty much any colour you like)
1 x Mini USB Type B (Not needed, it is just for power which is broken out to the pins anyway)
7 x 100nf 0805 capacitors
9 x 10k 0805 resistors
2 x 10uf 0805 capacitors (Not really needed to be honest and 0805 ones are expensive)
5 x 1k 0805 resistors
1 x 2k 0805 resistors
5 x 2n3906 SOT23
2 x 22pf 1206 resistors
16 x 470 ohm 0805 resistors
1 x 74HC595D SO16
1 x ATMEGA328P-AU
1 x DS3231 SO16W
2 x SMD tactile switch DTSM-3
1 x TLC5940PWP
Step 2: Step 2: the Crap Code
The code was a bit of a nightmare, it turned out that coding a clock with a homebrew matrix display isn't that easy even when you are using a couple of libraries.
It isn’t great code of course, it is crap code. But it is working and easy to modify, I've no idea how to make a library so this is all a bit of a train wreck. Ha ha, but honestly I am working towards making my code better and learning how to create my own libraries.
It was written in the Arduino IDE and uses some libraries (Shifter.h, MD_DS3231.h and Tlc5940.h) created by people far more clever that I. You will need to upload this with a programmer, I used an Arduino as ISP and hooked it up to the reset, 11, 12, 13 pins on the board.
There are two buttons, they have multiple functions dependent on the mode the clock is in. You can use them to change the display mode forward and back, through the Time, Date, Year, Temperature and then onto setting the time.
Step 3: Step 3: the Crap Case
So the case was a little bit of an after thought if I am quite honest, I was happy enough with it being a dodgy PCB and some poorly place mounting holes (and I only added them after being hounded about them in live-stream comments).
I designed the PCB in Fusion 360, a nice program from AutoCAD which I am still learning. The case is a fairly spacious box that is reminiscent of a bedside clock except in keeping with the theme it has CRAP CLOCK in rather large relief letters.
I chose to cover the front in a smokey semi-transparent acrylic, careful cutting that stuff as it can be really sharp and if you don't believe me you can ask my index finger.
The STL files are yours.
Step 4: Step 5: Operation and Conclusion
What can I say, it is a bit crap but I am kinda in love with it. The new version of the PCB design doesn't have those attractive bodge wires ;-) The finished ones I have are based on my prototype boards.
Feel free to tear it apart, remix it and use any parts you find useful. I have been helped loads by people from the YouTube community for the whole length of this project so it is everyone's in the end.