Introduction: Electret Microphone
We have tested the Electret microphone breakout from Sparkfun https://www.sparkfun.com/products/9964
An electret microphone is a device that uses two conducting plates to capture sound waves and translate them into electrical waves. An electret microphone is an omnidirectional microphone, which means it can capture sound from all directions.
The Electret microphone reads amplitude, not volume. Amplitude is directly related to the acoustic energy or intensity of a sound. Both amplitude and intensity are related to sound's power. Amplitude is the change between peak (highest amplitude value) and trough (lowest amplitude value, which can be negative). This microphone is outputting an analog waveform that is representative of the incoming sound. This is NOT the same as “volume” or “loudness”.
Here is some examples of how others have used the microphone:
Tell me when to shut up alarm: https://www.instructables.com/id/Tell-Me-When-to-S...
Waves in processing: http://www.dtic.upf.edu/~jlozano/interfaces/micro...
Heart matrix: http://lucidtronix.com/tutorials/35
Sound levels measure: https://learn.adafruit.com/adafruit-microphone-am...
Several microphones following handclaps: http://forum.arduino.cc/index.php/topic,2534.0.htm...
Simple robot: https://www.instructables.com/id/simpleWalker-4-le...
Step 1: Led and the Electret Microphone
The first thing we did was to test the microphone with the integrated led on the Arduino board. The led lights up whenever the sensor value is over 670. (You can lower or raise the value to make the microphone more or less responsive) After testing several values, we choose to use 670 because this value removed unwanted background noises from the output. The monitor registered the general sound level in the classroom to be between 400 and 550. When talking or making noises directly in to the microphone, the values reaches the maximum level of 1023.
We first wired the microphone and then tested it with the built in led on the arduino board (pin 13). Se the code attached and the fritzing drawing to see how to connect the microphone.
Then we wired a led to pin 9 to hook the microphone up with an external led.
Step 2: RGB Led and Electret Microphone
Next we added a RGB led on the breadboard to see if we could change the colors with the microphone. The green light is always on, and the red light turns on when the volume increases. When this happens the monitor prints both the values 1023 and 0. Therefor to turn on the red light the sensor value in the code can be set to either ==0 or ==1023 and still be precived as the same. To get a wider range we used <300 (or >900).
Step 3: Using Two Microphones + Two Leds
Each led is connected to its own separate microphone. The led connected to the microphone with the highest input value turns on.
The sketch cannot lighten up both leds at the same time.
Step 4: Blow Out Candle
By blowing on the microphone, the led turns off. If you blow on the microphone again the led will turn back on. See the attached code, the fritzing document is the same as in step 1.
When you blow on the candle the LED flickers, a delay may be introduced to the code to avoid this.
Step 5: Voice Activated Leds
The program BitVoice is used to activate three leds by voice. The program can be downloaded here:http://www.bitsophia.com/Downloads.aspx (only for Windows, and you have to buy a product key 4,50$) Check the video to see how to download and set the preferences. Attached you find the arduino code and the BitVoice file (vsc). We also made a Norwegian version.
You need to wire the AREF pin in the Arduino to the voltage to get BitVoice to read the input correctly. Use the AREF pin to measure the reference voltage more accurate. Cause only using the reference voltage operating on the board would not give you 100% of the current voltage range.
The voice commands, like "Turn red LED on", are defined in BitVoicer, but the commands communicating between BitVoicer and the Arduino, like "RH", are defined in the Arduino code and then hooked up with the voice command "Turn red LED on" inside the BitVoicer program.
When using BitVoicer you cannot get values from the Arduino monitor. This is due to BitVoice blocking the serial port.
Step 6: Servo Motor
Connecting the microphone to a stepper.
When the microphone is triggered by a certain value, the motor will start running for a specified amount of time. The motor is kind of lagging though: It takes some time for the motor to react on the analogue input.
Step 7: Heart Rate
This sketch can read the pulse. More accurate together with a stethoscope. Read everything here: