The Wall Clock

I couldn't find a proper wall clock for my room, so I made one myself. I paid like 60tl for the parts and later on found that a similar clock costs about 50tl from online Chinese vendors. I didn't do so bad, I guess.

The clock uses an ATMEGA8 to drive some 7-segment displays thru 4 TPIC6B595 chips. This is a serial to parallel chip with high current transistors at the output stage. At least for a small cheap chip with no heatsink, that is.

The 7-segment displays I used are common anode types to go with the 595s. The clock function is provided by a DS3231 module.

There are three pushbuttons to set the time: hours, 10minutes and minutes.

Here is the way I connected the 595s to the seven segment display:

   LED name      595 Drain
     A             2                          A
     B             3                        F   B
     C             4                          G
     D             5                        E   C
     E             6                          D
     F             1
     G             0
I didn't connect the decimal point because it made the circuit easier to build.

In the seven segment displays, each segment (except for the decimal point) drops about 7 volts. I used 270 ohm current limiting resistors in series with each segment. This provides about 18ma for each segment when the power supply is at 12 volts. The circuit can be run on 9v as well, with 7ma for each segment. The clock is quite bright at 12 volts, so running it at 9v can be better for bedroom installation.

Here is a datasheet for a similar display. Mine was no-name, but the pinout is identical.

Here is the code for the atmega. It contains i2c and ds3231 code as reusable modules. The seven segment display code is quite dependent on the wiring, so it's not very portable. The main code is in ds3231/

What I Learned

I soldered the displays directly on the protoboard. This made it necessary to keep the rest of the circuit as slim as possible in order to fit the front panel on the protoboard. It would be much better to simply solder some female headers on the board to elevate the displays a little bit. This would have the following advantages: I also tried to press the displays close together in order to not leave any space between them. This didn't work and resulted in hairline spacing between the displays, which doesn't look so good. The display width isn't a multiple of 2.54mm so you have to bend the pins if you press the displays together. However, the pins force the display away from each other later on. You have to clamp the things tightly together if you don't want that.

Since I don't like the sight of the unlit segments, I put a piece of paper over the displays to cover them up. This way, only the lighted segments show. Because of this, I really didn't need to try to make the display look nice.

A driver chip such as MAX7219 is nice, but only usable for small displays with small voltages and currents. Mine were 7v, 25ma so they weren't really useful. Other drivers such as CD4511 can be used with high voltages, but the control signals are the same voltage as the display voltage. This makes them unsuitable for control with an MCU. However, they would work just fine if the displays were small and low voltage.

I should have drilled the holes for mounting screws before I set up the circuit. With the circuit in place, I couldn't level them off to apply pressure. That resulted in some cracks.