Pimp Up Your Bedroom — Arduino RGB strips that beat to music, for absolute newbs. And Indians.

The most significant thing about this tutorial is that it’s written by someone who has no right to write one. I am just a beginner as you are (if you are indeed a complete newbie, which is the target audience), but somehow I managed to stumble my way into making something marvellous (if I may say so myself). While doing so however, I found that almost all tutorials on the internet had a problem — they weren’t that simple as I’d have liked them to be, and furthermore, being a beginner living in India, the links to products from the tutorials were to sites that obviously did not deliver here.

So here it is, the most perfect guide on the Internet. (please notice sarcasm)

The whole point of this lesson is simple. It does three things.

  • It helps you turn your ordinary boring bedroom into an awesome little disco, using RGB LED strips that change colour and/or blink according to the beats of a song or whatever sound is being given to the sound sensor.
  • It gives you an introduction to RGB LED strips, some of the sexiest things in electronics.
  • It provides links to online stores in India so its easier to buy components.

Things you require:

  1. An Arduino. Any model is fine, but I use the UNO. You can get it from here: Arduino Uno R3 (Amazon)
  2. A Sound Sensor. Get it from Amazon too.
  3. An RGB LED strip. It’s up to you whether you want to use a 1-metre long LED strip or a 5-metre one. A 5-metre one is obviously longer, and that is important because we’re using it to light up an entire room. However a 1-metre strip works well too. It depends on how much you’re willing to spend. Get the 1-metre one here and 5-metre one here.

And now for some things most people would already have. But if you don’t, its essential to get them.

4. A Breadboard. It is absolutely important as without it you cannot make a circut to run the LED strips. Get one here.

5. Jumper Wires. Highly essential, to be used in the breadboard. Get them from here.

6. Good songs with crazy beats. Get a good one here.

7. The Arduino IDE (Software). Get the ERW version here. Then follow the instructions from here.

8. You’ll also require a 12V power supply cable like this one. You may most probably have one already in your house. Remember it needs the connecting edge like this. Without this your LED strips won’t work.

Don’t be worried about having to spend a lot of money as most of these parts are re-usable and required in almost all Arduino projects you may undertake in the future.

I am not paid by any of these sellers to endorse their products. I am simply giving links to the products I bought. I apologize if cheaper versions are available, in which case let us know in the comments, thanks.

Remember to BOOKMARK this page, so that when your parts arrive (finally!) you will remember this page.

Connecting everything together

I made a Fritzing diagram, and I really hope you can follow it. If not, let me know at zombiesarcasm@gmail.com

Right-click on image and choose ‘Open image in new tab’ for bigger picture

Connecting your Arduino to the Computer

The Code

Once you’ve got the Arduino software up and running, copy-paste the following code into it.

First Code


This code is just to test if all the lights in your strip are working properly. I got it from here. In the code there is something called FADESPEED along with a number at the very top. Try changing the number (greater and lesser than 5 which is given in the code). Remember to press Ctrl+U everytime you make a change in the code to upload it to the Arduino.

// color swirl! connect an RGB LED to the PWM pins as indicated
// 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);
}
}

If nothing is happening, make sure that your Arduino is plugged into a wall socket thorugh the 12V power supply cable and that all the connections are correct.

Real Code

This is the code for the RGB LED strip reacting to sound. Notice that only two colors are used.


//hyperhitesh.hol.es
#define LEDstrip 6
#define LED2 5
void setup()
{
pinMode(1,INPUT);
pinMode(LEDstrip, OUTPUT);
pinMode(LED2, OUTPUT);
}
//this function will make the LED dim once the Parallax Sound Impact Sensor sends a 1 signal, and then return to it’s original brightness.
void loop()
{
boolean soundstate = digitalRead(1);
if (soundstate == 1) {
digitalWrite(LEDstrip, HIGH);
digitalWrite(LED2, LOW);
delay(10);

}
else{
digitalWrite(LEDstrip, LOW);
digitalWrite(LED2, HIGH);
delay(150);

}
}

A Video I Took

If you have any doubts or if you made it and loved it, let me know at zombiesarcasm@gmail.com or below in the comments.

Check out my website — hyperhitesh.hol.es as well as a beta version hyperhitesh.hol.es/fun

Love,

Hitesh.