PIR Detection

From Microduino Wiki
Jump to: navigation, search

Function of the Module

  • Please refer to Pyroelectric Infrared Sensor
  • As a digital input sensor, it can only detect "0" and "1", that is "Yes" and "No".
  • It'll last about 4s after detecting human body.

Overview

To use pyroelectric infrared sensor to detect if there is person moved and check data in the serial monitor.

Bill of Material

  • Module
Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-Hub 1 Sensor pin board
Microduino-PIR 1 Pyroelectric infrared sensor
  • Other Hardware Equipment
Passive Infrared.jpg


Hardware Buildup

  • Setup 1:Connect the PIR sensor with the pin 6 port of the Hub. Accessible Hub pins: 0,2,4,6,8,10 and 12.
MCookie-Passive Infrared-sensor.JPG
  • Setup 2:Connect the CoreUSB, Hub and the Sound sensor to the computer with a USB cable.

[file:mCookie-pir-pc.JPG|600px|center]]

Mixly Programming

  • Step1:Since using serial monitor, we need to find "Serial Communication" from "Communication" item.
Mixly Serial.jpg
  • Step2:"Serial Communication" description.
  • Step3:PIR sensor is an input device and the returned data is digital quantity, based on which we can find and drag out the digital input and output from "Input/Output".
  • "Analog Input" description.
  • Overall code description.

Debugging

  • Step1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
Mixly board COM.jpg
  • Step2:Open the serial monitor.
Mixly COMXX.jpg
  • Step3:Check if the serial baud rate is the same with the pre-set one.
Mixly COMXX ok.jpg
  • Step4:Check the data: When there is human around it, the data is "1" and the status will keep about 4s.