This is a fun and cheap project that makes use of AVR interrupts. If you are interested in using interrupts with the AVR this project is a good tutorial.
Step 1: Getting Parts
1. For the timer itself you will need a material to hold the LEDs. I used Lexan for mine, but some thin plywood or most any flat stock that you can drill easily should work.
2. 58 LEDs or your favorite color (14/digit *4 digits + 2 for colon). Wide angle diffused LEDs are best here. If I had it to do over I would probably use clear lensed LEDs to make it easier to read the clock. Also, if you put a piece of paper in front of the clock you can read it from a wider angle.
3. 4 momentary push buttons for reset, start/stop, minute+, and minute-.
4. 8 resistors or the appropriate size for your LEDs. This is determined by color (voltage drop) and current capacity. For my red LEDs with 20mA of current, the resistors are 75 Ohms. Note that there are several resistor calculators out there and that you will need to divide the value they give by 2 because there is a resistor on both the high and low line when charlieplexing.
5. An Arduino or AVR ATMega328 microcontroller. The plus side of using the Arduino is that you don't need to solder as much, but it costs more than all the other components for the project combined. If you use the raw chip (what I did) you will need a programmer and I would definitely recommend a 28-pin socket to avoid killing the ATMega328 during soldering and to allow for easy modifications.
6. Either a prototyping shield if you are using an Arduino or a small printed circuit board. I used a cheap one from Radio Shack ($3.19) with the copper pads on one side.
7. Terminal strip (optional). I got a 6 connector strip at Radio Shack for a few dollars. I use it to put out the trigger signals and also have a 5V and ground connector.
8. Power supply (optional). If you are using Arduino this is already covered. For using the raw ATMega328 you will need a source for 5V to power the chip and the triggers. I used a 7805 voltage regulator connected to a 9V battery clip. You could use 3.3V to power this for most color LEDs (don't forget to adjust resistor values if you do) and it would probably work. I wanted to be able to drive 5V devices (plus I had some 7805's laying around).
9. Wire. I used 20 AWG to wire up LED panel and 22 AWG for everything else.
10. Standoffs (optional) for mounting your circuit board on the back of the LED panel.
1. Soldering iron.
2. Needle nose pliers
3. Programmer if using raw ATMega328. I use the USBTinyISP from AdaFruit.
5. Drill bits, a small pilot bit and 3/16" bit for LED holes assuming your are using T1-3/4 (5mm) LEDs.
6. Screw Driver
7. Ruler and/or square for laying out LED holes
Step 2: Layout the LED Board
Once you have everything laid out and double checked, I recommend you use a very small drill bit to drill the initial pilot holes. The nice thing about using a small bit is that even if you are off a little, it will likely not be noticeable in the final project. Now you can drill out the full size holes and get ready to start inserting LEDs.
Step 3: Install LEDs on Board
The following diagram comes from the C source code file. If you have questions about this project, look there first for answers. If this diagram looks messed up in your web browser have a look in the source file main.c.
/* Each 2 LED segment is activated by applying +5V to one line, grounding another and setting everything else
* to input (high impedence or an open circuit).
* The following diagram shows a REAR VIEW of my board so be warned the leftmost
* digit is the least significant.
* ^^ LED with circuit symbol pointing up (+ on bottom - on top)
* << LED with circuit symbol pointing left (- on left + on right)
* >> LED with circuit symbol pointing right (+ on left - on right)
* ## LED with circuit symbol pointing down (+ on top - on bottom)
* numbers refer to the charlieplexing line (note 0 runs around the the perimeter)
* 0 | | | | | | | | 0
* 0 ^^ ^^ ^^ ^^ ## ## ## ## 0
*0 -->>--1--<<-- 3 --<<--4-->>-- 2 1 -->>--4--<<-- 3 --<<--6-->>-- 0
*0 -->>-/ \-<<-- 3 --<<-/ \->>-- 2 -->>-- 1 -->>-/ \-<<-- 3 --<<-/ \->>-- 0
*0 ## ## 3 ## ## 2 1 ^^ ^^ 3 ^^ ^^ 0
*0 --<<--2-->>-- 3 -->>--5--<<-- 2 -->>-- 1 --<<--5-->>-- 3 -->>--7--<<-- 0
*0 --<<-/ \->>-- 3 -->>-/ \-<<-- 2 1 --<<-/ \->>-- 3 -->>-/ \-<<-- 0
0 ^^ ^^ 3 ^^ ^^ 2 1 ## ## 3 ## ## 0
0 | | | | | | | | 0
Double check the orientation of each pair of LEDs as you insert them. Once you have completed a digit you can twist together the leads in the centers of the 8's. Just a couple twists is good. Don't get too crazy or you might break some leads. After all the LEDs are installed, you can install the 8 charlieplexed lines numbered 0-7. Note there there are a couple of jumpers that will also need to be installed to connect clusters of the same number together. See the pictures if you are unsure. I would highly recommend numbering the wires with masking tape, at least until you get everything put together. Solder the connections together then trim any excess leads.
Step 4: Test the LED Board
Step 5: Build the Rest of the Circuit
* This device uses an ATMega328 chip, although a 20-pin AVR MCU would
* work just as well. I just have some ATMega328 chips laying around so
* I decided to use them. Port B is used to drive the 8 wires for the
* display. Port C is used for setting the timer. Port D is used
* for outputs. Note that 1/2 normal value for resistors should be used since there
* is resistance on both high and low lines. About 150 ohms for red.
* Here is the pinout: ____________
* Pin 1 - NC normally RESET pin ----| |---- Pin 28 - NC
* Pin 2 - PD0 - 10 minute warning terminal ----| |---- Pin 27 - NC
* Pin 3 - PD1 - 5 minute warning terminal ----| |---- Pin 26 - PC3 - Restart button
* Pin 4 - PD2 - 1 minute warning terminal ----| |---- Pin 25 - PC2 - Start/Stop button
* Pin 5 - PD3 - overtime warning terminal ----| |---- Pin 24 - PC1 - Minute minus button
* Pin 6 - NC ----| |---- Pin 23 - PC0 - Minute plus button
* Pin 7 - Vcc - plus 5V ----| |---- Pin 22 - Ground
* Pin 8 - Ground ----| |---- Pin 21 - AVref - plus 5V
* Pin 9 - PB6 - charlieplex line 6 ----| |---- Pin 20 - AVcc - plus 5V
* Pin 10 -PB7 - charlieplex line 7 ----| |---- Pin 19 - PB5 - charlieplex line 5
* Pin 11 - NC ----| |---- Pin 18 - PB4 - charlieplex line 4
* Pin 12 - NC ----| |---- Pin 17 - PB3 - charlieplex line 3
* Pin 13 - NC ----| |---- Pin 16 - PB2 - charlieplex line 2
* Pin 14 - PB0 - charlieplex line 0 ----| |---- Pin 15 - PB1 - charlieplex line 1
If you are using an Arduino, you might want to either solder your resistors inline for the charlieplex lines or you can put them on your board.
Once the board is done you can connect the 8 charlieplexing lines to the ATMega328 pins on your main board. Note that you should not have the chip installed when you are soldering all this stuff. That is, unless you enjoy buying new chips. Besides you haven't programmed the chip yet anyway, have you?
Step 6: Program the Chip
I am running my chip at 8 MHz with the internal oscillator . If you are running at a different frequency you will need to adjust. I can tell you that the default 1 MHz will not work. If you are using the Arduino you will need to modify the code for a couple reasons. The Arduino runs at 16 MHz and it also uses an external oscillator which takes up 2 pins on the ATMega328 which I'm currently using for something else. Not big changes, but you will definitely have to make them.
Step 7: Power Up and Enjoy
Enjoy! If you questions or comments leave them here or on Twitter at @ppolstra.