The Lite Brite clock is an idea I came up with while sitting in front of a desk that had a pile of LED's on it from a 4X4 LED cube build. I was trying to think of something cool to build using an Arduino and the left over LED's. That's when my three year old daughter came in the room and started playing with her pink Lite Brite.
I noticed how the Lite Brite pegs actually looked like LED's. I then tried pushing an LED into the hole on the Lite Brite. It was a perfect fit! I figured I could just shove the LED's in from the back and it would be very easy to solder. Unfortunately, the holes were smaller in the back, and I ended up having to put the LED's in through the front. It still worked out fairly well, but the soldering was more difficult than I anticipated.
Then I had to decide what I was going to make. After counting the columns and rows, I determined I didn't have enough LED's to populate the entire screen. That's when an alarm clock that was sitting in the room caught my eye. So I decided to make a clock.
The Arduino lite brite clock basically consists of an Arduino, 46 LED's, 12 resistors, a Lite Brite and a few other odds and ends.
I have the LED's multiplexed like this: all of the cathodes on each row are soldered together. All of the anodes on each column are soldered together. The LED's making up the colon are stand alone. Since there are 5 rows and 10 columns, the digits take up 15 pins on the Arduino, and the colon takes up 2 pins for 17 pins total.
To make an LED light up, you set the pin of the row of that LED to LOW and the pin of the column of that LED to HIGH. This is an efficient way to control 46 LED's individually, but it does have one major drawback. Only one LED can be turned on at a time.
The way to get around this? Turn one LED on, then turn it off immediately. Turn the next LED on, then turn it off immediately. And so on. Because of the speed of the Arduino, and our persistence of vision, all of the LED's that are being switched off and on appear to be on simultaneously.
The only drawback I have seen to using this method is that the LED's are dimmer than if they were receiving constant current. I used 100 ohm resistors, but I think an even lower value would have been fine, considering that each LED is only on around 1/30 of the time. The other drawback to this method is that the colon was too bright if supplied with constant power. This is the reason I put the colon LED's on their own pins. They are getting turned off and on at the same frequency as the digits so that they maintain the same brightness.
Download the Lite Brite Tester code here ~14k .ino file
Download the Lite Brite Clock code here ~15k .ino file
Writing the clock code was much easier than I thought it would be. I wrote a function that would draw each digit in the first 7 segment position. I made it so you could pass an offset to the function when you called it. For example, to write a 3 in the first position: three(0); ...to write it in the 2nd position is three(3); and the last position is three(6); . There is a function for each number. Maybe not the most efficient, but it works.
I included the Time.h library, which you can download here: http://arduino.cc/playground/Code/Time
If you look at the code, you will see that you can easily set the time when you upload the sketch to your Arduino. Alternatively, you have 3 inputs left over you could use for buttons to set your clock manually.
I simply used a series of case statements to determine which digit to display. For the minutes, I used the fact that integer division truncates the remainder to get the first digit of the minutes. I then used the mod function to get the second digit of the minute portion.
I have embedded all 16 of the YouTube build videos in this post for those that would like to watch how the Lite Brite clock was made. There is also a detailed Instructable where you can get step by step instructions and copy/paste the code for the clock.