Difference between revisions of "Sound Detection Sensor"

From Microduino Wiki
Jump to: navigation, search
(Result)
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
|-
 
|-
 
|
 
|
==Purpose==
+
==Outline==
 +
Sound detection sensor can detect sound intensity but cannot recognize the specified sound.
 +
<br />
 +
Inside the sensor, there is sound sensitive electret-condenser microphone. Acoustic wave triggers vibration of the thin electret film and causes capacitance change, generating subtle voltage. The voltage is converted to 0-5v, which can be recognized and received by mCookie-CoreUSB.
  
This tutorial will show you how to use Microduino Microphone sound sensor.   
+
==Specification==
==Equipment==
+
*Electrical specification
*'''[[Microduino-CoreUSB]]'''
+
**Operation voltage: 3V~5V
*'''[[Microduino-Buzzer]]'''
+
**Input Device
*'''[[Microduino-MIC]]'''
+
*Tech parameters
*'''[[Microduino-Sensorhub]]'''
+
**Voltage: 0~5V(100Hz~4000Hz)
 +
**Sound intensity: 45~120dB
 +
**Accuracy:±1%
 +
*Size
 +
**Size of the sensor: 5mm*5mm
 +
**Size of the board: 20mm*20mm
 +
*1.27mm-pith 4PIN interface;
 +
*Connection method
 +
**Output: 0~5V analog signal  
 +
**Pin Description: GND, VCC, signal output and NC(Empty). The output signal is simulated, thus, it needs analog interface to detect(A0-A7). You can connect it to A6,A2,A0 of the Hub.
 +
==Development==
 +
===Equipment===
 +
{|class="wikitable"
 +
|-
 +
|Module||Number||Function
 +
|-
 +
|[[mCookie-CoreUSB]]||1||Core board
 +
|-
 +
|[[mCookie-Hub]]||1||Sensor pin board
 +
|-
 +
|[[Microduino-Sound]]||1||Sound detection sensor
 +
|}
 +
*Other Hardware Equipment
 +
**One USB cable
  
 +
[[File:mic-phone.jpg|600px|center]]
  
*Other hardware equipment 
+
===Preparation===
**1x USB cable  
+
*Setup 1: Connect Microduino-Sound and the A0 analog port of the Hub together. That analog port A0 is the pin of detecting sound. Users can change that according to personal needs.
 +
[[file:mCookie-Sound-sensor.JPG|600px|center]]
 +
*Setup 2: Stack the CoreUSB, Hub and Sound modules to the computer with a USB cable
 +
[[file:mCookie-Sound-pc.JPG|600px|center]]
  
 +
===Experiment: To Detect Sound Intensity===
 +
*Open Arduino IDE and copy the following code into the IDE. 
 +
<source lang="cpp">
 +
#define mic_pin A0
  
==Program==
+
int sensorValue;
  
Program:
+
// the setup routine runs once when you press reset:
[[https://github.com/Microduino/Microduino_Tutorials/tree/master/mCookie_sensor/MicroduinoMIC MicroduinoMIC]]
+
void setup() {
 +
  // initialize serial communication at 9600 bits per second:
 +
  Serial.begin(9600);
 +
  pinMode(mic_pin, INPUT);
 +
}
  
Function Description:  
+
// the loop routine runs over and over again forever:
tone(buzzer_pin,value)  //Output frequency in the specified port.  
+
void loop() {
 +
  // read the input on analog pin 0:
 +
  sensorValue = analogRead(mic_pin);
 +
  // print out the value you read:
 +
  Serial.print("Sound:");
 +
   Serial.println(sensorValue);
 +
  delay(100);        // delay in between reads for stability
 +
}
 +
</source>
 +
*Choose the right port from Tools→Serial Port in Arduino IDE after compiling.
 +
[[file:uploadsound1.JPG|600px|center]]
 +
*Upload the program directly.
 +
[[file:uploadsound.JPG|600px|center]]
 +
*After the upload, you can open the serial monitor. The displayed value reflects the current sound intensity.
 +
[[file:mCookie-Sound-res-sensor.JPG|600px|center]]
  
==Debugging==
+
===Program Debugging ===
 
+
*"#define mic_pin A0" defines the pin of controlling LED; A0 means Microduino A0 pin, which can connect to A6, A2, A0.  
Step 1: Plug Microduino microphone to the A2 pin of Microduino-Sensorhub and Microduino buzzer to D6.
+
*Adopt "analogRead(mic_pin)" to read sound values.
[[File:MicroduinoMicphoneSensor.png|600px|center|thumb]]
 
 
 
 
 
Step 2: Connect the Microduino-CoreUSB to your PC with the USB cable and upload the code. [[File:MicroduinoMicphoneSensor1.png|600px|center|thumb]]
 
 
 
 
 
Step 3: Speak towards the microphone:
 
[[File:MicroduinoMicphoneSensor2V1.png|600px|center|thumb]]
 
 
 
 
 
Step 4: You’ll hear the same sound from the buzzer.
 
[[File:MicroduinoMicphoneSensor3.png|600px|center|thumb]]
 
 
 
==Result==
 
 
 
You will hear the sound analog value through the microphone.
 
  
 
==Video==
 
==Video==
  
 
|}
 
|}

Latest revision as of 06:36, 30 September 2016

Outline

Sound detection sensor can detect sound intensity but cannot recognize the specified sound.
Inside the sensor, there is sound sensitive electret-condenser microphone. Acoustic wave triggers vibration of the thin electret film and causes capacitance change, generating subtle voltage. The voltage is converted to 0-5v, which can be recognized and received by mCookie-CoreUSB.

Specification

  • Electrical specification
    • Operation voltage: 3V~5V
    • Input Device
  • Tech parameters
    • Voltage: 0~5V(100Hz~4000Hz)
    • Sound intensity: 45~120dB
    • Accuracy:±1%
  • Size
    • Size of the sensor: 5mm*5mm
    • Size of the board: 20mm*20mm
  • 1.27mm-pith 4PIN interface;
  • Connection method
    • Output: 0~5V analog signal
    • Pin Description: GND, VCC, signal output and NC(Empty). The output signal is simulated, thus, it needs analog interface to detect(A0-A7). You can connect it to A6,A2,A0 of the Hub.

Development

Equipment

Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-Hub 1 Sensor pin board
Microduino-Sound 1 Sound detection sensor
  • Other Hardware Equipment
    • One USB cable
Mic-phone.jpg

Preparation

  • Setup 1: Connect Microduino-Sound and the A0 analog port of the Hub together. That analog port A0 is the pin of detecting sound. Users can change that according to personal needs.
MCookie-Sound-sensor.JPG
  • Setup 2: Stack the CoreUSB, Hub and Sound modules to the computer with a USB cable.
MCookie-Sound-pc.JPG

Experiment: To Detect Sound Intensity

  • Open Arduino IDE and copy the following code into the IDE.
#define mic_pin A0

int sensorValue;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(mic_pin, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  sensorValue = analogRead(mic_pin);
  // print out the value you read:
  Serial.print("Sound:");
  Serial.println(sensorValue);
  delay(100);        // delay in between reads for stability
}
  • Choose the right port from Tools→Serial Port in Arduino IDE after compiling.
Uploadsound1.JPG
  • Upload the program directly.
Uploadsound.JPG
  • After the upload, you can open the serial monitor. The displayed value reflects the current sound intensity.
MCookie-Sound-res-sensor.JPG

Program Debugging

  • "#define mic_pin A0" defines the pin of controlling LED; A0 means Microduino A0 pin, which can connect to A6, A2, A0.
  • Adopt "analogRead(mic_pin)" to read sound values.

Video