Introduction: LilyPad Wrist Band POV

Persistence of Vision (POV) is the illusion  that an image continues to persist even though the image has changed.   In essence, we are taking advantage of the limitations of the brain-eye processing time.  With a camera we can tune our eye for a longer exposure.  The Lilypad POV (row of LEDs) is a fun toy to build with minimal programming and electronic needs.

Step 1: Supplies

 You will need:
  1. 8 LEDs (though you can use more or less, probably not less than 6 for a clear image)
  2. Lilypad Arduino 
  3. Lilypad Power Supply 
  4. Conductive thread
  5. Velcro/fastener
  6. Elastic Band

Step 2: Layout of LEDs

Choose 8 LEDs.  I am using the Lilypad Bright White LED (www.sparkfun.com/commerce/product_info.php).  You can use other LEDs but keep in mind the LEDs required forward voltage and current consumption ratings; you may have to include a resistor and/or need additional power.   

I have chosen to use output pins 6-13 and 5 as ground.  (I will explain more in the next step)

Because I am inexperienced with sewing, I first stitched everything down on a piece of fabric to be transfered later to an elastic band 

Step 3: Sewing LEDs

Before sewing make sure the plus side (+) of the LEDs is facing the Lilypad.   Make sure that each LED plus side is not connected or touching anything other than the corresponding pin of the LilyPad. 

We are going to use a fairly common trick.  We know that later we will have to attach a power supply to the LilyPad and it can be difficult to combine thread lines.  Therefore, we can use a little trick by declaring pin 5 as output and setting the pin to low (a fake ground).  In your code, you will write this:

int ground = 5;

void setup() {
   pinMode(ground,OUTPUT);
   digitalWrite(ground,LOW);



Note: while we can set any pin to ground, usually, it is not recommend to set a pin HIGH as another PLUS pin.  LilyPads can only output 40mA from each digital I/O pin.

We can stitch all of the minus sides of the LEDs together and then to pin 5.

After you complete your sewing, plug-in your LilyPad to your computer and use the following code to flash all the lights. 

int ledPin13 = 13; // LED connected to digital pin 13
int ledPin12 = 12; // LED connected to digital pin 12
int ledPin11 = 11; // LED connected to digital pin 11
int ledPin10 = 10; // LED connected to digital pin 10
int ledPin9 = 9; // LED connected to digital pin 9
int ledPin8 = 8; // LED connected to digital pin 8
int ledPin7 = 7; // LED connected to digital pin 7
int ledPin6 = 6; // LED connected to digital pin 6
int ground = 5; // LED connected to digital 5 "ground"

int ledPinArray[8] = {6,7,8,9,10,11,12,13};

void setup() {
// initialize the digital pin as an output:
for(int i = 0; i < 8; i++){
pinMode(ledPinArray[i],OUTPUT);
}
pinMode(ground, OUTPUT);
digitalWrite(ground, LOW);
}

{
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],HIGH);
}

delay(1000); // wait for a second
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],LOW);
}
delay(1000); // wait for a second
}

Step 4: Wrist Band Setup

I transfered my fabric with LilyPad and LEDs stitched on to an elastic band.  The band will allow people of different arm width to use the toy.

 I am using the lilypad power supply (www.sparkfun.com/commerce/product_info.php).  This device uses a AAA battery and has 3 minus holes and 1 plus hole.  Stitch Minus on the Power Supply to Minus on the LilyPad and Plus on the Power Supply to Plus on the Lilypad.  

Choose a fastener.  I chose velcro because it's easy to sew down and you can adjust for arm width

Step 5:

 Turn on your Power Supply and make sure all the lights are flashing.

Step 6: Source Code Part 1

POV works by blinking a specified set of LEDs, waiting a second, and then blinking another set of specified LEDs.  See Image Below.  Between each column we want to delay 2.5 milliseconds (ms).  To form the letter P, for the first 2.5ms nothing is on.  The next 2.5ms all the LEDs are on. The next 2.5 ms only LEDs 6 and 9 are on....).  In our code we save this letter in the following manner:

int P[] = {
1,1,1,1,1,1,1,1,
0,0,0,0,1,0,0,1,
0,0,0,0,1,0,0,1,
0,0,0,0,1,0,0,1,
0,0,0,0,1,1,1,0,
0,0,0,0,0,0,0,0};

I used this nifty website to help me figure out which pins I needed to turn on (www.repulsor.net/minipov/)

Alternatively, we can write out the entire word (to see the letters turn your screen on its side):
int lilypad[] = {
1,1,1,1,1,1,1,1, //L
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,1,0,0, //i
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //l
0,0,0,0,0,0,0,0,

1,0,0,0,0,1,1,0, //y
0,1,0,0,1,0,0,0,
0,0,1,1,0,0,0,0,
0,0,0,1,1,1,1,0,
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //p
0,0,0,0,1,0,0,1,
0,0,0,0,1,0,0,1,
0,0,0,0,0,1,1,1,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //a
1,0,0,1,0,0,0,0,
1,0,0,1,1,0,0,0,
1,1,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //d
1,0,0,1,0,0,0,0,
0,0,0,1,0,0,0,0,
1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0};

 

Step 7: Source Code Part 2

The Entire Code


#define NUM_ELEM(x) (sizeof (x) / sizeof (*(x)))

int lilypad[] = {
1,1,1,1,1,1,1,1, //L
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,1,0,0, //i
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //l
0,0,0,0,0,0,0,0,

1,0,0,0,0,1,1,0, //y
0,1,0,0,1,0,0,0,
0,0,1,1,0,0,0,0,
0,0,0,1,1,1,1,0,
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //p
0,0,0,0,1,0,0,1,
0,0,0,0,1,0,0,1,
0,0,0,0,0,1,1,1,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //a
1,0,0,1,0,0,0,0,
1,0,0,1,1,0,0,0,
1,1,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //d
1,0,0,1,0,0,0,0,
0,0,0,1,0,0,0,0,
1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0};


int ledPin13 = 13; // LED connected to digital pin 13
int ledPin12 = 12; // LED connected to digital pin 13
int ledPin11 = 11; // LED connected to digital pin 13
int ledPin10 = 10; // LED connected to digital pin 13
int ledPin9 = 9; // LED connected to digital pin 13
int ledPin8 = 8; // LED connected to digital pin 13
int ledPin7 = 7; // LED connected to digital pin 13
int ledPin6 = 6; // LED connected to digital pin 13
int ground = 5; // LED connected to digital 5 "ground"

int ledPinArray[8] = {6,7,8,9,10,11,12,13};
// The setup() method runs once, when the sketch starts

int columnDelay;
int sizeWord = 0;
void setup() {
// initialize the digital pin as an output:
for(int i = 0; i < 8; i++){
pinMode(ledPinArray[i],OUTPUT);
}
pinMode(ground, OUTPUT);
digitalWrite(ground, LOW);

columnDelay = 2.5; //wait 2.5ms between each column flash
Serial.begin(9600);
Serial.print("Number of lilypad: ");
Serial.println(NUM_ELEM(lilypad));
delay(2000);
sizeWord = NUM_ELEM(lilypad);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

/*void loop()
{
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],HIGH);
}

delay(1000); // wait for a second
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],LOW);
}
delay(1000); // wait for a second
}*/

void loop()
{
//Serial.print("Number of lilypad: ");
//Serial.println(NUM_ELEM(lilypad));
//delay(1000);
printWord(lilypad);
delay(8); //wait a little bit between each display of the word LilyPad
}

void printWord(int wordVar[]) {

int numRows = sizeWord/8;
for(int j = 0; j < numRows; j++) {
for(int i = 0; i<8; i++) {
digitalWrite(i+6, wordVar[i+j*8]);
}
delay(columnDelay);
}

Step 8: Take Pictures!

 Now all you have to do is wave your arms about and take a picture!

This material is based upon work supported by the National Science Foundation under Grant No. 0855886 to Kylie Peppler. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Comments

author
Tom_Neverwinter made it!(author)2015-11-11

hmmm esp8266 pov with updateable from phone?

author
DottieB2 made it!(author)2015-10-27

I am using the LilyPad Simple and trying to run this program with some adjustments. I can't get all of the lights to blink. Can you look at my code and tell me what is wrong?

#define NUM_ELEM(x) (sizeof (x) / sizeof (*(x)))

int lilypad[] = {

11111110, //D

10000010,

10000010,

10000010,

10000010,

10000010,

01111100,

00000000,

11111110, //o

11000110,

10000110,

10000110,

10000110,

11111110,

11111110,

00000000,

00000110, //t

00000110,

00000110,

11111110,

00000110,

00000110,

00000010,

00000000,

00000110, //t

00000110,

00000110,

11111110,

00000110,

00000110,

00000010,

00000000,

10000110, //i

11111110,

11111110,

10000110,

00000000,

11111110, //e

10110110,

10110110,

10110110,

10110110,

10110110,

10110110,

00000000,

11111110,

10010010,

10010010,

10010010,

10010010,

10010010,

01111100,

00000000,

00000000};

int ledPinA4 = A4; // LED connected to digital pin A4

int ledPinA3 = A3; // LED connected to digital pin A3

int ledPin1A2 = A2; // LED connected to digital pin A2

int ledPin11 = 11; // LED connected to digital pin 11

int ledPin10 = 10; // LED connected to digital pin 10

int ledPin9 = 9; // LED connected to digital pin 9

int ledPin6 = 6; // LED connected to digital pin 6

int ledpin5 = 5; // LED connected to digital 5

int ledPinArray[8] = {5,6,9,10,11,A2,A3,A4};

// The setup() method runs once, when the sketch starts

int columnDelay;

int sizeWord = 0;

void setup() {

// initialize the digital pin as an output:

for(int i = 0; i < 8; i++){

pinMode(ledPinArray[i],OUTPUT);

}

columnDelay = 2.5; //wait 2.5ms between each column flash

Serial.begin(9600);

Serial.print("Number of lilypad: ");

Serial.println(NUM_ELEM(lilypad));

delay(2000);

sizeWord = NUM_ELEM(lilypad);

}

// the loop() method runs over and over again,

// as long as the Arduino has power

/*void loop()

{

for(int i = 0; i < 8; i++){

digitalWrite(ledPinArray[i],HIGH);

}

delay(1000); // wait for a second

for(int i = 0; i < 8; i++){

digitalWrite(ledPinArray[i],LOW);

}

delay(1000); // wait for a second

}*/

void loop()

{

//Serial.print("Number of lilypad: ");

//Serial.println(NUM_ELEM(lilypad));

//delay(1000);

printWord(lilypad);

delay(8); //wait a little bit between each display of the word LilyPad

}

void printWord(int wordVar[]) {

int numRows = sizeWord/8;

for(int j = 0; j < numRows; j++) {

for(int i = 0; i<8; i++) {

digitalWrite(i+6, wordVar[i+j*8]);

}

delay(columnDelay);

}

}

author
DottieB2 made it!(author)2015-10-26

What kind of camera/settings did you use?

author
quasiben made it!(author)2015-10-26

I can't recall exactly -- something with a exposure time of about ~1.5sec

author
Jin+WookK made it!(author)2015-09-05

Nice Project!!! I made a 3d printer case and make LED watch. and add button code to change the word.

KakaoTalk_20150830_111553081.jpg
author
rockyg6 made it!(author)2015-10-04

can you share how you added those?

author
ssraf made it!(author)2015-09-22

Still working, trying to make it easier to read!
Great project! Thanks!

20150922_170628.jpg
author
avanyway made it!(author)2015-09-05

cool glad you made a tutorial

author
Zovits made it!(author)2010-03-18

Why did you create the ledPin6-ledPin13 variables?
They don't seem to be used anywhere.
Or is it a way to tell the Lilypad that those outputs are used to power LEDs?

author
quasiben made it!(author)2010-03-18

 You're right.  I was using those variable in a previous version of the code.  I will take them out and repost.  Thanks!  For what it's worth, I am telling the Lilypad to use pins 6-13 as output using the following code:
int ledPinArray[8] = {6,7,8,9,10,11,12,13};

for(int i = 0; i < 8; i++){
   pinMode(ledPinArray[i],OUTPUT);
}

author
rashope made it!(author)2013-03-27
Thanks for posting such a great tutorial! I am using the LilyPad USB, which has a different numbering on the pins. I have succeeded at blinking all the lights, by changing the values in the array as such:

int ground = 2; // LED connected to digital 2 "ground"
int ledPinArray[8] = {A5, A4, A3, A2, 11, 10, 9, 3};

But when I run the rest of the program, I have only two leds blinking... I am working on understanding the loop, and I think the problem is that the ledPinArray variable isn't used in the digitalWrite command in the printWord function... and since my pins are not all numerals, this is failing for me. Can you help me get my head around how the PrintWord function should look using the ledPinArray variable?  Thanks!

author
milica.tamburic made it!(author)2015-04-24

Actually i have the same problem now, because I am using also the LilyPad USB for my bachelor thesis. Did you solve the problem till now? Thanks in advance :)

author
milica.tamburic made it!(author)2015-04-23

Can I use diffrent colours of LEDs? Or have all the 8 LEDs to be in one colour?

author
monopoly_on_37212 made it!(author)2010-08-10

I can't get any of my leds to flash. Everything else turns on except the leds. did I do something wrong?

author
quasiben made it!(author)2010-08-10

Did you remember to set the last pin as LOW? Do the LEDs turn on at all?

author
csolson made it!(author)2015-03-03

This is after it has been plugged into the computer, correct?

author
monopoly_on_37212 made it!(author)2010-10-11

yes, so sorry, I was able to figure it out. Thanks so much! this is a great instructable.

author
csolson made it!(author)2015-03-03

I can't get my LEDs to light up. The battery red LED comes on, the green light on the lilypad flashes but the white LED's will not turn on. What should I look at?

author
quasiben made it!(author)2014-12-18

Wow -- not very elegant. This is a macro which produces the length of an array. It's being used to return the number of values (elements) in the array "lilypad". sizeof(x) returns the total number of bytes in the array and sizeof(*(x)) returns the number of bytes in a single element. So we have total bytes/(byte/element)= total number of elements. perhaps if would be more clear if we wrote: (sizeof(x)/sizeof(x[0]))

author
brent.evjen.7 made it!(author)2014-12-18

Thanks! I deleted my post after I figured it out. Thanks for the response!

I've modified your code to make it work with my 10 LED POV wand. It is much better than the crappy code I wrote before. I'm not very good at arrays! The way you did it made sense to me though!

Thanks again!

author
ugly made it!(author)2011-01-18

I know this is an old post but can I substitute a 3v button cell for the power supply?

author
quasiben made it!(author)2011-01-21

Yes. I hooked up a multimeter and measured a 3mA draw for a button cell (3V CR2032) a LilyPad LED and around a 3mA draw to power a LilyPad. As a large estimate: 8*3mA=24mA+3mA=27mA. The coin cell battery has between 200and 250mAh. So you should be able to power you POV wristband between 7 and 9 hrs continuously.

This is a pretty rough estimate. The current draw will actually change over time and you can't extract all the juice in a coin cell battery. For a great discussion check out: http://www.evilmadscientist.com/article.php/throw/

author
nedim155 made it!(author)2010-10-11

please could u test this for me


B8(00100000),
B8(00111111),
B8(00000000),
B8(00111111),
B8(00100101),
B8(00100101),
B8(00000000),
B8(00111111),
B8(00100101),
B8(00011110),
B8(00000001),
B8(00000001),
B8(00111111),
B8(00000001),
B8(00000001),
B8(00000000),
B8(00000000),
B8(00000000),
B8(00000000),
B8(00000000)

author
Nolava made it!(author)2010-04-14

 Could this be modified to make "Pixel Poi"? www.feedingthefish.com/index.htm


author
Alerick made it!(author)2010-03-24

Where did you buy your LEDs?

author
quasiben made it!(author)2010-03-24

The leds are from sparkfun (www.sparkfun.com/commerce/product_info.php).

author
SirMask made it!(author)2010-03-23

Great tutorial.  I'm teaching my kids (homeschoolers) electronics, robotics, etc.  Lots of it is new to me, although I did teach MS office, Internet, etc at one point in a traditional school (duh K-12 jail lol).  Anyway, loving this site and your posts.   

author
bryanbrews made it!(author)2010-03-18

extremely cool!  I like building circuits, but this might be over my head.

author
Kryptonite made it!(author)2010-03-10

This is a very cool little project, awesome piece! 5/5.

author
Ward_Nox made it!(author)2010-03-10

seems like a geeky and clever way to get a girls attention at a bar

author
DemonDomen made it!(author)2010-03-10

It can't be seen with the naked eye, right? You would only see the flashing lights.

author
quasiben made it!(author)2010-03-10

Actually, you can see this with the naked eye; you just have to move fairly fast.  It does get a bit more difficult the longer the word/image is.  For example, here are some 3D globes www.youtube.com/watch that are spinning really really fast!  And for a great electronics POV kit visit adafruit.com or www.ladyada.net/make/minipov3/

author
nevsmom made it!(author)2010-03-10

Where was this when I was a teenager?! Very cool.

author
the_gella made it!(author)2010-03-10

 I saw this on flickr the other day, so glad you made a tutorial. Great little project!

author
sweetsabin81 made it!(author)2010-03-10

very cool

author
Bongmaster made it!(author)2010-03-10

sweet :3

About This Instructable

72,726views

242favorites

License:

More by quasiben:EL Driver BoardImage Capturing Bird FeederProximity-Sensing Pocket Squares
Add instructable to: