Puzzle - Sound Sensor 声音传感器

来自Duinopeak_COM
跳转至: 导航搜索

产品简介

Sound-sensor.png
puzzle - Sound Sensor是一个简单的麦克风。它是基于LM386以及电极麦克风制作的,能用于探测环境声音的强度。输出信号的增益可以通过板上的一个电位器调节。

规格参数

工作电压范围: 4 - 12V
工作电流(Vcc = 5V): 4 - 8mA
电压增益(VS= 6V, f = 1 kHz): 26dB
灵敏度(1Khz): 52- 48dB
阻抗: 2.2KΩ
探测频率范围: 20 - 16Khz
信噪比: 54dB

应用示例

用声音传感器控制LED的亮灭

Puzzle Sound sensor connection.jpg
下面的示例演示的是如何用声音传感器来控制一盏LED灯。当环境音量比阈值高时,LED灯将亮起。

// Function: If the sound sensor senses a sound that is up to the threshold you set in the code, the LED is on for 200ms.
// Hardware: puzzle - Sound Sensor, puzzle - LED

/*macro definitions of the sound sensor and the LED*/
#define SOUND_SENSOR A0
#define LED 3      // the number of the LED pin

#define THRESHOLD_VALUE 400//The threshold to turn the led on 400.00*5/1024 = 1.95v
void setup() 
{
    Serial.begin(9600);
    pins_init();
}
 
void loop() 
{
	int sensorValue = analogRead(SOUND_SENSOR);//use A0 to read the electrical signal
	Serial.print("sensorValue ");
        Serial.println(sensorValue);
        if(sensorValue > THRESHOLD_VALUE)
	{
		turnOnLED();//if the value read from A0 is larger than 400,then light the LED
		delay(200);
	}
	turnOffLED();
}

void pins_init()
{
	pinMode(LED, OUTPUT);
	pinMode(SOUND_SENSOR, INPUT); 
}
void turnOnLED()
{
	digitalWrite(LED,HIGH);
}
void turnOffLED()
{
	digitalWrite(LED,LOW);
}

参考资源


Sound Sensor 声音传感器原理图PDF: 文件:Puzzle Sound sensor schematic.pdf

Sound Sensor 声音传感器LM386数据手册: 文件:Puzzle Sound sensor datasheet LM386.pdf