Adafruit /Sparkfun Waterproof RGB LED Strip (60/m)

This this is beyond amazing. Only in real life can you appreciate it’s vibrancy and power to invoke emotion. It shall fulfill you. That money spent on electronics, that time burned grepping Ohm’s and Kirchoff’s laws; time well spent. Once you gaze upon the 16.7 MILLION colors available, as this relic leisurely strolls through them at whatever speed your Arduino/various MCU desires.

View at Sparkfun
View at Adafruit

Color Gallery and ‘How to set it up’ section after…


Alright, time to wire this bad boy up. Three MOSFETs, Three megaohm range resistors, and a 12v supply. I got an adapter from the thrift store, and cut off the end. The maximum current draw is 60 LEDs * 20mA/LED * three LED/s per LED (confusing, but RGB leds are actually 3 LEDs in a single package, hence the overwhelming brilliant beauty). This works out to about 5.4A.

That’s a shit ton. Hence, the pile of NPN transistor shrapnel lying around my house. You need MOSFETS

Check your pinouts, they often differ from transistors. My Radio Shack bought IRF510s (N channel) have the Gate far left. Wire each gate up to a PWM pin on your Arduino, each source to 12V power supply GND, and one drain to the red, blue, and green lines each. The RGB strip has resistors built in, but I put 68 Ohm resistors between the Source and GND just to be extra safe ($25 is a lot of money to me.)

Now, the Arduino. CONNECT the grounds between the 12V power supply and the Arduino/USB power supply. Your MOSFET will not switch properly if you fail this step. My (found, written by Matthew L Beckler; mbeckler.org) code is here.

// RGB LED - Automatic Color Cycling
//
// Matthew L Beckler
// matthew at mbeckler dot org

int redPin = 11;
int bluePin = 10;
int greenPin = 9;

int redIn = 0;
int greenIn = 1;
int blueIn = 2;

int redVal;
int greenVal;
int blueVal;

void setup()
{
redVal = 255;
greenVal = 255;
blueVal = 255;
update();
}

// This function updates the LED outputs.
void update()
{
analogWrite(redPin, redVal);
analogWrite(greenPin, greenVal);
analogWrite(bluePin, blueVal);
}

// This function updates one of the color variables
// either getting brighter or getting dimmer.
// It also updates the outputs and delays for 10 milliseconds.
void color_morph(int* value, int get_brighter)
{
for (int i = 0; i < 255; i++)
{
if (get_brighter)
(*value)--;
else
(*value)++;

update();
delay(10);
}
}

void loop()
{
// start out at black (all off)
color_morph(&redVal, 1); // transition to red
color_morph(&greenVal, 1); // transition to yellow
color_morph(&redVal, 0); // transition to green
color_morph(&blueVal, 1); // transition to aqua
color_morph(&redVal, 1); // transition to white
color_morph(&greenVal, 0); // transition to violet
color_morph(&redVal, 0); // transition to blue
color_morph(&blueVal, 0); // transition to black (all off)
}

I’ll leave it to you to wire it up and fire it up. It sure is a sight worth seeing, and well worth the money!

-Guardian of Light

Advertisements

What's The Word?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: