In this tutorial we will be using an PIR motion sensor. We are going to program our Surilli with a very basic program for motion detection. In this program, whenever a motion is detected, it sends a digital value “1” to Surilli, and when no motion is detected the digital value remains “0."
A PIR-based motion detector is used to sense movement of people, animals, or other objects. They are commonly used in burglar alarms and automatically-activated lighting systems.Passive infrared motion detectors (PIR) detect emitted infrared energy – given off by humans and animals in the form of heat.When there is a sudden increase in infrared energy, a digital value is given by sensor.In this case, When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body like a human or animal passes by, it first intercepts one half of the PIR sensor, which causes a positive differential change between the two halves.
Make sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if every thing is working fine).
The circuitry is very simple. It's mostly the programming. Follow Figure 1 to set up your hardware.
- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
- After it is uploaded, the PIR Motion sensor will start detecting motion.
Play with the program to see how it reacts to different values and logic. This will develop your understanding about motion sensors so you can use them in your practical application.
Note: Builtin LED of Surilli is inverted, means when value is zero, it will be turned ON and vice versa.
If you make something fun and interesting do share it with our community :)
That’s all for now. If you have any queries, visit surilli.io or contact our support.
Stay connected with Surilli family for more amazing stuff :-)