a 5*5 rgb led matrix, made with arduino and lpd6803 based leds from adafruit.
with an pir sensor, it goes on if it detects movements and a ir distace sensor, 1 animation shows the distance you have from the sensor :).

because its beautiful and cool ;)

my spelling:
well, sorry if i make stupid spelling mistakes, i'm dyslectic and live in Holland

Step 1: How It Works

how it works:
it uses an arduino uno that controls the lpd6803 chips in the rgb leds, so i can set each led individually. the arduino reads text files from an sd card, i've made a program(in c#) where you can make animations and store them so the arduino can read them.

Step 2: Materials Needed

-arduino uno (other arduino's probbably work, but i havent tested)
-25 rgb leds with lpd6803 controllers( the led's i used arent being saled anymore :( these are an newer version, but you will need to adapt the arduino code a bit)
-network shield(for sd card)(probably other shields with sd cards wil work)
-5v dc power supply min 1A

-ir distance senso r (1 animation uses it)
-pir senso r  (the matrix will go on if it detects motion(saves a bit of energy))
-2 pushbuttons

-soldering iron
-wire stripper
-some wires
-wooden board

Step 3: Part With Wood

this is the part im bad at, but ill discribe what ive done:
iv'e put my led's 5cm apart (horizontally and vertically) in a shiny wooden plate from an old kitchen.
the led's from adafruit need 11mm holes(drill them carfully).

at the bottom ive place my arduino with double-sided thape, and left of it a big hole for the pir sensor, the ir distance sensor is placed on top(now it looks like it has eyes ;) ) 

then put the led's in the holes beginning top left(frot vieuw) going from left to right down(see picture)

Step 4: The Electronics

for the leds

led's clock --> 6
led's data --> 7
pir sensor --> A5 (if you have no pir sensor, connect it to the 5v+)
ir distance sensor -->A4 (if you don't have a distance sensor juslt leave it open)

gnd --> Button 1 --> A0
gnd --> Button 2 --> A1

sd: (the default of the ethernet shield)
mosi --> 11
miso --> 12
clk --> 13
cs --> 4

ir distance senor +                       -----> all to arduino's 5v+

ir distance sensor -
pir -                                                     -----> all to arduino's gnd
negative from 5v power supply
led's -
button -

led's + ----> positive from 5v power supply

all black cables are soldered together as central gnd
all red cables(exept one) are soldered together as sensor 5v+ (from arduino)
all yellow cables are signal cables(watch it are 5 yellows so don't mix them up!!)
you also find mine animations here, just put them on the sd card

Step 5: Arduino's Program

well, im not the bast at programming, but it works ;)

this is the code i used, you can download it here, feel free to hack/mod.(and post nice pictures of it ;) )

#include <TimerOne.h>
#include <SD.h>
#include "LPD6803.h"

int raw;
int dat[6];
int nr = -1;
int rgb = 1;
int digit = 0;
int kleur[100][3];
int beeld = 7;
int teller = 0;
int wachttijd = 1000;
int wachtuit = 0;
int talleur = 0;
int beweging = 1;
int beatdet = 0;

File dataFile;
const int chipSelect = 4;//sd stuff

LPD6803 strip = LPD6803(25, 7, 6);//starts the lpd strip

void setup()
  Serial.print("Initializing SD card...");

  strip.setCPUmax(60);//start de ledstrip

  pinMode(10, OUTPUT);//for the sd

  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
  Serial.println("card initialized.");


void loop()
 // talleur = 1;

if (beweging == 1){
  if (talleur == 49)afstandanim(); // if you don't have an ir distance sensor you can delete this line


if (talleur > 50) { //motion detection
beweging = 0;
Serial.print(" analogReadA5:");
if (analogRead(A5) > 300){
beweging = 1;
talleur = 0;

void afstandanim(){
for (int e = 0; e < 100; e++){
int q = analogRead(A4);
int w = (q / 20)-2;
if (digitalRead(A0) == 0){while(digitalRead(A0) == 0){delay(10);}if (talleur == 1)talleur = 49; talleur--; talleur--; break;} //buttons
if (digitalRead(A1) == 0){while(digitalRead(A1) == 0){delay(10);} break;}


void leesSD (long textnr){

nr = 0;
rgb = 1;
digit = 0;
dat[0] = 0;
dat[1] = 0;
dat[2] = 0;
dat[3] = 0;

char FileName[7];
sprintf( FileName, "an%i.an", textnr );//opens the right textfile
dataFile = SD.open(FileName);

rgb = 1;
if (dataFile) {
while (1==1){
raw = (dataFile.read() - 48);
if (raw == -4){//,
if (nr != 25){
kleur[nr][rgb] = dat[1] + (dat[0] * 10);}
rgb = 1;
digit = 0;
dat[0] = 0;
dat[1] = 0;

if (raw == -16){// space
if (nr != 25) kleur[nr][rgb] = dat[1] + (dat[0] * 10);
digit = 0;
dat[0] = 0;
dat[1] = 0;
dat[2] = 0;
dat[3] = 0;


if (raw == -10){//&
Serial.print("next frame:");
wachttijd = dat[4] + dat[3] * 10 + dat[2] * 100 + dat [1] * 1000;

rgb = 1;
digit = 0;
dat[0] = 0;
dat[1] = 0;
dat[2] = 0;
dat[3] = 0;

if (beatdet == 0){
int val = 0;
double gewacht = 0;
if (wachttijd != 10){
while (1 == 1){

val = analogRead(A0);



if (analogRead(A0) > val + 5){

gewacht ++;
if (gewacht > wachttijd / 100) {break;
gewacht = 0;


if (digitalRead(A0) == 0){while(digitalRead(A0) == 0){delay(10);}if (talleur == 1)talleur = 49; talleur--; talleur--; break;}
if (digitalRead(A1) == 0){while(digitalRead(A1) == 0){delay(10);} break;}
nr = 0;

if (raw == 36){//T
wachtuit = 1;
digit = 0;
rgb = 1;
dat[1] = 0;
dat[2] = 0;
dat[3] = 0;
dat[4] = 0;

if (raw == 15){//?
Serial.print("ready with animation number:");
rgb = 1;

if (raw >= 0){//getallen
if (rgb == 4)rgb = 1;
dat[digit] = raw;



// if the file isn't open, pop up an error:
else {
Serial.println("error opening ***.txt");


void setkleuren() { //zet alle kleuren uit ledkleur[][]
for (int i=-1; i <= 25; i++){
strip.setPixelColor(i, Color(kleur[i][3] , kleur[i][1] , kleur[i][2]));

void clearall() {// cleart de hele strip
//lednr = 0;
for (int i=0; i <= 25; i++){
kleur[i][1] = 0;//r
kleur[i][2] = 0;//g
kleur[i][3] = 0;//b

void settm(int tm, int r, int g, int b) {// cleart de hele strip
//lednr = 0;
for (int i=0; i <= tm; i++){
kleur[i][1] = r;//r
kleur[i][2] = g;//g
kleur[i][3] = b;//b

unsigned int Color(byte r, byte g, byte b) // maakt een getal van de r b en g waardes (hoort bij de ledstrip)
//Take the lowest 5 bits of each value and append them end to end
return( ((unsigned int)g & 0x1F )<<10 | ((unsigned int)b & 0x1F)<<5 | (unsigned int)r & 0x1F);


Step 6: Creating You Own Animations

i made this program to create animations.
it is not the clearest program ever, but it works.

-it stores .txt files on you computer. you can with the right 'save' part save them as an .AN file on you sd card(your adruino will read them as animations).
-you have to run the porgram as administrator and select a directonary to save the files to function proper.
-the program makes animations of max 100 frames("#a#.TXT"-->these you can open with my program and save as -->) with a maximum of 50 animations("#an.AN"-->these are going to the sd).

-you can select 2 main colors the first comes the first time you click a pixel, the second the second time. you can also select for colors that appear if you clich a pixel and then the '1''2''3'or'4' key on your keyboard
-you can co forward/backward with the QWE buttons in the progam/on you keybaord, the E will kopy this fram to the next frame(only if there is no next fram it doesnt overwirte anything)
-you can set collums and rows at once.
-you can set the time one frame lasts with the time textbox.
-you can set/toggle all pixels at once

-if you want to delete a frame, you can just delete it's .txt file

-the .txt files are saved in a location you have to choose/create. the name is "[animation number]a[frame number].txt"
the save part of my program saves them to the sd card with the name : "[animation nuber]an.AN", you can create animations with a maximum of 100 animations and almostly infinitly frames.

if you have questions about my program (it has some bugs i can't get out of it :( ) you can always ask. also feel free to mod again or send me improvements if you want.

Step 7: End

well, i hope you enjoyed it. 
evrybody feel free to hack and mod, and to post pictures if you made it or earlyer made something equal ;)
other ideas:
make it into a t-shirt(i'm working on that)
give it beat detection(also working on that, you will see it in my code)
let it be network controlled
ir remote control
put into a table


my site(still under construction)

it can't read the files on the sd: 

try reformatting the sd as FAT, are there .AN file on the sd?
the led's are showing random colors
are they plugged in right in the arduino, and on the BEGINNING of the led strip
pir sensor is not working
some pir senors have diffident output voltage, so you may have to edit the code

<p>Would you mind sharing the source code of your w32 app to create animations ?</p><p>My plan: create a webapp on the raspberri pi to create animations and manage them. The raspberry pi would be connected by serial to the arduino and would send animations upon request</p>
Hi geodevraag ! <br> <br>I want to transfer some data to arduino and light up specific color associated with a specific data, in the specific rgb led .I want to send the data over wifi . <br> <br>Can you just give me initial advice how to proceed here. <br> <br>regards <br>prabhakar.
I like your little program you made is there anyway you could make one for me that has 16 across and 11 down? i have a motion curtain that uses the lpd6803's and would love to be able to program some stuff for it, i have an adrino mega but i just got it and i am trying to learn to use it, thanks and God bless.
No, i'm sorry. I really wouldn't have time for that now. I'm really buisy with school, and programmig is a lot of work. I would advice you just to learn programming with your arduino and just program something only with your arduino.
Nice job! I put one together since I had some spare LPD6803 LEDs hanging around. Unfortunately I'm having problems with the code. I'm using the official Arduino Ethernet shield &amp; confirmed it was recognizing the animation files on a 2G SD card using the Card Info sketch from the SD library. When I use the 5x5 LED sketch (rgb_from_sd_6_ir_pir.pde) I get the &quot;card initialized&quot; message followed by &quot;error opening ***.txt&quot;. The LEDs get cleared (off) but after that no activity. I have both PIR proximity &amp; movement sensors disabled for now &amp; commented that part of the code out.<br><br>Which version of your code would you recommend using? The code listing on the website, or the atttached zipped version? I noticed they are not the same. Also, what is the purpose of the A1 &amp; A0 buttons?<br><br>Any suggestions on what may be happening would be greatly appreciated.
you shouldn't use the code in the zip, i havent changed that, sorry. Have you the .AN files on the sd card?? the error says .txt, but it has to be .An just change the extention with notepad. The buttons are for previous/next animation.
don't use the code in the zip, but the code above. the zip is old but i haven't changed it yet!
I just got <a href="http://www.bestlightingbuy.com/lpd6803-digital-rgb-led-pixels.html" rel="nofollow">LPD6803 led pixels</a> for 69 bucks , and am wondering how to tell the input from the output side of led pixels. I guess I would say the input side is the side with the wires that go to the component side of the enclosed PCB.
i dit that wrong the first time!, but on mine there are little arrows that point from input tu output
Yes you are right, I'm also not very good at processing so sending characters directly via serial port is definetly easier. Nice Instructable by the way :)
Is it possible to directly control pixels via usb port of Arduino? I am also trying to make a pixel led screen with live pixel control through Processing. So far I'm stuck with coding :s
yes, you can just use the arduino's serial port : <a href="http://arduino.cc/en/Reference/Serial">http://arduino.cc/en/Reference/Serial</a><br> I've never used processing, but you can connect to the arduino's serial/com port and send charchers.<br> The arduino gives using Serial.Read() <a href="http://www.asciitable.com/">the decimal value of that charcher</a>.

About This Instructable




More by goedevraag:5x5 rgb lpd6803-led matrix arduino controlled 
Add instructable to: