Difference between revisions of "Noise Alarm--Grumpy Grandpa"
From Microduino Wiki
(→Principle) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
With MIC sound detection sensor to detect sound, when the sound exceeds the pre-et value, the device starts timing. | With MIC sound detection sensor to detect sound, when the sound exceeds the pre-et value, the device starts timing. | ||
In order to prevent interference, if the sound which keeps maintain louder than the default value after a certain period of time, then it is considered to be noise and the buzzer will alarm. At the same time, the system can detect whether the key is pressed,. When the key press, the buzzer alarm is closed. | In order to prevent interference, if the sound which keeps maintain louder than the default value after a certain period of time, then it is considered to be noise and the buzzer will alarm. At the same time, the system can detect whether the key is pressed,. When the key press, the buzzer alarm is closed. | ||
− | [[File: _Grumpy_Grandpa-sch.jpg|600px|center]] | + | [[File: _Grumpy_Grandpa---sch.jpg|600px|center]] |
==Equipment== | ==Equipment== | ||
Line 32: | Line 32: | ||
==Preparation== | ==Preparation== | ||
− | *Setup | + | *Setup 1: Use a USB cable to connect the CoreUSB and the PC/Mac, the open Arduino IDE. |
[[File:CoreUSB_Ble_pc.jpg|600px|center]] | [[File:CoreUSB_Ble_pc.jpg|600px|center]] | ||
− | *Setup | + | *Setup 2: Click Files > Examples > mCookie > _102_Grumpy_Grandpa, load the program. |
[[File: _Grumpy_Grandpa_ino.jpg|600px|center]] | [[File: _Grumpy_Grandpa_ino.jpg|600px|center]] | ||
− | * Setup | + | * Setup 3: Select the right board and COM port for program download. |
==Program Description == | ==Program Description == | ||
Line 82: | Line 82: | ||
==Hardware Buildup == | ==Hardware Buildup == | ||
− | *Setup | + | *Setup 1: Connect the buzzer sensor to the Sensorhub D6, Colored LED to A0 and the touch switch to D4. |
[[File:CoreUSB_Sensorhub_ Applause_heat.jpg|600px|center]] | [[File:CoreUSB_Sensorhub_ Applause_heat.jpg|600px|center]] | ||
− | *Setup | + | *Setup 2: Connect the activated battery box and the BM module. |
[[File:CoreUSB_Ble_steup2.jpg|600px|center]] | [[File:CoreUSB_Ble_steup2.jpg|600px|center]] | ||
− | *Setup | + | *Setup 3: Then, stack all modules together without considering order. Congratulations! You've finished the circuit buildup. |
[[File: Applause_heat_all.jpg|600px|center]] | [[File: Applause_heat_all.jpg|600px|center]] | ||
− | * Setup | + | * Setup 4: DIY your LEGO "Grumpy Grandpa". |
[[File: _Grumpy_Grandpa.jpg|600px|center]] | [[File: _Grumpy_Grandpa.jpg|600px|center]] | ||
Latest revision as of 06:56, 30 September 2016
Language: | English • 中文 |
---|
ContentsObjectiveThe "Grumpy Grandpa" can't stand the noise. As soon as he heard big noise, the device will alarm. You can press the switch to stop the alarm. PrincipleWith MIC sound detection sensor to detect sound, when the sound exceeds the pre-et value, the device starts timing. In order to prevent interference, if the sound which keeps maintain louder than the default value after a certain period of time, then it is considered to be noise and the buzzer will alarm. At the same time, the system can detect whether the key is pressed,. When the key press, the buzzer alarm is closed. Equipment
Preparation
Program Description
#define mic_pin A0
#define buzzer_pin 6
#define key_pin 4
#define voice 400
if (voice_data > voice)
{
if (millis() - time > 500 )
{
voice_data = analogRead(mic_pin);
if (voice_data > voice)
{
buzzer_speak = true;
i = 200;
}
time = millis();
}
}
if (key_get(key_pin, 0))
{
delay(200);
buzzer_speak = false;
time = millis();
}
if (buzzer_speak)
buzzer();
else
noTone(buzzer_pin); Hardware Buildup
ResultShouting towards the sound detector and keep that for a while, the buzzer will make alarm. By pressing the key, the alarm will stop. Video |