Multicolor undercabinet lighting with Neopixels

Project

There’s been a lot of interest in under cabinet lighting recently, being that it’s a relatively inexpensive way to make a dramatic change to the look of a room. The standard cool or warm white is fine for some, but what if you want to do something a bit different? Try Neopixels! While a bit more complicated to set up than standard single-color lighting, the ability to change the color of a room to suit your mood might make the extra work worth it.

All that’s necessary to get going is a Neopixel strip long enough to span the area you want to light up (they are cuttable and chainable, just make sure you get enough total length), a controller board (arduino Uno is the easiest), a 5VDC power supply with enough current capacity to power your Neopixels (60mA per LED to be safe), and some light electronic assembly skills.

Neopixel strips have three lines that need to be connected - 5VDC, ground, and data. Adafruit has an excellent document describing how to wire a neopixel with your microcontroller - click here to read it - so I won’t rehash that info here. For my purposes, I added 4 potentiometers to control the amount of red, green, and blue, as well as the overall brightness of the lights. The potentiometers are simple enough to connect, one pin to 5VDC, one to ground, and the middle pin to an analog pin on the arduino (A0-A5). The above mentioned guide will help you with the power supply wiring, but the important takeaway is that the arduino and led strip need to be powered seperately but must still share a common ground. You can use one power supply for both, just make sure that both the arduino and the strip have their own dedicated 5VDC lines coming from the supply, but connect the grounds together.

Code

The code to make everything work is pretty basic. You can upload this simple sketch to get started:
/Much thanks to Adafruit (www.adafruit.com) for the excellent Neopixel library I’m using!/

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN            6    //what pin is your strip connected to?
#define NUMPIXELS      30   //how many pixels in your strip
int delayTime = 5; // delay for 5 milliseconds

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);


void setup() 
{
  pixels.begin();   //initialize neopixel library
}

void loop() 
  {
   int bright = map(analogRead(A5),0,1024,0,255);  //value for brightness
   int red = map(analogRead(A2),0,1024,0,255);     //value for red 
   int green = map(analogRead(A3),0,1024,0,255);   //value for green
   int blue = map(analogRead(A4),0,1024,0,255);    //value for blue
   pixels.setBrightness(bright);                   //apply the brightness value to the led strip

// The following "for" loop sets the colors to each led, then turns them on.
  for(int i=0;i<NUMPIXELS;i++){

    pixels.setPixelColor(i, pixels.Color(red,green,blue)); 
    pixels.show();
    delay(delayTime);
  }
}

Expansion

This can be expanded on depending on your experience and what you want to do. Want the lights to pulse to music? Add a microphone. How about changing depending on time of day? Throw an rtc on there and wake up to a colorful sunrise! Maybe create a sparking, fire effect and pretend you’re camping! It’s up to you. With this basic hardware and some time to write code, you can really spice up a kitchen, bedroom, or living room.

Neopixel strings:

imageimageimage

Possible power supplies:

imageimageimage

Arduino Uno P/N: A000066 Digi-Key P/N: 1050-1024-ND

image