Introduction: Sounduino Noise Sensing Volume Control

This instructable was created in fulfillment of the project requirement of the MakeCourse at the University of South Florida (www.makecourse.com)

We have all been to parties where the music was so loud you could not hear your own thoughts. Or maybe you have been to a party where the music cannot even be heard over the sound of the crowd. This project aims to solve that problem.

The Sounduino Noise Sensing Volume Controller is designed to listen to the noise in a room, and change the volume of your music so that it always stays at the optimal level. You set the noise:music ratio you prefer and it does the rest.

Here's what you will need:

  • Project box
  • LCD Screen with I2C breakout board
  • Stereo headphone jacks (2)
  • Arduino Uno
  • Breadboard
  • Servo
  • Rotary potentiometer with switch
  • 9V battery
  • External power supply plug for Arduino
  • Servo
  • Electret mic
  • Digital potentiometer (2)
  • Soldering Iron
  • Various screws and wires
  • Small piece of fabric
  • Paint

If you are a part of the USF MakeCourse, most of these parts are in your kit. The digital pots I used can be found here: https://www.sparkfun.com/products/10613

Step 1: Printing the Parts

We will use the project box as our base. We will only need to print 2 parts: The front face of the Sounduino (which will replace the top of the box) and the needle. Step and STL files are attached for both of these parts.

The stand-offs on the front face are designed to fit the Arduino uno, the I2C 1602 LCD screen, and the servo. Before you print these parts you should verify that the locations of the standoffs will match the components you will be using.

I chose to print all the parts in black because I plan to paint them later and I want it to match the black project box. You can see in the pictures above what the parts looked like after they were printed.

Step 2: Painting Printed Parts

Once your parts are printed give them a good coat of paint in whatever color you plan to use. I used red, gloss spray paint for the front and back of the box and silver for the needle. Apply a heavy coat and allow it to dry. Lightly sand the surfaces to even out high spots. Repeat this a few times.

After three or four coats you should have a very nice, smooth finish on your 3D printed parts.

Step 3: Wiring the Circuit

Next we need to wire up the circuit. The circuit schematic above shows all the necessary connections. I found the data sheet for my digital pots helpful as I did this (https://www.sparkfun.com/products/10613). As I wired up my own I also found that it was helpful sometimes to connect points A and B by using the breadboard as an intermediate step. This would look like A-breadboard, breadboard-B. This made it easier to pull the front off and on the box with the lengths of wire leads I had. I used the sticky back of the breadboard to adhere the breadboard to the inside of the box.

The basic operation of the circuit is as follows: The switch on the potentiometer connects the 9V battery to the power plug of the Arduino allowing it to run free from the computer. The Arduino reads in the signal from the mic and from the potentiometer on A0 and A1. The Arduino controls the servo from pin 8 and pins 10,11, and 13 are used for the SPI bus communication to the digital potentiometers. The 2 digital potentiometers are wired with the same slave select pin so that the two react together. One headphone jack in the input for your music and the other is the output which can hook in to your stereo. The music signals never go through the Arduino, only through the digital pots. This way they are always analog signals and never are digitized.

Step 4: Writing the Code

Next we need to write the code for the Arduino and upload it to the board. The full sketch I used can be found below. I also have attached two libraries that I used in my code.

The code works as follows: The Arduino takes a sample from the microphone over a certain window and finds a peak to peak value for the window. Then the sample is manipulated to find several values that are usable for executing actions. Part of this manipulation is multiplying the signal by the ratio that the user selects on the rotary pot. The ratio value is displayed on the LCD screen. The code uses the running average to slow down the response time and reduce the effects of short, sharp spikes. This yields a final set of output value which are used to control the servo and the position of the digital pots.

Step 5: Assembly

Once the code, the parts, and the circuit are all complete we can begin final assembly. Mount all the pieces to the front face. You will need some little screws to mount the Arduino, the LCD, and the servo to the stand-offs. The headphone jacks and the rotary pot are clamped into the appropriate holes with the include nuts. Attach the knob to the rotary pot. Attach the needle to the servo with a screw.

Before you close up the box, take a piece of fabric and stretch it over the opening. Use tape or glue to secure it in place. Place the microphone as close to this opening as you can.

Step 6: Adding Finishing Touches

Finally, I added some finishing touches. I wanted my Sounduino to look like an old, retro radio. I used black and silver paint pens to add some grunge and wear spots to the outer case, the knob, the needle, and even to the cloth covering the mic opening. I used a small paintbrush and a needle to dab paint into the recessed place on the face to create color coded volume levels (green as lowest volume and orange as highest).

You can see my finished product in the picture above.