DEV Community

Akash Govind
Akash Govind

Posted on

Turn up your house party!

“Crowd with raised arms in a colorful club in silhouette” by Matty Adame on Unsplash

Are you a nerd who likes to party?

Well, it’s high time you put your skills to some work.
Turn up your house party with Bass reactive led strip lights. To get you a little excited, here is a demo..

The procedure to get this done is easy and cheap, so, here we go.

What you need?

  1. Arduino Uno R3: Buy here
  2. Sound Sensor: Buy here
  3. Led Strip lights 12V (AC power adapter included): Buy here
  4. Jumper Cables: Buy here
  5. IRF540 N-Channel Power MOSFET: Buy here You can buy other mosfets aswell but go for the bulky ones (TO-220).
  6. Breadboard: Buy here
  7. Speakers with sub-woofer: Buy here

There is no need to stick to the links that I have mentioned, do what your pocket allows.

NOTE: The sound sensor picks up the bass and therefore has to be kept close to sub-woofer. As close as possible.

Circuit

“Crowd with raised arms in a colorful club in silhouette” by Matty Adame on Unsplash

Now it is time to wire your project up! The following diagram shows all of the connections. These are the direct connections for the sake of simplicity, the number of wires on your actual project may vary since you will be using a breadboard and literally connecting wire to wire.

Use your 9 V wall adapter (that you got with the LED strip) to power the Arduino (plug it into the black component on the lower left side of the Arduino)

Arduino Code

I am assuming that you know the basics of Arduino. Not a problem even if you don’t. You can refer the beginner’s guide here.

If you still struggle with Arduino, just connect the AO pin of the sound sensor to the Gate pin of the mosfet. If not, let’s talk code.


#include <SoftwareSerial.h>
#define SS_output 7
#define LEDstrip 3
#define LEDstrip1 5
#define LEDstrip2 6
void setup()
{
  pinMode(SS_output, INPUT); //AO of the Sound Sensor connected to Analog Pin 7
  pinMode(LEDstrip, OUTPUT);
  pinMode(LEDstrip1, OUTPUT);
  pinMode(LEDstrip2, OUTPUT);
}
//This loop gets the sound sensor readings and forwards them to thed LED strip
void loop()
{
  int soundstate = analogRead(SS_output);
    analogWrite(LEDstrip, soundstate);
    analogWrite(LEDstrip1, soundstate);
    analogWrite(LEDstrip2, soundstate);
}

Enter fullscreen mode Exit fullscreen mode

And that brings you to the end. Pick a song and chill.

If you like this, buy me a beer someday!

Top comments (0)