Scott Fitzgerald / Art & Education

scott@droolcup.com


May, 2009

Arduino + LED Workshop

This is a temporary page to replace the one I had to recently pull. I'll get it back to its former glory as soon as I can.


May 16&17 18h-20h: Btiment dart contemporain, 28 rue des Bains, 1205 Genve

Part of the AWESOME Mapping Festival

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. Its intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

This workshop will introduce the Arduino platform as a controller for LED lighting. We will look at DMX control for large scale lighting, and also smaller scale projects with multiple LEDs. Libraries exist for each of these options, making it more accessible to novice users.

On the first day,after a quick introduction to the Arduino, we will use commonly available ICs like the Texas Instruments TLC5940 for fine, granular control of lights, and Maxims MAX7219 and MAX7221 for controlling LED arrays.

On the second day, we will look at the forthcoming DMX library for the Arduino, and experiment with controlling larger lighting arrangements with sensors and other inputs.

For much more information, check out ITPs Physical Computing site

Workshop Summary

1)Introduction to the Arduino. 2)Installing the software and getting set up.

Code

int ledPin = 12;                // LED connected to digital pin 12

void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()                     // run over and over again
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}

Analog fading of an LED

Using PWM, we change the perceived brightness of an LED. Code

Wiring

We use the same setup as above, but we move wired from pin 12 to pin 11.

Using the TLC5940

The TLC5940 is a 16 channel constant current sink driver. This chip allows us to control 16 LEDs with 4096 unique levels of brightness. you can cascade ships as well to get more LEDs.

First, we need to install the TLC5940 Library. If you need to, read more about libraries here. You can download the most recent version of the TLC library here. (NB : you must be using an Arduino Diecimila or later with this library).

Code

Wiring

Wired TLC5940

Communicating Serially with the TLC

Using a multimedia computer, we can send complex images to the TLC. The arduino code for communicating with 3 TLCs serially looks like the following

Arduino Code

I use Cycling 74s authoring environment Max to send quicktime movies or generated video to the LEDs.

Below is Max5 code for connecting with an arduino and TL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T3oGQ.nPSHTlecb6+erKmFtZdFcDeAntnKE04Omfd.f.wdvN6
tqGT427qq9ePnlgAe
-----------end_max5_patcher-----------

I have also done some work with OpenFrameworks and communicating with the TLC. You can download examples here.

DMX

DMX is a lighting control protocol. It is robust and flexible. There are a number of products available on the market for controlling DMX over USB (most notably the ENTEC DMXUSBPro and Open USB DMX boxes). Hwever, the Arduino can send DMX as well. We only need an external IC (We used the MAX485 from Maxim) a 100k resistor and some wires. Oh, also, we will need the SimpleDMX library from here.

It is best to follow these instructions for wiring the 485 and hooking up your female DMX adapter.

Connect Arduino Pin 3 to Pin 4 on the 485.

Figure out what channels your fixtures need to send data to them. The ones we were using had 6 channels per fixture : Red, Green, Blue, Strobe, Rainbow, and Dimmer. In order to see anything turn on, we needed to give the dimmer a value of 255 (full brightness). Code


2/4

Next project: → Workshops

Previous project: ← Arduino Serial Examples