Introduction: SingAlong

SingAlong is a quick and easy way to enjoy music visually. It uses the Arduino shield found at https://breadware.com/store/ along with a few of the Breadware modules.

The Breadware shield is incredibly versatile and comes with a range of sensors. I recommend any DIY nut to play around with it. Many home projects can be created in a matter of minutes thanks to the diversity of sensors available (I.E. Temperature, Humidity, Acceleration and more).

Save 10% on a Breadware purchase by entering the code byars17 at checkout.

Press the button to activate or deactivate the code. Turn the knob to adjust the LED brightness.

Although I set the music to change the LEDs RGB values randomly, you might like to create ascending RGB values or some other pleasant pattern.

Step 1: Bill of Materials

Arduino Mega

Mega-B Bread™Board

Breadware Modules:

1 Button

3 RGB LEDs

1 Knob

1 Microphone

Step 2: Create the Project

Go to https://dev.breadware.com/login and login or create an account.

Once signed in, press New Project on the bar on the left side of the webpage. Select the Mega-B Board and Blank Template.

Step 3: Prepare the Board

When the project first opens, there will be an empty board on the screen with Breadware modules to the right. We will be setting the modules onto the board. You can drag them onto any of the available spots, but make sure the physical board mirrors the positions you use in the program. I positioned them as shown in the image.

As the components are placed on the board, you will be asked to name them. I used the default names given (led_0, led_1, led_2, button_0, microphone_0, and knob_0). Feel free to name them anything you like. You will have to replace the names in the code if you do choose unique names,though.

Step 4: Write the Firmware

Go to the Write Firmware tab, shown in the image. Copy the code below into the loop tab (remember to change the names in the code if you didn't use mine).

**Note** You might have to play around with the if statement values. The values represent decibels, so depending on how loud you have your speaker you may have to adjust the values. I used Serial.println to show the decibel values being read. You can adjust the if statement values by looking at the serial monitor and deciding what range of decibels will work well for your music.

Code (comments in bold):

while(!button_0.is_pressed()); //wait for button press
while(button_0.is_pressed()); //wait for button release

while(!button_0.is_pressed()){

//adjust brightness of LED's using the knob

int brightness=knob_0.read();

//knob values range from 0 to 100, but the LEDs are from 0 to 255

//the map function takes the knob value and proportionally gives it a new

//value between 0 and 255

brightness = map(brightness, 0, 100, 0, 255);

double level=microphone_0.read();

// set random RGB values (between 0 and brightness)

int k=random(0,brightness);

int j=random(0,brightness);

int i=random(0,brightness);

Serial.println(level);

//Change LEDs based on decibel values

if(level<70){

led_0.setRGB(i,j,k);

}

if(level>=70 || level<90){

led_1.setRGB(k,j,i);

}

if(level>=90){

led_2.setRGB(i,k,j);

}

delay(100); //delay so LEDs don't change too quickly

}

led_0.off();

led_1.off();

led_2.off();

while(button_0.is_pressed()); //when button is released, loop may restart

Step 5: Upload the Code

Press the save button (shown in first image) and then the download button (the blue button to its right).

Create a new folder anywhere you'd like and unzip the downloaded files into this new folder. The folder can be named anything you'd like, but you must change the .ino file among the unzipped files to match the folder's name. For instance, I named my folder SingAlong so I had to rename the .ino file to SingAlong.ino. Once this is done, open the .ino file.

**Note** You will need the Arduino IDE installed to do this. The download is located at https://www.arduino.cc/en/Main/Software

Connect the Arduino Mega to your computer and upload the code onto the board.

Step 6: Have Fun Listening!

Press the button to start the program and watch as the LEDs change based on the music playing. Remember that the knob changes the LED brightness.

Also, I suggest setting the LEDs inside plastic covers so that their light is more dispersed. To do this attach the LED modules to the Breadware board with wires instead of directly connecting them in. This would also allow you to set the lights in different places around your room. As seen in the image, the pins on the LEDs from left to right say VCC, GND, <blank>, <blank> ,GPIO. The two blank pins don't need to be wired.

Insure that the wires go into the same slots that they would have if you'd directly connected the LEDs to the board as I did.