Arduino Pixel Stick WS2812

37,419

209

39

Introduction: Arduino Pixel Stick WS2812

This is my first instructable I got asked to put one togther for a friend but only after I had assembled it all so some pics i wasnt able to get Im sure there will be bits I have missed out I'm no code genius so I will do my best to answer any questions you have in this build there was a bit of guess work but that is the fun of it.

I will update this as much as I can if anyone spots anything missing please let me know :)

This is my variation on NeoPixel WS2812 DLW by Michael Ross Credit to Him and IS0-Mick for the code and others who contributed to code along the way.

Link to : http://mrossphoto.com/wordpress32/neopixel-ws2812-...

https://www.facebook.com/spicyturtlesphotography

Test run of completed strip :

I have some early videos of it in the concept stage here:

Another one of testing :

Step 1: Step 1 : Parts Tools

I got most of my parts from Aliexpress and Ebay to keep costs down

Parts:

Arduino Mega

AD Keypad http://bit.ly/1L4eGWH

WS2812 144px/m http://bit.ly/1CutXyK

SD Reader http://bit.ly/1Gd4d4A

LCD 16x2 http://bit.ly/1LX1N1j

Momentary Push Button http://bit.ly/1Mlo86U

Switch On/Off

1m Alloy Channel With Diffuser http://www.ecolocityled.com/product/black-thin-fro...

Du Pont Wires http://bit.ly/1NZW36e

12v-5v converter http://bit.ly/1HTQntx

Project Box http://bit.ly/1M0K7D9

Double Sided tape

1m piece of wood as wide as alloy channel for mounting

9v battery connector with DC jack end

Wire - Try to keep size same

Handle http://bit.ly/1NZWSMb

Heat shrink Tube

Nuts & Bolts

Resistors ( a good Selection for contrasting LCD and one 470 for LED data line )

1 12v battery

Tools:

Soldering Iron

Tweezers

Screwdrivers

Dremmel

File

Step 2: LCD and SD Card Hook Up

I breadboard everything before starting you can skip this step if your confident with lcd hook up etc

LCD:

Pin Guide

1 - GroundPin

2 - +5VPin

3 - Contrast AdjustmentPin

4 - H/L Register SelectPin

5 - H/L Read/WritePin

6 - H/L EnablePin

11 - DB4Pin

12 - DB5Pin

13 - DB6Pin

14 - DB7

15 - Backlight Control +

16 - Backlight Control GND

LCD Connection

Pin 1 to GND Pin

2 to 5VPin

3 to Resistor ( bit of trial and error to find right one )

4 to Arduino pin 12

Pin 5 to GND Pin

6 to Arduino pin 11

Pin 11 to Arduino pin 5

Pin 12 to pin 4

Pin 13 to pin 3

Pin 14 to pin 2

Pin 15 to Arduino Pin 10 ( This is for backlight control )

Pin 16 to Arduino GND

I ended up joining the 3 GND's into one pin solder them togther and heathrink tube over top

SD Card :

GND to GND

5v to 5v

CS to Arduino pin 53

MOSI to Arduino pin 51

SCK to Arduino pin 52

MISO to Arduino pin 50

Momentary Push button :

GND - Pin 44

Positive - Pin 45

LED:

LED Strip Data in needs a 470 resistor inline this is talked about in step 5

LED Data In - Arduino Pin 31

Step 3: AD Keypad

Wiring :

5v to Arduino pin 5v

GND to Arduino pin GND

Signal to Arduino pin A0

I ran the Resistor Button Sketch to get the button press values

1. Sketch load

2. Open Serial Monitor

3. Press each button to get the value write these down for later to add into the code.

Video Of it in action

Step 4: Boxing Time

1. Mount the the AD keypad in the middle of the top of the project box I held it down with nuts and bolts and adjusted them so the buttons just sit under flush, cut slot for the sd card ( this doesnt have to be here) . See Pic 1 & 2

2. Cut hole for LCD using a dremmel or sharp knife drill holes for nut and bolt to secure it. See Pic 3

3. Drill hole for momentary push button ( doesnt have to be on the box wherever is good for yourself ) Attach wires before mounting add another hole for the On off Switch and 1 more on the bottom for the DC panel mount jack . See Pic 4

4. Mount : SD Card, Arduino Mega, 12v to 5v converter I used double sided tape and mounted the Mega on the side of the box next to the SD card. See Pic 4

5. Wire everything up I ran the DC jack Positive to the switch then to the converter and the Ground strait to the Ground on the converter the arduino gets its power from the 12v input.

Notes:

I used a 9v battery lead with DC connector for Arduino just chopped of the battery terminal

You can use a buck converter but the led strip can draw a lot of amp when under full load

Step 5: Putting It All Togther

I started by drilling holes in the project box to attach to the wood using short grabber screws 2 should be fine

I then drilled a bigger hole in the box for the wires for the LED to come through ( See Pic 1 )

I channled out the wood enough so the hole in the project box matched the channel for the wires to sit in ( see Pic 2 I dont have a pic of the actual channel )

I drilled 3 holes to mount the channel to the wood I countersunk them so the led strip will sit level ( no pics sorry)

at one end of the channel i drilled out a big hole were the wire feeds into the channel in the wood to go to the box ( see pic 3 ) you will have to solder some more wire to make it long enough this is a good time to solder in a 470 resistor on the data line the green wire from the strip.

The Green Data line from the strip will go to pin 31 ( You can Change this in the code )

Attach your LED power wires to the 5v output of the converte

Note : I had to shorten the led strip by 2 pixels to fit in the channel

Step 6: Code

The code is included here in the Light wand.ino

You will need to edit line 84 int adc_key_val[5] ={ 30, 170, 390, 600, }; these are the numbers from the resistor sketch you will need to put them in to replace the ones in bold above. but there is a trick to this the buttons dont seem to read in order so I had to swap them round this is the combination that worked for me ( 142, 329, 0, 506, ) I only use 4 of the 5 buttons as the Momentary pushbutton works as the 5th button.

You will need to change this line as well: #73 LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

to this: LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Upload the sketch and see if everything is all go

If not check you wiring make sure all plugs are in the right socket

Note: make sure you have the AD keypad plugged in or you menu will go on a loop through

Step 7: Misc Photos and Acknowledgments

Once again a big thank you to Michael Ross for his guide on this and the code he did all the hard work

http://mrossphoto.com/wordpress32/neopixel-ws2812-...

Thanks to Joinerman James for the help figuring it all out

And to My Wonderful Girlfriend for putting up with the late nites and swearing

Step 8: Notes : Just a Couple of Notes

1. On LED strip I had to cut 2 pixels off the strip to fit in the alloy channel so make sure in the code you change the number of pixels to suit.

2. Setting up the pictures you can use photo shop or if you want to batch convert there is also irfanview. You will need to set the longest edge to 142 pixel ( Or how many LEDS you have ) and rotate the image I have included a couple of samples above.

3. I plan on doing a 2m one down the track this project can be used for 2m but the power draw will get up there so maybe look at a higher amp converter and adjust the strip- length in the code.

Photography Tips and Tricks Contest

Participated in the
Photography Tips and Tricks Contest

7 People Made This Project!

Recommendations

  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

39 Discussions

0
KDLaun
KDLaun

1 year ago

I recently doubled the length of my display stick to 288 pixels. I did get twice the resolution, but I have found, like moggymad1, that the playback is EXTREMELY slow, even with the frame delay set at zero. (the flag takes about 35 seconds to play through) As a result, you have to move VERY slowly, and it's hard to hold the stick steady while doing it.

I'm seeing a lot of vertical lines in the photos where I didn't with the 144 pixel version. The speed issue may be a limitation of the Mega. I was excited to add more pixels, but right now, I'm inclined to return to my smaller display. Maybe someone can come up with a modernized version with a bit more punch. :-)

IMG_6563 (2).jpgIMG_6531 (2).jpg
0
Jean-BaptisteC4
Jean-BaptisteC4

Reply 11 months ago

I think my project can do it : https://github.com/jbreizh/ImagePainting
it use an esp8266 to drive the led and a smartphone to configure every thing (from webpage but the android app is more practical). The hardware is very simple and cheap (except the led). I don't know about 288 led (it s a lot of led) but for 120 APA102c it take 1ms per line so it should be good... it also use littlefs (3MB max) to store bitmaps, i made a quick test with 288x1000 it's a 900kb bitmap, so 3 max, but you can delete and upload from the app.

Edit : i have done some speed test with my project for 288 pixels. So max out (160MHz, 0ms of delay, FS set to 3MB) for a 288x1151 bitmap it take :
* 2472ms with APA102 at 10Mhz
* 1930ms with APA102 at 20Mhz
* 10881ms with WS2812b at 800Kbps
Clear win for the APA102.

DSCN1141.JPG
0
moggymad1
moggymad1

1 year ago

Great project!, Thanks. I made one and it works nice but I have a question. How can I increase the speed that it displays the frames? With the frame delay set to zero I have to move the wand very slowly to get an image to look right. But apart from the speed issue I am loving what I can do with it.

20863605_725428364313599_1971920746309090515_o.jpg
0
Sylvain2
Sylvain2

Question 2 years ago on Step 8

Hello,


i try to upload in arduino but this message appear, :

Arduino : 1.8.5 (Windows 8.1), Carte : "Arduino/Genuino Uno"

FPVJP4KIBW26AZI:760: error: 'prog_uchar' does not name a type

PROGMEM prog_uchar gammaTable[] = {

^

In file included from D:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

from sketch\FPVJP4KIBW26AZI.ino.cpp:1:

C:\Users\sylvain\AppData\Local\Temp\FPVJP4KIBW26AZI\FPVJP4KIBW26AZI.ino: In function 'byte gamma(byte)':

FPVJP4KIBW26AZI:781: error: 'gammaTable' was not declared in this scope

return pgm_read_byte(&gammaTable[x]);

^

exit status 1
'prog_uchar' does not name a type

can you help me, thank you

0
KDLaun
KDLaun

Answer 1 year ago

I did a little digging, and apparently there's been some changes in the way the compiler handles variable names since the original code was produced. I changed the offending line and it compiled correctly using IDE 1.8.8. Hope that's helpful.

const PROGMEM unsigned char gammaTable[] = {

0
DARKHOURS
DARKHOURS

Answer 1 year ago

I found i had to use Arduino:1.0.5 R2 to upload had the same errors with Arduino : 1.8.5

0
SamerS27
SamerS27

1 year ago

really thanks i try to make it but have erorr with code i wish u can help me

Capture.JPG
0
CrazeUK
CrazeUK

Question 2 years ago

Hey.

Why did you choose the arduino mega instead of the Arduino Uno or Arduino Nano?

And will this make a difference?

0
slyac3
slyac3

Question 2 years ago on Step 8

Do you think this would work with teensy3.6 and apa102c

0
mdeore
mdeore

Question 2 years ago on Step 8

Hello!
I am facing a problem in probably the last step of this instructable! I built the wand succesfully but I am not able to light up the strip due to some reason! I am pretty sure the connections are alright since I was able to run the example code for the WS2812 strip and the strip works just fine with this setup but loading the images it simply doesn't work.

I am using a 32gb memory card along with MS Paint to convert it to Bitmaps of width 144 pixels and the files are displayed on the screen but the led strip simply won't turn on! I also tried using the images in this instructables after converting them to Bitmap ofc but still no luck!

Can you probably mail me a sample file so I know that maybe I am making a wrong file?

0
indrajitbhat
indrajitbhat

Answer 2 years ago

I was facing similar issue and spent couple of hours troubleshooting. Problem was with GND. We need to connect LED strip GND to Arduino GND. I connected both GND common and everything stared working... may be this is one of the reason in your case.

0
indrajitbhat
indrajitbhat

Tip 2 years ago

As a power source for this project mobile power bank can be used. It gives 5V output.. hence perfect to power Arduino board as well as LED strip. (Use power bank with 2 USB outputs) - I used 20000 mAh power bank and it worked perfectly.

1
indrajitbhat
indrajitbhat

2 years ago

Thank you so much. I was able to build this PixelStick by following this tutorial.

I used 1 meter 144 LED ws2813 LED strip and 2813 worked just fine without any code change. As a power source I used mobile power bank of 20000 mAh capacity - which has 2 USB outputs; 1 used to power Arduino mega board and 2nd used to power the LED strip.

Attached is the first test shot.... tried to light paint Monalisa

mona1.jpg
0
243514225
243514225

3 years ago

I have tried this method, but there is a problem for interrupting me ,the sd card can not recognized the bmp files, and the LCD print that " not a bitmap", i do not know why,who can tell me?

0
coelho69
coelho69

3 years ago

Good Morning

Great project, many congratulations.

How does the movement?

Is it circular or horizontal?

Manual or with the aid of some mechanical "Motor" system?

thank you

0
Spicy Turtles
Spicy Turtles

Reply 3 years ago

Its all manual hold it vertical and walk it can take awhile to get the right speed

0
coelho69
coelho69

Reply 3 years ago

OK, it's a very interesting project, I walk with the idea of building a panel but this one will take many LED's and this is a better solution.

I'll start by creating something smaller, rotating or somehow attempting horizontal but mechanical movement.

Good work.

Thank you

0
MarcelloB
MarcelloB

3 years ago

Hello where can I submit source code? I have added some features to the firmware that I would like to share. I have added in a way for settings to be saved and recalled using the EEPROM. I have also made some changes to the analog button reading code that helps deal with anomalies where a buttons value floats slightly.

0
andreasP47
andreasP47

Reply 3 years ago

could you send me a copy of the changed code

please.

happy new year

0
TonyM56
TonyM56

3 years ago

Amazing! I'm thinking for building one myself! So what power consumption do you get from the led strip and the whole system? Thank you for the instructable!