Sound-responsive Lights

Difficulty
Moderate
Steps
10

The EagLED can be used with external components such as a sound sensor module. 

In this guide, create a sound-activated light-up accessory with the EagLED, a sound sensor module, conductive thread, and felt fabric.

Complete this simple guide and incorporate it into your next wearable electronic costume or accessory.

The parts


For this guide, you'll need:

  • EagLED - Little bird E-Textile Snappable board. The EagLED is our E-textile wearable development board that makes this all possible! We'll be using:
    • The main board
    • Several of its LEDs
    • Coin cell battery holder
  • CR2032 battery
  • Sound sensor module
  •  Alligator test leads (we also recommend the alligator clip to jumper wire version for easy connections to the sound sensor module)
    • This will only be used in the prototyping process
  • Conductive Thread and a sewing needle
    • We'll then sew the components using conductive thread
  • Fabric of your choice
    • Blue and black felt fabric is used here 
  • Fabric scissors
  • Soldering iron
  • Solder

The sound sensor

Sound is a type of energy made by vibrations. When we hear something, we are sensing the vibrations in the air. 

Infrasound are waves below 20Hz and are very difficult for humans to hear. You may have also heard of the term, ultrasound, which are sound waves above 20,000 Hz (20kHz). In this guide, we're interested in sound waves in the hearing range of a human ear (20 to 20,000 Hz).

To create a sound-reactive device, we'll use a sound sensor module. 

A sound sensor module has a microphone, an amplifier and other on-board circuitry. Through the use of the microphone, the module detects audio signals and converts the sound signal into a small voltage or current proportional to the detected signal. However, a microphone alone is insufficient. This is because without an amplifier, it would only produce very small electrical signals. So, the signal is fed through the on-board amplifier.

This sound sensor module can provide a binary indication of the presence of sound as well as an analog representation of its amplitude.

Let's take a closer look at the Sound Sensor Module.

It has four pins:

  • DO: Digital Output 
  • 3.3V  : This pin is marked as '+' on the module. We'll connect it to 3.3V on the EagLED.
  • GND: In electronics, we define a point in a circuit to be a kind of zero volts or 0V reference point, on which to base all other voltage measurements. This point is called ground or GND.
    • Note: Voltage is the difference in potential between two points. As it is difficult to talk about voltage without a reference point, we need another point to compare it to. 
  • AO: Analog Output

Step 1  The prototype

Connect an LED with EagLED:

  • '+' to '#10'
  • '-' to 'GND'

Connect Sound Sensor Module with EagLED:

  • '+' to '3.3V'
  • 'GND' to 'GND'
  • 'AO' to '#A9'

Step 2  Arduino sketch for sound-activated lights


              const int sensorPin = A9; // analog input pin for sound sensor
const int ledPin = 10; // pin for LED
const int threshold = 850;
int sensorValue = 0; // variable to store the value coming from the sensor


void setup ()
{
  pinMode(sensorPin, INPUT);
  pinMode (ledPin, OUTPUT);
  Serial.begin (9600);
}

void loop ()
{
  sensorValue = analogRead(sensorPin);
  if (sensorValue >= threshold){
    digitalWrite (ledPin, HIGH);
    }
  else{
    digitalWrite (ledPin, LOW);
  }
  Serial.println (sensorValue, DEC);
}
            

Upload this sketch to the EagLED.

Step 3  Open up the Serial Plotter

Open up the Serial Plotter:

  • On the Arduino IDE, click Tools > Serial Plotter
  • Make sure the baud rate is set to '9600 baud' found at the bottom right corner of the Serial Plotter window.
  • With the sound sensor nearby, clap your hands or tap the table. You should see a changing analog value resembling waves with its peaks and troughs.

Note: If the LED does not light up, adjust the threshold value in the sketch from before. As we're using the 'AO' pin on the sound sensor, it will output analog values ranging from 0 to 1023. 

  • Decrease the threshold value to increase sensitivity i.e. from '850' to '650'
  •  Increase the threshold value to decrease sensitivity.  i.e. from '850' to '1000'.

Step 4  Create the accessory

Now that the prototype is complete, it's time to create the accessory out of fabric.

For this guide, we will create an bracelet out of felt fabric, a material that is easy to use with conductive thread. Cut out a rectangular piece of felt fabric. 

Step 5  Sewing the components

It's time to sew the components onto the fabric.

To connect the sound sensor to the EagLED, we will solder wires directly to them:

  • Connect the 'F' end of a M-F jumper wire to 'AO' on the sound sensor module, then solder the 'M' end to the EagLED's '#A9' pin
  • Connect 'F' end of a jumper wire to '+', and then solder the 'M' end to EagLED '3.3V'
  • Connect 'F' end of another jumper wire to '-' on sound sensor module, then solder other end to 'GND' on EagLED

Next, connect the LED to EagLED:

  • Stitch a line of conductive thread from the '+' on the LED to '#10' on the EagLED. 
  • Stitch another line from '-' to 'GND'. 

Finally, connect a coin cell battery holder to make the project portable.

  •  '+' to '3.3v' 
  • '-' to 'GND'

Step 6  Add more LEDs

To add more LEDs, connect:

  •   '+' sew tab on second LED to '#6' on the EagLED
  • third LED's '+' sew tab to '#12' on the EagLED.
  • Finally, they will all be connected to the same 'GND' pin on the EagLED:
    • So, connect the '-' sew tabs of the second and third LED to '-' on the first LED.

Stitch both ends of the rectangular piece of fabric together to complete the bracelet.

Step 7  Complete Arduino sketch


              const int sensorPin = A9; // analog input pin for sound sensor
const int ledPins[] = {6, 10, 12}; // pins for LEDs
const int threshold = 850;
int sensorValue = 0; // variable to store the value coming from the sensor
int pinCount = 3; //the number of pins used (i.e. the length of the array)

void setup ()
{
  pinMode(sensorPin, INPUT);
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(ledPins[thisPin], OUTPUT);
  }
  Serial.begin (9600);
}

void loop ()
{
  sensorValue = analogRead(sensorPin);
  if (sensorValue >= threshold) {
    for (int thisPin = 0; thisPin < pinCount; thisPin++) {
      digitalWrite(ledPins[thisPin], HIGH);
    }
  }
  else {
    for (int thisPin = 0; thisPin < pinCount; thisPin++) {
      digitalWrite(ledPins[thisPin], LOW);
    }
  }
  Serial.println (sensorValue, DEC);
}
            

Upload this sketch to the EagLED.

Step 8  Test it out!

Clap your hands or knock on the table, the LEDs should light up!