In this tutorial, we will see how we can interface HC-SR501 PIR motion sensor with ARIES V2 board. Passive Infrared (PIR) Sensors are small, inexpensive low power sensors used to sense motion. They detect whenever an object moves out of the sensor’s range. They are made of pyro-electric sensor which can detect levels of infrared radiations by converting change in temperature caused by radiations to electric signals.

HC-SR501 PIR Sensor

Every objects emits some level of radiations (living or non living). The sensor in PIR consists of two IR Sensitive Slots. When sensor is in idle state, the slots sense same amount of radiation. When there is a movement in the sensors range, there is difference in the amount of radiations between two slots. Based on these differential output, motion is detected.

Circuit Diagram

The HC-SR501 has three pins: VCC, Digital Out and GND. Connect VCC and GND to +5V and GND respectively (Refer HC-SR 501 datasheet). Then connect the Digital Out Pin of the PIR sensor to the GPIO0 of ARIES v2 board.

Now, for powering up the ARIES v2 board via USB port of a Laptop/Desktop/PC and burning the code into the ARIES v2 board, we have to use a micro USB type B to USB type A cable. The cable should be connected to UART0 port of the ARIES v2 board, and the Laptop/Desktop/PC should be preinstalled with VEGA SDK and Toolchain.

HC-SR501 ARIES V2 board
VCC+3.3V
OUTGPIO0
GNDGND
Connection pins of HC-SR501 Module with Aries v2.0 Board

Procedure

After setting up the toolchain and SDK path environments, clean the executable using make clean command.

cd examples/gpio/PIR_motion_sensor
make clean

Build the example program for PIR motion sensor by using make command

make 

Before transferring the built program to board, ensure that you have connected the UART0 connector of the board to the PC.

Open a new terminal, execute the following command

sudo minicom aries

Now you can see the minicom terminal opened and the board UART terminal is ready.

Use CTRL+A S to enter file sending menu and select xmodem by pressing Enter.

In the next window, with Space bar select the pir_pgm.bin file to be transferred. By pressing Enter, transfer process starts.

Wait until the process is completed. The screen should display how much data has been transferred.

After completing transfer the Program will start to execute.

“motion detected” is displayed in minicom UART terminal when movement is detected in the vicinity of the sensor.

Leave a Reply

Your email address will not be published. Required fields are marked *