Sound Reactive Cube

Introduction

Today we are going to make a Arduino powered sound reactive wooden cube. Which will be changing color in perfect sync to the surrounding sounds or vibration.

Hardware required

ComponentsAmazon.inamazonAmazon.comamazonBanggoodbanggoodAliExpressali express
Arduino Nanocart iconcart iconcart iconcart icon
Addressable WS2811 5vcart iconcart iconcart iconcart icon
Mic based Sound Sensor Modulecart iconcart iconcart iconcart icon
White Wood Cube

Theory

The sounds will be picked by the mic module and will be amplified and fed to the Arduino analog pin, we will read the analog pin values and using the fastLED library we will change the colors of the LEDs randomly according to the received values from the mic.

Construction

Finished Product Photos

Schematics

ArduinoMic moduleAddressable WS2811
5V VCCVCC
A5OUT
GNDGNDGND
D5IN

Programming 

 

Installing Library.  Click to expand (for beginners)

The only library which we have used for this project is fastLed library, we can download and install it from their Github page https://github.com/FastLED/FastLED.

Step 1: 

Download the library from https://github.com/FastLED/FastLED
 
Download ZIP

Step 2:

Go to the Sketch menu in Arduino IDE from there select -> Include Library -> Add.ZIP Libray and Choose the downloaded library file from your download folder.
 
 
 
 

Test Video

Video Tutorial

Code


#include "FastLED.h" //fast led library 
#define NUM_LEDS 10 //total no. of leds used
#define DATA_PIN 5 //digital pin at which the data pin is connected
#define mic A5 //analog input from mic module
int mic_Value; //to save raw value from mic
int red, green, blue; //to store RGB color values
CRGB leds[NUM_LEDS]; //fast led function 

void setup() {
  FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); //as our led IC is UCS1903B,fast led support lots of ICs, find more
  //FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); //if you are using WS2812B insted of UCS1903B
  LEDS.setBrightness(200); //setting brightness of LED (0 to 255) //info at fastled.io
  randomSeed(analogRead(0));// for generating random no. by taking noise from analog pin 0
  for (int i = 0; i <= 9; i++) //for changing color of all 10 LEDs
  {
    leds[i] = CRGB(200, 200, 200); //for initial white color
    LEDS.show(); //fastled function, without this function the colors won't be updated
  }

}

void loop() {

  mic_Value = analogRead(mic); //storing analog values from mic to mic_value
  if(mic_Value>100) //to avoid small noise
  {
    for(int i=0;i<=9;i++)//for changing color of all 10 LEDs
    {
    red=random(255); //random red color value between 0 to 255
    green=random(255); //random green color value between 0 to 255
    blue=random(255); //random blue color value between 0 to 255
    leds[i]=CRGB(red,green,blue); //assigning color values to LEDs
    LEDS.show();
  }
 }
}

 

3 thoughts on “Sound Reactive Cube”

  1. Instead of showing the schematics can you take a picture of how you arranged the wires? Bbecause as a student it is quite hard to understand.

Leave a Comment

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

Scroll to Top