Monday, November 30, 2009

Seven Segment LED Arduino Clock

As an early Christmas present this weekend, my dad let me go through his old electronics parts boxes to pick out anything I might find useful. One of the first things to really catch my eye was a seven segment LED display.

These are the type displays you see in most digital clocks, so making a clock out of them isn't particularly ground-breaking. Unfortunately, I only have one digit, so just displaying the full time was out of the option. I've seen videos of single tube nixie clocks online, and appreciate the style of flashing each digit individually (Granted, they're doing it because nixie tubes are #%$! expensive, and not because they just don't feel like spending the $3 for a 4 digit display).

The thing on the left is the module I built for my DS1307 so that it'll always be backed by a battery and never lose the time. Super nice when you're moving it between projects.


I pretty much explain everything in the video, but as anyone who has recorded themselves know, you get 50% less articulate once you press record. I point out that AM/PM is easy, since you only need to divide by 12. This is correct, since I'm running the DS1307 in 24 hour mode, but kind of silly, since the DS1307 has a 12 hour mode. I simply run it in 24 hour as a matter of personal preference, since I'm using the same clock chip over and over in all my projects, some of which really lend themselves to 24 hour mode, and don't find converting between 24 and 12 hour mode that difficult when needed.

I also mention using a shift register LED driver. I haven't mentioned these yet, but I bought a couple LED drivers, which are nice because they let you drive 8 or 16 LEDs, using only one resistor to limit current, and only 2-4 pins on the controller. This means it's trivial to change resistor values to adjust brightness, and that I don't have to worry about my power budget on the controller. (Link to the 8 bit LED driver I bought)

Source code.

Note that I got lazy, and used delay()s everywhere in the display system, so there really isn't any way to set the time on the clock as is, other than plugging it into a computer and using the serial port. Feel free to convert it to being non-blocking, but I didn't feel like putting that much effort into a quickie weekend project like this.

5 comments:

  1. every time you post one of these i become more and more happy that i changed majors. whee.

    ReplyDelete
  2. Hey, I have read most of your blog and yeah I love it. :D I am trying to make a clock like you are here, but I have a common anode LED display and I read that the power won't be enough coming out of my 4511 led driver. So, I have never used transistors before, can you explain how I would use them?

    My current circuit is as follows:

    Arduino Pin 4-7 -> 4511Driver A-D
    4511Driver A-G -> Display A-G
    5V -> Display Anode

    Where would I put the transistors? Or do I just need to get a common cathode display?

    ReplyDelete
  3. Great job!

    Do you have a schematic available?
    Thanks amigo!

    Migs
    mreznicek@pretensa.com

    ReplyDelete