Multiplexing for a 7 year old

I have been wanting to make a LED clock for sometime and can’t really believe I never have. So I rummaged through some parts and found some nice 4 segment LED displays. I found some code for a simple clock at nootropicdesign, and it did something pretty neat. It slowed down multiplexing so you could see it, then it would get faster until it appeared “on”. It was a good sketch, but I thought, it needs set buttons, a blinking colon, and a way to trigger the multiplex slow down trick with out restarting. (and resetting the clock!) So I made this little clock and it worked great.

This was a great way to show my 7 year old (who wrote his first Arduino sketch the other night) about multiplexing. A picture is worth 1,000 words right? Well, a hands on demo is worth even more than that. After explaining how it works, he totally understood.

Then I noticed I had, sitting on my bench, some Lexan laser cut, for those little Nokia LCD’s I love so much, that had a 4 segment LED display size hole in them. I made the clock and moved some pins around to free up 3 PWM pins for an RGB LED. Because it’s always good to have a full PWM controlled RGB LED, ya know, just in case. Thinking of programming the LED different colors/brightness according to sun position. I also remembered I have a few Dallas 1307’s.. Maybe tomorrow, it’s late right now, and besides I’m busy porting software for a Touch Shield I got. 🙂

If your new to multiplexing, it basically combines pins of LED’s and then through switching on only certain pins at a time, you can light only certain LED’s. If you were to apply power to more than 1 cathode and anode, you would get unwanted LED’s lighting. So how can this work? I have to light 14 LED’s just to display 1:00! What makes this work is you light one segment at a time. With a microcontroller, you can do this in an order and at a rate that’s fast enough that the human eye thinks that they are on solid. Most LED 4 digit displays found in microwaves, stoves, appliances, and VCR/DVD players are multiplexed. Its a great way to light a lot of LED’s with less pins than connecting each directly to the microcontroller. Below is a circuit diagram of the LED display I used. The link for the code is below as well, as always, hack away. 🙂 Detailed pinout for Arduino are in the code comments.


Get the code here. (Arduino 22 .pde file)

Schematic (Eagle file)

Schematic (png file)

Bench lights (LED’s, CCFL’s, and a little overkill..)

OK, so about a year or so ago, I was working at my bench and I could not quite see what I was doing. I needed more light! I got so mad, I built this in about a half a day, and fixed the problem. Now I have enough light even when working on tiny things with magnifiers on my head.

I now have 4 white 12″ CCFL tubes, 6 1 watt warm white LED’s, 144 cool white LED’s (in strips), and 12 5mm diffused white LED’s under the bench pointed at the floor (did you ever drop anything?). All the LED’s are ramped on and off with PWM dimming as you will see in the video above. I also have 2 more channels available with full PWM dimming. Running everything wide open will allow you to see very well, and only consumes 17 watts.

A little overkill, but I was really frustrated. And hey, who just wants a plain ole boring switch anyway? Not me…