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 :

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


Arduino Mega

AD Keypad

WS2812 144px/m

SD Reader

LCD 16x2

Momentary Push Button

Switch On/Off

1m Alloy Channel With Diffuser

Du Pont Wires

12v-5v converter

Project Box

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


Heat shrink Tube

Nuts & Bolts

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

1 12v battery


Soldering Iron





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


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 :


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 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.


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

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.

3 People Made This Project!


  • Optics Contest

    Optics Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • Plastics Contest

    Plastics Contest

33 Discussions


Question 3 months ago


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

And will this make a difference?


Question 4 months ago on Step 8

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


Question 4 months ago on Step 8


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


Question 9 months ago on Step 8

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?

1 more answer

Answer 7 months 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.


Tip 7 months 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.


7 months 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


11 months 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?


1 year 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

2 replies
Spicy Turtlescoelho69

Reply 1 year ago

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

coelho69Spicy Turtles

Reply 1 year 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


1 year 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.

1 reply

Reply 1 year ago

could you send me a copy of the changed code


happy new year


1 year 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!


2 years ago

Nice work! I'm looking into building a Pixelstick-clone myself and stumbled upon your instructable while doing some research. Is there a reason your gamma table only goes up to 127? As far as I know the WS2812 LEDs use 8 bits per color channel.

1 reply
Spicy Turtlesthomerow

Reply 2 years ago

Hi thomerow I can really answer that it was coded by Michael Ross and Iso-mick did the gamma table from memory feel free to play with it would be interested if you get any imteresting changes.


2 years ago

Can you transform the arduino code to raspberry pi code? I recently purchased a raspberry pi and the LED strip, I was interested in making a homemade pixelstick, but I don't want to have to buy an arduino to make it. Please help!

Savvas Panayiotou

2 years ago

Why did you use an arduino instead of a rasberry pi?


3 years ago


Just tried the code on a mega 2560, but keep getting error messages.

sketch_oct16a:76: error: 'Adafruit_NeoPixel' does not name a type

sketch_oct16a.ino: In function 'void setupLEDs()':

sketch_oct16a:390: error: 'strip' was not declared in this scope

sketch_oct16a.ino: In function 'void latchanddelay(int)':

sketch_oct16a:569: error: 'strip' was not declared in this scope

sketch_oct16a.ino: In function 'void ClearStrip(int)':

sketch_oct16a:578: error: 'strip' was not declared in this scope

sketch_oct16a:580: error: 'strip' was not declared in this scope

sketch_oct16a.ino: In function 'void ReadTheFile()':

sketch_oct16a:725: error: 'strip' was not declared in this scope

Po TingC

3 years ago on Step 8

nice, my try my own soon,
BTW, a small trick i've found

the ws2812 strip cound use a 3.7V lithion battery as external
a single 18650 could supply stable current up to 3A or more

but the voltage will drop during usage
not sure at what voltage level drop will the strip fail

you don't even need to connect the gnds(with arduino's)
and still works most of the time
some kinda socery