Difference between revisions of "Applause Enthusiasm Detection"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{{Language|Applause Enthusiasm Detectio}} {| style="width: 800px;" |- | ==Objective== Here we’ll detect applause. The louder it gets, the brighter the light turns. When the ...")
 
Line 1: Line 1:
{{Language|Applause Enthusiasm Detectio}}
+
{{Language| Applause Sound Detector }}
 
{| style="width: 800px;"
 
{| style="width: 800px;"
 
|-
 
|-
 
|
 
|
 
==Objective==
 
==Objective==
Here we’ll detect applause. The louder it gets, the brighter the light turns. When the brightness gets to the most, the buzzer will give an alarm.
+
Detection of applause: The longer the sound duration lasts, the stronger the light becomes. When the light gets to the brightest, the buzzer gives an alarm.  
 +
[[File: Applause_heat.jpg|600px|center]]
 +
 
 
==Principle==
 
==Principle==
 +
With MIC sound detection sensor to detect the applause sound, when the sound is louder than the pre-set sound value, the device starts counting, the longer the time gets, the greater the data becomes while the color of the lights are becoming brighter. When it reaches a certain value, the brightness of the light turns to the maximum and at the same time, the buzzer starts giving an alarm. The system detects sound every three seconds. When there is no sound, the light and the alarm will stop.
 +
[[File: Applause_heat-sch.jpg|600px|center]]
  
 
==Equipment==
 
==Equipment==
Line 16: Line 20:
 
|[[Microduino-Sensorhub]]||1||Sensor pinboard   
 
|[[Microduino-Sensorhub]]||1||Sensor pinboard   
 
|-
 
|-
|[[Microduino-Mic]]||1||Sound detection sensor   
+
|[[Microduino-Sound]]||1||Sound detection sensor   
 
|-
 
|-
|[[Microduino-Lamp]]||1||led sensor   
+
|[[Microduino-Color LED]]||1||LED sensor   
 
|-
 
|-
|[[Microduino-BUZZER]]||1||Buzzer sensor  
+
|[[Microduino-Buzzer]]||1||Buzzer sensor  
 
|-
 
|-
| [[Microduino-BM]]||1||Batery management  
+
| [[Microduino-BM]]||1||Batery management |}
|}
+
[[File: Applause_heat_module.jpg|600px|center]]
  
[[File: Applause_heat.jpg|600px|center|thumb]]
+
==Preparation==
 +
*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]]
 +
*Setup 2: Download program and open IDE, or copy the program to:
 +
[https://github.com/Microduino/Microduino_Tutorials/tree/master/MCookie_Tutorial/Applause_heat Applause_heat]
 +
[[File: Applause_heat_ino.jpg|600px|center]]
 +
* Setup 3: Load the code, choose the right board and COM port for program download after compiling.
  
==Hardware Buildup==
+
==Program Description ==
*Setup 1:Connect CoreUSB to your PC, open program example, choose the right board fand download program via the serial port.
+
*Control pin definition: Connect the Color LED to D4, MIC sound sensor to A0 and the Buzzer to 6. Users can customize the pin definition.  
 
 
[[File:Applause_heat_setup_1.jpg|600px|center|thumb]]
 
*Setup2:Connect MIC to the A0 pin of Sensorhub, buzzer to D6 and the led light to D4.
 
[[file:Microduino-sensorhub_rule.JPG|thumb|800px|center]]
 
[[file: Applause_heat_sensor.JPG|thumb|800px|center]]
 
*Setup6:Connect battery to BM.
 
[[file: Applause_heat _bm.JPG|thumb|800px|center]]
 
 
 
==Software Debugging==
 
*Build IDE and download program code.  
 
[https://github.com/Microduino/Microduino_Tutorials/tree/master/MCookie_Tutorial/Applause_heat Applause_heat]
 
Code description
 
*Control pin description 
 
 
<source lang="cpp">
 
<source lang="cpp">
 
#define PIN 4
 
#define PIN 4
Line 50: Line 47:
 
#define buzzer_pin 6
 
#define buzzer_pin 6
 
</source>
 
</source>
 
+
*Sound pre-set value: The outside sound larger than the value will be considered as noise. Users can customize the pre-set value based on personal needs.  
*Sound pre-set value   
 
 
<source lang="cpp">
 
<source lang="cpp">
 
   #define voice 400
 
   #define voice 400
 
</source>
 
</source>
*If the sound is louder than the pre-set value, the lamp will get brighter and when it reaches to a certain value, the buzzer will go off.   
+
*When the sound value is larger than the pre-set value, the light will get brighter and brighter, and when it reaches to the maximum, the buzzer will make alarm. Users can change the value of "225" and see what happens.   
 
<source lang="cpp">
 
<source lang="cpp">
 
   if (voice_data > voice)
 
   if (voice_data > voice)
Line 71: Line 67:
 
   }
 
   }
 
</source>
 
</source>
 +
*Time 3s to detect if the sound is noise. If not, the light and the alarm will stop. 
 +
<source lang="cpp">
 +
  if (millis() - time > 3000 )
 +
  {
 +
    voice_data = analogRead(mic_pin);
 +
    if (voice_data < voice)
 +
    {
 +
      colorWipe(strip.Color(0, 0, 0));
 +
      num = 10;
 +
      noTone(buzzer_pin);
 +
    }
 +
    time = millis();
 +
  }
 +
</source>
 +
 +
==Hardware Buildup==
 +
*Setup 1:Connect the Buzzer to the Sensorhub D6, the Color LED to D4, and the Sound sensor to A0. 
 +
[[File:CoreUSB_Applause_heat.jpg|600px|center]]
 +
*Setup 2:Connect the activated battery box and the BM module.
 +
[[File:CoreUSB_Ble_steup2.jpg|600px|center]]
 +
*Setup 3:Then, stack all modules together without considering order. Congratulations! You've finished the circuit buildup.
 +
[[File: CoreUSB_Applause_heat_all.jpg|600px|center]]
 +
* Setup 4:DIY your LEGO Applause Enthusiasm Detector .
 +
[[File: CoreUSB_Applause_heat_over.jpg|600px|center]]
 +
If modules cannot work normally, please try to power off and re-connect.
 +
[[File: Applause_heat_over1.jpg|600px|center]]
  
 
==Result==
 
==Result==
The louder the applause gets, the brighter the lamp becomes. When it reaches to the brightest, the buzzer will give an alarm. When the sound gets below the pre-set value after that, it will take three seconds and then turn off the light and the buzzer. (You can achieve a beautiful frame with LEGO.)
+
The greater the applause sound is, the brighter the LED light gets. when the light gets to the brightest, the Buzzer will give an alarm. When the sound is below the pre-set value and lasts for three seconds, the light and the alarm will stop. You can also build a beautiful shell with LEGO boards since mCookie can be freely stacked with LEGO boards.  
 
 
 
==Video==
 
==Video==
  
 
|}
 
|}

Revision as of 04:02, 6 November 2015

Language: English  • 中文

Objective

Detection of applause: The longer the sound duration lasts, the stronger the light becomes. When the light gets to the brightest, the buzzer gives an alarm.

Principle

With MIC sound detection sensor to detect the applause sound, when the sound is louder than the pre-set sound value, the device starts counting, the longer the time gets, the greater the data becomes while the color of the lights are becoming brighter. When it reaches a certain value, the brightness of the light turns to the maximum and at the same time, the buzzer starts giving an alarm. The system detects sound every three seconds. When there is no sound, the light and the alarm will stop.

Applause heat-sch.jpg

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pinboard
Microduino-Sound 1 Sound detection sensor
Microduino-Color LED 1 LED sensor
Microduino-Buzzer 1 Buzzer sensor
Microduino-BM 1 }
Applause heat 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: Download program and open IDE, or copy the program to:

Applause_heat

  • Setup 3: Load the code, choose the right board and COM port for program download after compiling.

Program Description

  • Control pin definition: Connect the Color LED to D4, MIC sound sensor to A0 and the Buzzer to 6. Users can customize the pin definition.
#define PIN 4

Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, PIN, NEO_GRB + NEO_KHZ800);

#define mic_pin A0
#define buzzer_pin 6
  • Sound pre-set value: The outside sound larger than the value will be considered as noise. Users can customize the pre-set value based on personal needs.
  #define voice 400
  • When the sound value is larger than the pre-set value, the light will get brighter and brighter, and when it reaches to the maximum, the buzzer will make alarm. Users can change the value of "225" and see what happens.
  if (voice_data > voice)
  {
    num++;
    if (num > 255)
    {
      num = 255;
      buzzer();
    }
    colorWipe(strip.Color(num, 0, 0));
    //delay(10);
    Serial.println(num);
    time = millis();
  }
  • Time 3s to detect if the sound is noise. If not, the light and the alarm will stop.
  if (millis() - time > 3000 )
  {
    voice_data = analogRead(mic_pin);
    if (voice_data < voice)
    {
      colorWipe(strip.Color(0, 0, 0));
      num = 10;
      noTone(buzzer_pin);
    }
    time = millis();
  }

Hardware Buildup

  • Setup 1:Connect the Buzzer to the Sensorhub D6, the Color LED to D4, and the Sound sensor to A0.
CoreUSB 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.
CoreUSB Applause heat all.jpg
  • Setup 4:DIY your LEGO Applause Enthusiasm Detector .

If modules cannot work normally, please try to power off and re-connect.

Result

The greater the applause sound is, the brighter the LED light gets. when the light gets to the brightest, the Buzzer will give an alarm. When the sound is below the pre-set value and lasts for three seconds, the light and the alarm will stop. You can also build a beautiful shell with LEGO boards since mCookie can be freely stacked with LEGO boards.

Video