I admit it: I'm a total geek. I love electronics, programming, 3D art, vintage Apple hardware, and whisky. I'm always juggling half a dozen projects. I also enjoy documenting it all: my successes, my failures, my experiences... and everything geeky along the way.


 
 
 
 
 

Large 7-Segment Clock, Part I | Kevin Rye.net - Main

Kevin Rye

Geek Extraordinaire. Yeh, I said it.

Large 7-Segment Clock, Part I

I was extremely satisfied (and proud) of the way that the enclosure turned out for the rework of my 7490 Clock. The electronics on the other hand, is another story.

7490clockreworkcase_0006

The innards of that clock were from a prototype I built in 2001. It was a proof of concept. It led to the design of what would become an extremely well-polished and accurate clock.

clock3finaldisplay_0031

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.

7490clockandBBA_0023

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.

mini7purple_0008

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.

Screen Shot 2015-05-06 at 9.41.53 PM

It took all of ten minutes to put together a prototype and all of two minutes to write some code.

7-Segment Clock_0012

#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 4x7 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.

new7segclock_0005

Now that I'm ditching the 7490 chips in favor of at ATmega328 and a DS3231, I can change the format of the clock from 24-hours to 12-hours. That of course means I'll have to squeeze in an AM/PM indicator. I was hoping that I'd be able to squeeze the 7-segment LEDs close enough together to pick up an extra 2 or 3 millimeters for the AM/PM LED and still have enough space for the colons. However, I'll need to also pick up the same amount of space on the right side too, or else the whole display will no longer be centered within the cutout of the enclosure. It would be nice to place another LED next to the hours, but I don't think I'll have enough room for it.

The solution is to flip the displays upside down and use a decimal point like I did with my Mini 7-Segment Clock. All I need to do is redo my segment array in order to remap the pins. Everything at the hardware level stays the same.

new7segclock_0009

I connected my DS3231 breakout and redid my code to pull in the time. I also connected my Mini Breadboard I/O board and enabled an hour and minute set button. After seeing it in action, it really is just a much larger version of my Mini 7-Segment Clock. Most of the code is the same.

Maybe in the future I'll make another one with some added features like an alarm. For now, it's all about making use of the enclosure I've already made. Since the enclosure only has buttons to set the hours and minutes, those are the only "features" I can implement on this clock.

7490clockenclosure_0020

I also tweaked the code to illuminate the decimal point on the hours digit when the time is PM. I chose to leave a leading zero. It's not something you see on "store bought" clocks, so I though it would be cool.

large7seg_PM_LED_0004

With the prototype and code complete, it was time to design the PCBs.

I attempted to design a PCB that could house 6 x 7-segment LEDs (as well as a few 1206 SMD LEDs for the colons), but the 100mm x 80mm PCB size limitation of my version of Eagle proved to be a deal-breaker.

Even the $169 version of Eagle is limited to 160mm x 100mm. That still might not be big enough. I'm not about to spend over $1000 for the Pro version.

I've tried Fritzing and KiCad and I just don't like them. Something that takes me ten minutes to throw together in Eagle takes hours, if not days, in the other programs; and that's if the libraries have the right parts. If not, I'd have to make my own. Eagle has the largest selection of parts out there. It’s rare that I ever have to design my own.

If I can't make a PCB that’s large enough using my version of Eagle, I'll have to make some smaller PCBs that can be connected together. I could then 3D-print some kind of framework to secure them all together.

I got to work on designing a PCB that could house two 7-segment displays. All the segments on both displays are connected together and are then broken out to a 10-pin header. I can then connect the display PCB to the mainboard with a ribbon cable.

Screen Shot 2015-05-05 at 8.28.48 PM

It's perfect.

7-Segment Clock_0011

Since OSH Park sends PCBs out in batches of three, all I'll need to do is place one order and I'll have the three PCBs that I'll need to make up the whole display.

The front of the PCB is clean. There was no sense in covering it with text and labels when they'll never be seen after assembly.

7-Segment Breakout v1.0 front

I chose to put all the text and labels on the back of the PCB so that I can see them even after they've been put together and assembled into the enclosure. It might come in handy for troubleshooting down the line. Also, when I connect the ribbon cables to the mainboard, I'll know I have them oriented correctly.

7-Segment Breakout v1.0 back

Next up was a smaller board for the colons.

Screen Shot 2015-05-07 at 4.44.18 PM

Clock Colon v1.0 pcb

I printed them out and taped them together to get a better idea of how large the display will be.

new7segclock_0002

It's a good thing I kept the leftover piece from when I had the red acrylic front panel cut. It enabled me to verify (without taking the enclosure apart) that my PCBs were the perfect size. There might even be a little wiggle room.

new7segclock_0004

I put together a 3D model in SketchUp so that I could design a frame to secure them to and mount them within the enclosure.

Screen Shot 2015-05-07 at 8.41.37 PM

The frame will basically be a rectangular board with cutouts for the displays and colon LEDS. It'll have standoffs on the back for securing the PCBs. This is something that just a few months ago I'd have to have laser-cut. It probably would have cost $20 bucks and I'd have to wait 2 weeks for it. Now I can 3D-print one in an hour or two.

Screen Shot 2015-05-07 at 9.14.16 PM

The PCBs will be screwed to the back.

Screen Shot 2015-05-07 at 9.14.11 PM

I can then hot-glue the front of the frame to the inside of the enclosure.

Screen Shot 2015-05-07 at 9.12.23 PM

It's just a matter of designing the mainboard. I took what I had on my breadboard and put together a circuit in Eagle.

Screen Shot 2015-05-12 at 9.14.29 PM

I then designed the PCB.

Screen Shot 2015-05-12 at 9.12.48 PM

I'm going to have to solder like a ninja to pull this board off. It's pretty tight.

7-Segment Clock Controller front

See this project from start to finish:
Large 7-Segment Clock, Part I
Large 7-Segment Clock, Part II
Large 7-Segment Clock, Part III
Large 7-Segment Clock, Part IV