Alex Burg
Published

Aduino Equalizer

Using Arduino code and a Sparkfun sound sensor the 3D printed light tower illuminates specific segments due to the strength of the sound.

BeginnerShowcase (no instructions)779
Aduino Equalizer

Story

Read more

Custom parts and enclosures

Side piece

creates a part of the bottom casing

Front piece

creates part of the bottom casing

Top piece

Creates part of the bottom casing

Bottom piece

Creates part of the bottom casing

Light segment

Made out of opaque PLA these pieces create a diffuse segment for one color of lights

Assembly CAD

All of the pieces put together

Schematics

Custom PCB schematic

Power distribution board to allow a single plug in from a 3.5mm barrel jack to power all of the light segments

Custom PCB board

Power distribution board to allow all light segments to be powered by a 3.5mm barrel jack

Code

Arduino_Equalizer

Arduino
Reads analog data from a Sparkfun sound sensor then lights segments of 13 lights based depending on what the range of the analog values are
#include <Adafruit_NeoPixel.h>

int incomingByte = 0;
int sensorInput;
int sensePin = A1;

Adafruit_NeoPixel strip_a = Adafruit_NeoPixel(13, 2, NEO_RGB + NEO_KHZ800); //defines each individual strip as 10 pixels and what pin they are associated with
Adafruit_NeoPixel strip_b = Adafruit_NeoPixel(13, 3, NEO_RGB + NEO_KHZ800);
Adafruit_NeoPixel strip_c = Adafruit_NeoPixel(13, 4, NEO_RGB + NEO_KHZ800);
Adafruit_NeoPixel strip_d = Adafruit_NeoPixel(13, 5, NEO_RGB + NEO_KHZ800);
Adafruit_NeoPixel strip_e = Adafruit_NeoPixel(13, 6, NEO_RGB + NEO_KHZ800);

void setup() {
  strip_a.begin();
  strip_a.show();
  strip_b.begin();
  strip_b.show();
  strip_c.begin();
  strip_c.show();
  strip_d.begin();
  strip_d.show();
  strip_e.begin();
  strip_e.show();

    Serial.begin(9600); // opens serial port, sets data rate to 9600 bytes per second

}

void loop() {
int value;
  value = analogRead(A1);
  sensorInput = analogRead(A1);
  Serial.println(value);
  

for(int i=0; i<13; i++)
{
  if ( (value <= 10) )
  {
    strip_a.setPixelColor(i, strip_a.Color(8, 94, 135));//on
    strip_b.setPixelColor(i, strip_b.Color(0, 0, 0));//off
    strip_c.setPixelColor(i, strip_c.Color(0, 0, 0));//off
    strip_d.setPixelColor(i, strip_d.Color(0, 0, 0));//off
    strip_e.setPixelColor(i, strip_e.Color(0, 0, 0));//off
    strip_a.show();
    strip_b.show();
    strip_c.show();
    strip_d.show();
    strip_e.show();
  }
  else if( (value > 10) && (value <= 30) )
  {
    strip_a.setPixelColor(i, strip_a.Color(8, 94, 135));//on
    strip_b.setPixelColor(i, strip_b.Color(0, 0, 255));//on
    strip_c.setPixelColor(i, strip_c.Color(0, 0, 0));//off
    strip_d.setPixelColor(i, strip_d.Color(0, 0, 0));//off
    strip_e.setPixelColor(i, strip_e.Color(0, 0, 0));//off
    strip_a.show();
    strip_b.show();
    strip_c.show();
    strip_d.show();
    strip_e.show();
  }
  else if( (value > 30) && (value <= 50) )
  {
    strip_a.setPixelColor(i, strip_a.Color(8, 94, 135));//on
    strip_b.setPixelColor(i, strip_b.Color(0, 0, 255));//on
    strip_c.setPixelColor(i, strip_c.Color(255, 0,0));//on
    strip_d.setPixelColor(i, strip_d.Color(0, 0, 0));//off
    strip_e.setPixelColor(i, strip_e.Color(0, 0, 0));//off
    strip_a.show();
    strip_b.show();
    strip_c.show();
    strip_d.show();
    strip_e.show();
  }
  else if( (value > 50) && (value <= 70) )
  {
    strip_a.setPixelColor(i, strip_a.Color(8, 94, 135));//on
    strip_b.setPixelColor(i, strip_b.Color(0, 0, 255));//on
    strip_c.setPixelColor(i, strip_c.Color(255, 0, 0));//on
    strip_d.setPixelColor(i, strip_d.Color(136, 255, 0));//on
    strip_e.setPixelColor(i, strip_e.Color(0, 0, 0));//off
    strip_a.show();
    strip_b.show();
    strip_c.show();
    strip_d.show();
    strip_e.show();
  }
  else if( (value > 70) && (value <= 90 ) )
  {
    strip_a.setPixelColor(i, strip_a.Color(8, 94, 135));//on
    strip_b.setPixelColor(i, strip_b.Color(0, 0, 255));//on
    strip_c.setPixelColor(i, strip_c.Color(255, 0, 0));//on
    strip_d.setPixelColor(i, strip_d.Color(136, 255, 0));//on
    strip_e.setPixelColor(i, strip_e.Color(0, 255, 0));//on
    strip_a.show();
    strip_b.show();
    strip_c.show();
    strip_d.show();
    strip_e.show();
  }
}

}

Credits

Alex Burg

Alex Burg

2 projects • 0 followers
Currently a Electrical Engineering Student at CU Boulder

Comments