Introduction: Color Changing Box Shelves With LED-strips and Arduino

This started as I needed an extra storage next and above a desk, but I wanted to give it some special design. Why not use those amazing LED strips that can be individually addressed and take any color?

I give a few notes about the shelf itself in the next step, but here is what you need to decorate your shelf:

- a few meters of LED strips backed with adhesive, ~$40
- an arduino nano, ~$10 (any arduino actually)
- some hook up wires, white, or whatever color your shelf actually is
- a few connecting wires (optional)
- a spare smartphone charger (to power the arduino usb plug)
- some solder and a soldering iron. Start here if you don't know how to solder yet.
- a wire stripper

Step 1: A Quick Note About the Shelf

Just for information, here is what I used in order to build the shelf bought on amazon or home depot:

- a book shelf, $50
- a 4x2 cube shelf, $70
- another 3x2 cube shelf, $57 in order to reach the wall that the desk faces

I am not giving much details about the assembly, but it involves fixing the upper cubes together and to the wall with heavy duty brackets. Do it with someone's help and use your common sense,... or hers.

It might be a good idea however to place the brackets in the corner of the cubes that you don't see from the most natural place in the room.

Step 2: Stick the LED Strips

With a pair of scissors, cut the LED strip in as many pieces you will need. In my case, it was 14 trips of 8 LEDs (=8").

Then stick them in your shlef boxes, BUT, keep in mind:

- those LEDs can get very bright and you don't want to have them in direct sight. As my shelves are entirely above eye level, I placed the strip on the bottom part of the cubes. If yours is on the floor, you must place it on the upper part so that you don't see them when standing next to it.
- You might want to stick the strip close to the edge of the shelf, because things might end up filling the boxes and you don't want them to block the light from the LEDs.
- respect ("R-E-S-P-E-C-T...!!") the direction indicated on the strip. The arrow shows in which direction the information is flowing, from the arduino, to the end of the strip. A note about how those work: each of the WS2812 LED contain a microchip that receives logical 0s and 1s at a rate of 800kHz. After powering-on, the first LED listens to this signal and removes the first 3 bytes (24bits) from the flow of bits. It uses this information to set its color and transmits the rest of the signal to the next LED, which is going to perform the same task. Each LED has an input and an output, therefore, direction matters.
- the previous point implies that you have to think, beforehand, where the arduino is going to feed the strip, and what trajectory the strip is going to take. In my case, it was pretty simple, hiding the arduino in the farthest cube, where I can get easy access to a dissimulated power cord running in the corner of the room. The strips go through all the cubes on that level, then up, and through all the cubes of the other level.

Step 3: Pre-tin the Strip Connections

This means that you put a drop of solder on each connecting end of your LED strips.

With my 14 pieces to connect together, and 3 connections at each end (ground, 5V, signal), that makes 84 drops of solder. But it is going to make your life approximately 84 times easier in the next step !!!

Step 4: Hookup the Strips

- With the wire stripper, remove just 2mm of insulation from your wire. Pre-tin the wire (by heating it with the soldering iron until it absorbs a bit of solder).
- Solder it right on the Ground connection of one of the strips to connect. Since you pre-tined it it is just a matter of pressing the soldering iron on your wire placed on the connection.
- Then pull your wire tight to the corresponding connection of the other strip piece (Ground) and cut the wire precisely at the level of the connection.
- Remove 2mm of insulation, pre-tin, and solder it to the connector.
- At that point, you should have a cable connecting your strips and it should not look loose.

Perform this again for the SIGNAL connectors, and for the 5V connectors.

Step 5: Connect the Arduino and Code

Adafruit's great website has some very useful best practice regarding the connection of an Arduino to a LED strip (the one branded "Neo-Pixel").

It is very clear and you should read it:

https://learn.adafruit.com/adafruit-neopixel-uberguide/overview

https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices

https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library

- connect the PIN6 (in the code example bellow, we use pin 6) to the first LED's SIGNAL,
- connect the Arduino Ground to the first LED GND
- Power your LED strip with a 5V power supply and plug your arduino to the usb charger.
- WARNING: If you power the strip through the Arduino, do not use the pin "+5V" from the arduino. This pin involve some sensitive circuitry on the Arduino and may burn due to the current drawn by the LED strip. Instead, you may try to use the "Vin" pin. If you plan on drawing more that 1A of current (~20 to 50 mA per LED), connect a 5v power supply directly to the LED strip (and the ground must be shared with the Arduino's).

Here is the code I used for a slow motion of colors through the cubes. It is directly taken and adapted from the Neo_Pixel library examples:


#include "Adafruit_NeoPixel.h"

#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8*14, PIN, NEO_GRB + NEO_KHZ800);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
rainbowCycle(20);
}

void rainbowCycle(uint8_t wait) {

uint16_t i, j;

for(j=0; j<256; j++) {
for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((((i) * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}

Featured Author Contest: Tarun Upadhyaya

Third Prize in the
Featured Author Contest: Tarun Upadhyaya