Screaming Monster

From Microduino Wiki
Revision as of 07:21, 30 October 2015 by 1304410487@qq.com (talk) (Created page with "{{Language| Screaming Monster }} {| style="width: 800px;" |- | ==Objective== This project can detect human movement. When someone passes by, it'll send out monster scream. ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Language: English  • 中文

Objective

This project can detect human movement. When someone passes by, it'll send out monster scream.

Principle

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pin board
Microduino-TOUCH 1 Touch sensor
Microduino-PIR 1 Infrared pyroelectric sensor
Microduino-Audio 1 Audio module
Microduino-Amplifier 1 Audio power amplifier
Microduino-BM 1 Battery management

Hardware Buildup

  • Setup 1:Connect the CoreUSB to the computer, open the program examples, select the right board and serial monitor, and then download the program.
  • Setup2:Connect the Touch sensor to Sensorhub D6 and the PIR to D10.
Microduino-sensorhub rule.JPG
  • Setup3:Connect the battery with BM.

Software Debugging

Code Description

  • Define the Control Pin
#define humanHotSensor 10
#define buttonPin 6
  • Detect human infrared and play audio.
void pirDetector() {
  // read the input pin:
  humanHotState = digitalRead(humanHotSensor);
  // print out the state of the button:
  //Serial.println(humanHotState);
  delay(1);        // delay in between reads for stability
  if(humanHotState) {
      Serial.println("play sound.....");
      audio_choose(1);// 2:health,1:noHealth
      audio_play();
  }
}
  • Judge if some touch the button.
void updateButton() {
  if(key_get(buttonPin,0)) {
    delay(200);
    on_off=!on_off;
  }
  if(statusChange!=on_off) {
    statusChange=on_off;
    if(on_off) {
      Serial.println("pause");
      audio_pause();
    } 
    else {
      Serial.println("pause");
      audio_pause();
    }
  }
}

Program

[MicroduinoSkreech]

Result

It can detect human movement. When someone passes by, it'll scream. By touching the button, it will stop screaming.

Video