## Introduction: Baby Noise Detection

This is a project I made as final for one of my classes in University.
Looking at instructables I saw a project that make me think in a possible device to build:

"How to Deal with Noisy Neighbors"

https://www.instructables.com/id/How-to-Deal-with-Noisy-Neighbors/

This device detects the noise from the neighbors through a MIC in the wall, if it takes longer than 10 seconds, an electrical signal is sending to a CD player and it turns on  speakers that are pointing to the wall.
After seeing the video, I wanted to apply the same principle to build a Baby Noise Detection.

## Step 1: Supplies

I used the following items for this device:

1  Breadboard (later I solder all the components in another board)
1  Arduino  Uno
1  5v power source to power the Arduino (I powered it through USB from my laptop)
1  Electret microphone
1  Green 10 LED bar graph (individual LEDs will work too)
1  Red 10 LED bar graph (individual LEDs will work too)
1  Orange LED (or any other color)
1  NPN Transistor 2N3904 or similar
2  0.1uF capacitor
1  100k ohm resistor
2  10k ohm resistor
13 220 ohm resistor (Or whatever will run your LEDs at 5v)
1 Music player for babies
Connector wire
Tape

## Step 2: Setting Up the Circuit

First I built the system using a breadboard.

(The system is the same, so I upload the same breadboard circuit)

## Step 3: Soldering All the Components

The system seemed to work perfectly so I started to solder all the components.

I just tape the wires of the MIC for make it more aesthetic.

## Step 4: The Music Player for Babies and the "hardware"

The first idea was to build a mobile by myself, because of lack of time I could not make it and I had to use a relax music player for babies.

The next step was to create a “hardware” where all the circuit are kept. I just created a box with a hole for the noise meter.

## Step 5: The Code

(This is the same concept as in the original project "Noisy Neighbors", so I just changed some information. The code is exactly the same)

You can download the attached sketch and load it onto your Arduino. The program will automatically run on powerup.

Some important notes about the code:

Line 7
const int threshold = 320;
This sets the threshold for triggering the playback. It should be low enough so that the baby's crying makes our graph go into the red, but high enough so ambient noise won't set it off (like a loud car outside). Play around with this value to set it just right.

Line 9
2,3,4,5,6,7,8,9,10,11,12,13};
These are all of the outputs that make up the LED bar graph. If you use more than I did, you will need to add the extra ports here.

Line 14
const long waitTime = 10000.0;
This is the 10 second wait period to avoid false alarms. You can change this as needed (the value is in milliseconds).

Line 15
const long cancelTime = 4000.0;
This is what defines "continuous" crying during the waiting period. If the cry stays below the threshold for 4 seconds then it cancels the waiting period and goes back to monitoring. You can change this as needed (the value is in milliseconds).

Line 16
const long playTime = 30000.0;
This is how long the music will be played. It is set for 30 seconds but you can change this as needed (the value is in milliseconds).

Line 37
digitalWrite(playPin, HIGH);
This is the music player control output.

Line 46
ledLevel = map(sensorReading, 200, threshold, 0, ledCount);
The 200 here eliminates ambient noise. When it was 0 the first couple LED bars would stay on constantly.

## Step 6: Final Result

The final result looks nice and it works perfectly. In order to activate the device, I used a video of a baby crying and the result was great. After 10 seconds the device turned on by itself and the music started playing. As soon as the noise had stopped the device automatically turned off 10 seconds later.

Video:

https://www.youtube.com/watch?v=nSglHN1y_pc&feature=youtu.be