Applause Enthusiasm Detection

From Microduino Wiki
Jump to: navigation, search
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 Baterry management
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