This is a fun speaker timer I made for some upcoming conferences. It uses a 4-digit charlieplexed LED (pseudo 7-segment) display and is driven by a AVR ATMega328 or an Arduino. It allows a default time to be set, can be paused, and will put out 5 Volts on several IO lines when 10, 5, 1, and 1 minutes are remaining. This allows for some fun (say firing up a NERF rocket launcher as you get closer to quitting time).
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
The first thing we want to do is create our LED board. We are essentially creating a large 7-segment display using 2 LEDs per segment versus buying an actual 7-segment display this size which would be very pricey. The display is symmetrical so you will want to figure out the distance you want between one side of each digit and the other and then use that value for the spacing of the 3 horizontal segments as well. It may help to draw boxes for the digit segments and then mark the LED locations on each side of your squares as 1/3rd of the square length in from each edge. See the pictures. One of the big time savers in this project is putting the LEDs close enough together that you can twist the leads to create a common connection. Don’t make your display so large that this doesn’t work. If you do use a large display, you might want to increase the number of LEDs as well. I used about 1.5″ spacing.
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
Now that you have your holes drilled in your LED board you are almost ready to install the LEDs. You may want to clean up the holes a bit first depending on the material you selected. LEDs are polarized so it does matter which way they are put in. The longer LED is positive. Also, if you feel around the circumference at the base of the LED the negative side is flat. The timer uses a method known as charlieplexing in order to light up all these LEDs using only 8 wires. While it is theoretically possible to drive this with only 7 wires, I chose to use 8 because it made the wiring simpler which was my primary goal all along. I won’t describe charlieplexing here, but there are lots of articles and tutorials available on the Internet.
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.
For more Detail: Fun Hackable Speaker Timer using ATMega328 microcontroller