Annoy-meter 2000

by ddoouubbllee in Circuits > Gadgets

1556 Views, 14 Favorites, 0 Comments

Annoy-meter 2000

final.jpg

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

Pronounced a-NOH-meh-ter, this is a device which measures the relative sound level around itself and maps these values to position a dial which indicates increasing levels of annoyance (correlated with louder sounds).

This instructable will cover the necessary steps in how to recreate my Annoy-meter 2000 project. I will go over the creation of each part, assembly and the Arduino coding to control the device. This project features a microphone which reads relative sound levels and a servo which moves a dial to indicate increasing levels of annoyance (correlated to louder noises).

The most difficult part of this project is making the microphone function accurately. The code for this project uses the 'map' command to translate the range of values read by the microphone to the range of motion for the servo motor. This requires a fair amount of tweaking to make the microphone sensitive, but not overly jumpy, and allows the dial to hit the extremes of its range easily.

Components and Tools.

Physical components:

- Black box (plastic, 8 x 4.5 x 2.5in)

- 1/4" plywood for laser-cut components

- Small funnel (3D Printed)

- Dial (3D printed)

- 2 x Zip ties

Electrical components:

- Arduino Uno

- TowerPro SG90 9G Mini Servo w/ one-sided hub (link to buy)

- Arduino Sound Detection Module (link to buy)

- Solderless breadboard (3.3 x 2.1 x 0.3in)

- 3 F/F breadboard jumper wires

- 9 M/M breadboard jumper wires

Additional tools/supplies

- Drill (w/ 1/4" and 1/2" bits)

- Sandpaper

- 5-minute epoxy

- Black paint

- Accent color paint (I used neon green for this project)

Circuit Design.

WIRING.jpg

A bread board is used to connect all the components to the Arduino. The power (red) and ground (blue) rails on the side of the breadboard are connected to the Arduino's 5V and GND pins. The rails power both the sound sensor and servo motor. The signal pins of the sound sensor and servo are connected to pins A0 and 6, respectively, on the Arduino.

When connecting electrical components, it is good practice to use consistent wire colors for specific purposes. For this project, and "power" wires connecting the 5V pin to the breadboard or a component are red, any wires traveling to GND are blue or black, and signal wires are white or yellow.

Programming.

ARDUINO.jpg
arduino.png

The following program was loaded to the Arduino using the Arduino IDE:

Arduino IDE Dowwnload


This code is fairly simple.

In the first section,

#include   //Library to control servo motor.
#define micPin A0  //Microphone is plugged into an analog pin.
#define servoPin 6 //Servo is plugged into a PWM pin.
Servo myServo;  //Instantiates servo motor in code.
const int T1 = 650;  //Thresholds for detected sound levels.
const int T2 = 681;
const int T3 = 700;
//The annoyance scale (as written on the dial face) from low to high is "Slightly
//Bothered," "Mildly Irritated," "Really Annoyed," "and "Death."
const int bothered = 160;  //Servo motor positions to write for different thresholds.
const int irritated = 118; //'160' corresponds to the lowest position on the dial because
const int annoyed = 71;    //the servo was installed upside-down in my final product.
const int death = 25;      
int micVal = 0;  //Instantiates variable to store detected sound level.
void setup() {
  pinMode(micPin, INPUT);    //Assigns the microphone pin as input and servo
  pinMode(servoPin, OUTPUT); //pin as output.
  myServo.attach(servoPin);  //Uses command in Servo.h to connect servo motor to pin 6.
  myServo.write(160);       //When the program begins, the position of the dial is reset.
}
void loop() {
 micVal = analogRead(micPin); //Reads analog value coming in from microphone pin.
 
 if (micVal <= T1) {       //If the detected noise level hasn't exceeded the first
  myServo.write(bothered); //threshold, the dial will stay on the lowest point on the
  delay(130);              //annoyance scale.
 }
 
 if (micVal <= T2 && micVal > T1) { //The dial will move to "Mildly Irritated" when
  myServo.write(irritated);         //the noise level is between the first and second
  delay(130);                       //thresholds.
 }
 
  if (micVal <= T3 && micVal > T2) { //The dial will move to "Really Annoyed" when the
   myServo.write(annoyed);            //noise level is between the second and third 
   delay(130);                        //thresholds.
 }
  if (micVal > T3) {
   myServo.write(death);
   delay(130);
 }
}

Lid and Dial Face.

LID 1.jpg
DISK 1.jpg
DISK 2.jpg

The dial face and stand pieces were laser-cut from a 1/4in plywood sheet. The pieces were modeled in SOLIDWORKS and saved as a PDF drawing, then the traces were converted to a vector image before uploading them to the laser cutter. The PDF filed necessary to print these pieces is attached/available [below].

The lid to the box has two 1/4 x 1/2in rectangles and a third hole cut in the back. The parallel rectangles pictured on the right side of the lid correspond to the position of the stand pieces for the dial face. The stand pieces are triangular, but shaped like steps so they fit like a jigsaw into the lid and dial face.

The third hole in the in the lid (shown on the left side) was laser-cut for the purpose of this project, but is just a hole for wiring and can be easily made with a drill instead.

You will need to make four more holes in the back of the lid for zip-ties to fasten the servo to the lid. To determine where to place the holes, place the servo on the lid behind where the dial will go, and use a pencil to mark the edges of the servo. Drill four 1/4in holes about 1/2in away from the sides of the servo outline.

3D Printed Parts.

DIAL.jpg
EAR 1.jpg
EAR 2.jpg
EAR 3.jpg

Two pieces were 3D printed for this project: the dial and the funnel for the microphone.

The .stl files for each piece are posted [where]?

The dial was attached to the servo motor by gluing it to a metal hub fastened to the shaft. This metal hub is a custom piece and not necessary for this project; gluing the dial to the one-sided plastic hub that comes with the TowerPro servo would suffice.

The function of the funnel is to increase the sensitivity of the microphone. On the front face of the box, a 1/2in hole was drilled through, and the funnel was centered over the hole and glued on. The microphone portion of the sound sensing module fits when pressed into the hole of the funnel, and can be glued for further security if desired.

Assembly.

To assemble this project, first wire all the electrical components to the Arduino as shown in step 2:

- Connect the 5V Arduino pin to a red rail on the breadboard

- Connect a GND Arduino pin to the blue rail on the breadboard

- For the servo, connect:

- VCC to red power rail

- GND to blue power rail

- Signal pin to pin 6 on the Arduino

- For the microphone, connect:

- VCC to red power rail

- GND to blue power rail

- Signal pin to A0 (Analog pin 0) on the Arduino

- Plug the adapter cord into the 9V battery and [DV input] on the Arduino

Next, attach the jigsaw stand pieces to the dial face. Orient each stand piece so the sloped side points towards the top pf the dial, and slip the rectangular nub into the matching slot on the dial face. The pieces can be attached with superglue or epoxy (for added reliability). Decorate the piece as seen fit. For this project, every side of the piece was spray-painted black, and any details/words on the face were drawn by hand.

Attach the funnel to the side of the box as described in Step 5.

Glue the 3D printed dial to the 1-armed servo hub.

Place the breadboard and Arduino flat in the bottom of the box. These components can be zip-tied into the bottom to prevent rattling, if desired.

Place the microphone in the funnel and press lightly to firmly affix it to the funnel. If the hole in the funnel is too small, wrap a pencil in a piece of sandpaper, rough side out, and rub it inside the hole to increase its diameter.

Thread the servo wires through the third hole on the lid. Place the servo on the box, and zip-tie the servo to the lid where the four small holes were previously drilled. Place the lid on the box and screw in place.

Calibrate the servo to its zero position and attach the glued dial arm/hub. Ensure the arm is set at the lowest angle in the servo's range of motion.

Angle the dial face so it is upright on the lid, and set the rectangular nubs at the bottom of the jigsaw stand pieces in the cut rectangles in the lid. Superglue/epoxy the dial face at this point, or leave it loose so the project pieces can be tweaked later, if desired. The semi-circle cut into the bottom of the dial face should fit over the servo and hub and not inhibit the motion of the arm.