Difference between revisions of "Sensor-PIR"

From Microduino Wiki
Jump to: navigation, search
(Document)
(Development)
Line 50: Line 50:
  
 
==Development==
 
==Development==
===Equipment===
+
===Program Download===
{|class="wikitable"
+
*Download and unzip the program '''[[File:Sensor-PIR_Test.zip]]'''
|-
 
|Module||Number||Function
 
|-
 
|[[mCookie-CoreUSB]]||1||Core board
 
|-
 
|[[mCookie-Hub]]||1||Sensor pin board
 
|-
 
|[[Microduino-PIR]]||1||Pyroelectric infrared sensor
 
|}
 
  
*Other hardware equipment
+
===Programming===
**One USB cable
+
{{Upload
[[File:Passive Infrared.jpg|600px|center]]
+
|nameA=[[Microduino-Core]], [[Microduino-USBTTL]]
 +
|nameB=[[Microduino-USBTTL]]
 +
|boardName=Microduino/mCookie-Core(328p), Atmega328P@16M,5V
 +
|fileName=Sensor-PIR Test.ino
 +
}}
  
===Preparation===
+
===Hardware Setup===
*Setup 1: Connect the PIR to the D6 of the Hub.
+
*Referring to the following diagram, connect the Sensor-PIR to the digital pin D6 of '''[[Microduino-Sensorhub]]'''.
[[file:mCookie-Passive Infrared-sensor.JPG|600px|center]]
+
<br>
*Setup 2: Assemble the CoreUSB, Hub and the PIR together, then connect them to the computer.
+
[[file:Microduino-sensorhub_Crash.JPG|thumb|400px|left]]
[[file:mCookie-pir-pc.JPG|600px|center]]
+
<br style="clear: left"/>
  
===Experiment: Detect If there is person moving ===
+
===Result===
*Open Arduino IDE and copy the following codes into IDE.
+
*After download, open the serial monitor.  
<source lang="cpp">
+
*The static sensor signal is LOW. After detect the IR emitted by living things within measurement range, it changes into HIGH.
#define  sensorPin  6
 
 
 
int state;
 
 
 
void setup()
 
{
 
  pinMode(sensorPin, INPUT);
 
  Serial.begin(9600);
 
}
 
void loop()
 
{
 
  state = digitalRead(sensorPin);
 
  if (state == 1)
 
    Serial.println("Somebody is in this area!");
 
  else
 
    Serial.println("No one!");
 
  delay(500);
 
}
 
</source>
 
*Select the right port in (Tools)→(Serial Port)under Arduino IDE.
 
[[file:upload.JPG|600px|center]]
 
*Compile and then download the program. 
 
[[file:upload-pir.JPG|600px|center]]
 
*After the download, you can open the serial monitor. The displayed notice reflects the status detected by the current sensor.
 
[[file:mCookie-pir-res.JPG|600px|center]]
 
*Result
 
When the PIR is detecting the moving persons, it'll output high level in the output pin, which is 5V. And when it detected the PIR signal gone, it'll output low level(0V) after 2.3-3s delay. Therefore, we can according to that to establish a moving person detection project according to that. 
 
 
 
===Program Debugging===
 
*"#define  sensorPin  6" defines sensor interface.   
 
*Use "" digitalRead(sensorPin); to read sensor change and to judge if there is moving human body.
 
  
 
==Application==
 
==Application==

Revision as of 08:59, 10 November 2016

Language: English  • 中文
Sensor-PIR

The product number of Sensor-PIR is: MSDI51

Sensor-PIR is a pyroelectric infrared sensor that can detect infrared rays sent from moving human body or animals. It can output switch signals and be used in various occasions that need to detect moving human body.


Introduction of Pins

Sensor backpin.png
  • Pins of the sensor:
    • PIN1: GND
    • PIN2: VCC
    • General signal pins:
      • PIN3(IO1): digital/analog signal
      • PIN4(IO2): NC(null)
    • Special signal pins:
      • If it is IIC: IO1/IO2 are respectively SDA/SCL.
      • If it is soft serial port: IO1/IO2 are respectively tx/rx.
  • Special to Sensor-PIR sensor pins
    • PIN1: GND
    • PIN2: VCC
    • PIN3(IO1): Digital read
    • PIN4(IO2): NC


Microduino sensor can communicate with core module through the connection with Microduino-Module Sensor Hub.


Features

  • Adopt digital integrated pyroelectric infrared probe AM412.
  • With high precision and sensitivity.
  • Low power consumption, long service life and good stability.
  • Digital signals
  • Small size and easy to install.

Specification

  • Voltage
    • 3.3V~5V working voltage
  • Electrical specification
    • Working current: 15uA
    • Working temperature: -20~85℃
    • Output voltage: high level 5V, low level 0V
  • Size
    • Size of the board: 23.5mm*13mm
    • 1.27mm-spacing 4Pin itnerface connected to sensorhub
    • The CAD drawing of the sensor: File:Sensor CAD.zip
  • Technical parameters
    • Output delay(high level): about 2.3~3s
    • Induction angle: 100°
    • Induction distance: 7m
  • Connection
    • This sensor can be connected to the following interfaces of core: D2~D13,A0~A7

Document

Development

Program Download

Programming

  • Follow the Software Getting Started Guide.
  • Select the Board, Processor and Port.
  • Click [File]->[Open], browse to the project program address, and click "Sensor-PIR Test.ino" to open the program.
  • After confirming all these items are correct, click "→" to download the program to the development board.

Hardware Setup

  • Referring to the following diagram, connect the Sensor-PIR to the digital pin D6 of Microduino-Sensorhub.


Microduino-sensorhub Crash.JPG


Result

  • After download, open the serial monitor.
  • The static sensor signal is LOW. After detect the IR emitted by living things within measurement range, it changes into HIGH.

Application

  • Intrusion alarm
  • Non-contact infrared automatic switch


Project

Purchase

History

Image

  • Front
File:Microduino-Passive Infrared-F.JPG
Microduino-Passive Infrared Front
  • Back
File:Microduino-Passive Infrared-b.JPG
Microduino-Passive Infrared Back