Since it was one of the first things I ever built, I decided to put it in an enclosure of its own and consider it too as a finished product.
The problem was that the prototype never ran properly. It worked, just not as well as it should. Needless to say, I tried to fix it in the way of an Arduino upgrade. On paper everything should run perfectly, but in the real world, it just doesnāt. The clock bounces all over the place. Itās more of a random number generator than a clock. I really thought that moving away from the 60Hz line signal as a timebase to a solid 1Hz signal from a DS3231 RTC would solve all my problems. At the end of the day, it boils down to the fact that itās all soldered together on a DIY homebrew PCB. The holes that I drilled are too big for the pins; resulting in some pretty shoddy-looking soldering. Itās a noisy circuit, and Iām sure thereās some grounding issues in there too.
I put in a bunch of caps to help filter out the noise, but I think the board is just fundamentally flawed. You can polish a turd, but itās still a turd.
Itās just a shame to throw it in a closet and forget about it. The case came out so nice and it looks great in the living room. Iām going to gut it, and replace my old 7490 prototype board with something brand new. Iām going to keep it a 7-segment clock, so Iāll have to design a new PCB for the display.
I was thinking that I could just run the whole thing off the Bare Bones Arduino/DS3231 shield thatās running it now.
All Iād have to do is modify it so that I could connect the display to it. Iād have to string all 6 digits together and multiplex them. Thatās 48 wires Iād have to solder onto the back of the display board.
That sounds like a real ratās nest in the making. Not to mention, trying to unsolder the 48 wires that are on the back now and rewiring the whole thing not only seems like a daunting task, but a good way to damage some of the LED segments. When 7-segment LEDs only cost a buck or two, itās better to just start off clean. Besides, Iād rather have a display PCB that I could just connect to a mainboard with a ribbon cable. Neat and tidy.
I thought about recycling my Mini 7-Segment LED Clock design and just breaking the digits out to a header that I could then connect to a display board with a ribbon cable, but again, itāll probably be better (and cleaner) to just start from scratch.
The multiplexing on that clock is OK, but itās not ideal. In order to make that clock as small as possible, I made it in a way that I wouldnāt need to use any transistors or LED driver chips. As a result, thereās sometimes a little ghosting on the digits and the first digit on the right is always a little brighter than the rest. If Iām going to do this, Iām going to do it right.
I got to work on prototyping something new. I decided to make use of the Multiplex7Seg library and drive the LEDs with transistors. Since Iām using common-anode LEDs, I can drive them with some 3904 NPN transistors. The following schematic shows these displays as having G1 and G2 connections. However, Iām using common-anode. Iāll pretend that those are anodes and not cathodes. If you were using common-cathode, youād need to use 3906 PNP transistors and connect the emitter to Vcc.
#include <Multiplex7Seg.h> byte digitPins[] = { Ā Ā 9, 10}; byte segmentPins[] = { Ā Ā 2, 3, 4, 5, 6, 7, 8}; int num; void setup() { Ā Ā Multiplex7Seg::set(1, 4, digitPins, segmentPins); Ā Ā num = 0; } void loop() { Ā Ā num = num++; Ā Ā if (num == 99) { Ā Ā Ā Ā num = 0; Ā Ā } Ā Ā delay (200); Ā Ā Multiplex7Seg::loadValue(num); } |
The sketch has the digits count from 0-99, then start over. It runs great, and the LEDs look fantastic.
I added another 4 digits to my breadboard and attempted to modify my code to support the additional digits. It was then that I discovered that the Multiplex7Seg library is limited to 4 characters. That seemed to make sense considering the library is intended to be used with the commonly available 4Ć7 digit display variety; something I failed to realize when I downloaded it.
I was about to try and modify the library, but the notes within one of the files said not to bother; that āMore than 4 digits is not practical since the brightness decreases with a faster refresh rate and the MsTimer2 library only goes to 1msā. So that was basically the end of that.
I took a look at a few other examples online and figured out a better way to do it. Itās similar to the way that I multiplexed the digits on the Mini 7-Segment Clock, but a little more efficient. Not to mention, it looks even better. Thereās no ghosting, and all the digits are of an equal brightness.
Iām just counting milliseconds here just to test the functionality, but soon Iāll add a DS3231 as a timebase.
For more detail: Large 7-Segment Clock,