Difference between revisions of "Noise Alarm--Grumpy Grandpa"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{{Language| Noise Alarm--Grumpy Grandpa }} {| style="width: 800px;" |- | ==Objective== The "Grumpy Grandpa" can't stand the noise. As soon as he heard big noise, the device wi...")
 
(Principle)
Line 8: Line 8:
  
 
==Principle==
 
==Principle==
With MIC sound detection sensor to detect applause 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]]

Revision as of 03:29, 6 November 2015

Language: English  • 中文

Objective

The "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.

Grumpy Grandpa.jpg

Principle

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.

Grumpy Grandpa-sch.jpg

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pinboard
Microduino-Sound 1 Sound detection sensor
Microduino-Crash 1 Crash/touch switch
Microduino-Buzzer 1 Buzzer sensor
Microduino-BM 1 Battery management
Grumpy Grandpa module.jpg

Preparation

  • Setup 1:Use a USB cable to connect the CoreUSB and the PC/Mac, the open Arduino IDE.
CoreUSB Ble pc.jpg
  • Setup 2:Click Files > Examples > mCookie > _102_Grumpy_Grandpa, load the program.
Grumpy Grandpa ino.jpg
  • Setup 3:Select the right board and COM port for program download.

Program Description

  • Control pin description: Connect the key to D4, MIC sound sensor to A0, buzzer to 6. Users can customize the pin description.
#define mic_pin A0
#define buzzer_pin 6
#define key_pin 4
  • Pre-set value of the sound: If the outside sound value is larger than the pre-set value, it'll be considered as noise. Users can customize the pre-set value.
  #define voice 400
  • The system will start timing when detecting the outside sound value is larger than the pre-set value. If the sound keeps louder after a period time of timing and gets loud enough to make the buzzer value become "True", the buzzer will make alarm.
 if (voice_data > voice)
  {
    if (millis() - time > 500 )
    {
      voice_data = analogRead(mic_pin);
      if (voice_data > voice)
      {
        buzzer_speak = true;
        i = 200;
      }
      time = millis();
    }
  }
  • Detect if the key is pressed. If the buzzer value is "False", the buzzer will be closed automatically.
  if (key_get(key_pin, 0))
  {
    delay(200);
    buzzer_speak = false;
    time = millis();
  }
  • From the buzzer value, the system can judge when to open or close the alarm.
   if (buzzer_speak)
    buzzer();
  else
    noTone(buzzer_pin);

Hardware Buildup

  • Setup 1:Connect the buzzer sensor to the Sensorhub D6, Colored LED to A0 and the touch switch to D4.
CoreUSB Sensorhub Applause heat.jpg
  • Setup 2:Connect the activated battery box and the BM module.
CoreUSB Ble steup2.jpg
  • Setup 3:Then, stack all modules together without considering order. Congratulations! You've finished the circuit buildup.
Applause heat all.jpg
  • Setup 4:DIY your LEGO "Grumpy Grandpa".
Grumpy Grandpa.jpg

Result

Shouting towards the sound detector and keep that for a while, the buzzer will make alarm. By pressing the key, the alarm will stop.

Video