Difference between revisions of "Sound Detection Sensor"
From Microduino Wiki
(→Experiment: To Detect Sound Intensity) |
|||
Line 12: | Line 12: | ||
**Input Device | **Input Device | ||
*Tech parameters | *Tech parameters | ||
− | **Voltage: | + | **Voltage: 0~5V(100Hz~4000Hz) |
− | **Sound intensity: | + | **Sound intensity: 45~120dB |
**Accuracy:±1% | **Accuracy:±1% | ||
*Size | *Size | ||
− | **Size of the sensor: 5mm* | + | **Size of the sensor: 5mm*5mm |
**Size of the board: 20mm*20mm | **Size of the board: 20mm*20mm | ||
*1.27mm-pith 4PIN interface; | *1.27mm-pith 4PIN interface; | ||
Line 40: | Line 40: | ||
===Preparation=== | ===Preparation=== | ||
− | *Setup | + | *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]] | [[file:mCookie-Sound-sensor.JPG|600px|center]] | ||
− | *Setup | + | *Setup 2: Stack the CoreUSB, Hub and Sound modules to the computer with a USB cable. |
[[file:mCookie-Sound-pc.JPG|600px|center]] | [[file:mCookie-Sound-pc.JPG|600px|center]] | ||
Line 77: | Line 77: | ||
===Program 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. |
− | *Adopt | + | *Adopt "analogRead(mic_pin)" to read sound values. |
==Video== | ==Video== | ||
|} | |} |
Latest revision as of 06:36, 30 September 2016
ContentsOutlineSound detection sensor can detect sound intensity but cannot recognize the specified sound.
Specification
DevelopmentEquipment
Preparation
Experiment: To Detect Sound Intensity
#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
}
Program Debugging
Video |