In building this project I followed the very comprehensive guide from Adafruit on working with RGB neopixels. The guide is very detailed and includes all you need to get started with lengths of spare RGB neopixel strips. Read it here.

I have included the schematic from Adafruit below. I am powering the Arduino (Orangepip Kona328) from a 12V power supply and using the Vin pin on the board for the 12V power supply for the LED strips. Due to the larger currents needed to drive the LEDs I followed the recommendations of using a power NPN transistor with each colour channel. I bought a handful of TIP120 Power Darlington Transistors for less than a £1 each.

I built the circuit as shown below (Attribution-ShareAlike Creative Commons – learn.adafruit.com, owner Tyler Cooper) and used their sample code below.

led_strips_ledstripfet

I made a simple little case to hide the Kona328 and the transistors. There is very little heat produced by either the board or the transistors and I have left the snowman running all day. With any home made project I won’t be leaving it switched on over night.

IMG_4380
IMG_4381
// in the #defines
// public domain, enjoy!
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
#define FADESPEED 5 // make this higher to slow down
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
void loop() {
int r, g, b;
// fade from blue to violet
for (r = 0; r < 256; r++) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from violet to red
for (b = 255; b > 0; b--) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from red to yellow
for (g = 0; g < 256; g++) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
// fade from yellow to green
for (r = 255; r > 0; r--) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from green to teal
for (b = 0; b < 256; b++) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from teal to blue
for (g = 255; g > 0; g--) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *