Dave Bullock / eecue

photographer, engineering leader, nerd


Programming the Adruino and TLC5940 for LED Fun

Recently I wrote my first Arduino program to fade LEDs. Arduino is an open source electronics platform designed to be easy to use by "artists, designers, hobbyists, and anyone interested in creating interactive objects or environments." Basically it's a microcontroller that can be easily programmed to do fun things.

I am using a low cost clone called a Bare Bones Arduino. One of the best parts about the Bard-Bones Arduino clone is that it comes in a kit. Soldering stuff together is fun!

Previously I wrote about my adventures with a BASIC Stamp. The Arduino is very similar to a BASIC Stamp, but uses the C programming language instead of BASIC. This makes it more powerful and extensible.

In the past I had only written one program in C to control some serial port extenders. Writing in C for this Arduino project was a lot of fun and it showed me how similar C is to PHP, which I have been writing extensively for over 10 years.

The program I wrote was based on some code from Peter Mackey at Pixelriot. I changed it up a bit so I could control the LEDs fading on an individual basis. I then made it do a Knight Rider fade (see video below). Here is a link to my version of the Arduino 5940 code.

A short video showing pulsing LEDs triggered by an Arduino controlling the TLC5940 chip.

The code controls a Texas Instruments TLC5940 chip. The TLC5940 is an LED controller that can fade up to 16 LEDs to over 4,000 levels of brightness. You can chain the chips together to control around 400 total LEDs.

This first program is actually a proof of concept for a project I'm working on. I can't really talk too much about the project, but it will involve a whole mess of LEDs and an old school public art installation.

Currently I'm working on a new Arduino project that is a multipurpose long exposure, intervalometer and sound and light trigger for Canon cameras. I'll post more about that when it's done.

I'm really enjoying both writing in C and playing with electronics. Microcontollers are awesome.

Bare Bones Arduino and TLC5940 On Breadboard

This Bare-Bones Arduino clone connected to a breadboard is controlling a Texas Instruments TLC5940 LED controller which in turn is pulsing the LEDs