1. Introduction
2. SENSOR-MODULE/EXPANSION BOARD PINOUT DIAGRAM
2.1. Hardware Introduction
2.1.1. Arduino UNO R3

Features
ATMega328P Processor
Memory
+ AVR CPU at up to 16 MHz
+ 32KB Flash
+ 2KB SRAM
+ 1KB EEPROM
Security
+ Power On Reset (POR)
+ Brown Out Detection (BOD)
Peripherals
+ 2x 8-bit Timer/Counter with a dedicated period register and compare channels
+ 1x 16-bit Timer/Counter with a dedicated period register, input capture and compare channels
+ 1x USART with fractional baud rate generator and start-of-frame detection
+ 1x controller/peripheral Serial Peripheral Interface (SPI)
+ 1x Dual mode controller/peripheral I2C
+ 1x Analog Comparator (AC) with a scalable reference input
+ Watchdog Timer with separate on-chip oscillator
+ Six PWM channels
+ Interrupt and wake-up on pin change
Power


2.1.2. Motion sensor
Types of motion sensors:
Passive infrared (PIR)

Microwave (MW)
This type of sensor sends out microwave pulses and measures the reflections off of moving objects.1 They cover a larger area than infrared sensors but are more expensive and vulnerable to electrical interference.

Dual technology motion sensors
Some motion sensors can combine multiple detection methods in an attempt to reduce false alarms. For example, it’s not uncommon for a dual technology sensor to combine a passive infrared (PIR) sensor with a microwave sensor.

Specification:
+ Voltage: 5V – 20V
+ Power Consumption: 65mA
+ TTL output: 3.3V, 0V
+ Delay time: Adjustable (.3->5min)
+ Lock time: 0.2 sec
+ Trigger methods: L – disable repeat trigger, H enable repeat trigger
+ Sensing range: less than 120 degree, within 7 meters
+ Temperature: – 15 ~ +70
+ Dimension: 32*24 mm, distance between screw 28mm, M2, Lens dimension in
2.1.3. Module relay

Specification:
+ On-board EL817 photoelectric coupler with photoelectric isolating antiinterference ability strong
+ On-board 5V, 10A / 250VAC, 10A / 30VDC relays
+ Relay long life can absorb 100000 times in a row
+ Module can be directly and MCU I/O link, with the output signal indicator
+ Module with diode current protection, short response time

2.2. How to connect




Source code:

#include <Arduino.h>
#define PIN_PIR 7
#define PIN_RELAY 2
void setup()
{
Serial.begin(115200);
pinMode(PIN_PIR,INPUT); // set pin 7 input
pinMode(PIN_RELAY,OUTPUT); // set pin 2 output
digitalWrite(PIN_RELAY,LOW); // turn off relay
}
void loop()
{
if (digitalRead(PIN_PIR) == true)
{
Serial.println(“have motion”);
digitalWrite(PIN_RELAY,HIGH);
delay(5000); // turn on light 5s
digitalWrite(PIN_RELAY,LOW);
}
}