Sound Reactive Light Cube , Featured in Hackspace

Introduction: Sound Reactive Light Cube , Featured in Hackspace

Introduction

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

Featured in #Hackspace 16th issue https://hackspace.raspberrypi.org/issues/16

Hardware required

  • Arduino Nano
  • Addressable UCS1903B DC5V
  • Mic based Sound Sensor Module
  • 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.

Step 1: Construction

Pictures speak 1000 words


Step 2: Schematics

Step 3: Programming

Download code from GitHub

https://gist.github.com/onajad/20bb5f24ca2162202e005bbcc85ae164

#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(leds, NUM_LEDS); //as our led IC is UCS1903B,fast led support lots of ICs, find more

//FastLED.addLeds(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();

}

}

}

Step 4: Testing

Step 5: Full Video Tutorial

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    6 Discussions

    0
    andrew.hudson315
    andrew.hudson315

    1 year ago

    Hi, what size are the wooden cubes? Unfortunately I couldn't find it in the 1000 words ;)

    0
    diyusthad
    diyusthad

    Reply 1 year ago

    hihi, its 20 mm by 20 mm

    0
    Dave Mc
    Dave Mc

    1 year ago

    I love this. I busy at the moment with exams and stuff but I think I am gonna try to make this over the summer.

    0
    diyusthad
    diyusthad

    Reply 1 year ago

    thats great, send me pics when you made it

    0
    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    Fun project! I like that it's made out of wood :) And congrats on being in Hackerspace Magazine :D

    0
    diyusthad
    diyusthad

    Reply 1 year ago

    Thanks for your valuble support