Raspberry Pi Project #4 - Making an Alarm Circuit Using Raspberry Pi and Relay Module
In this project, an alarm circuit will be made using a motion detector and a relay module to trigger the Raspberry Pi boards.
How Does a Relay Work?
When a relay module receives a logic 0 signal (0 V) from the “IN” pin, the NO and COM terminals complete the circuit. If it is desired to use it in reverse, the NC (normally closed) terminal would be used instead of the NO (normally open) terminal. Relays can be used in High Voltage AC mains voltage. However, someone who does not have enough knowledge about relays should be careful.
Raspberry Pi Motion Sensitive Relay Module Wiring Diagram
Raspberry Pi Motion Sensitive Relay Module Python Code
import RPi.GPIO as io
pir_pin = 24
power_pin = 23
Thanks to this code, the PIR sensor triggers the relay after detecting any motion and stays open for 20 seconds. Later, the relay closes, and after 5 seconds, this loop starts again. This simple motion detector can be used as a security system by connecting the output of the relay to an alarm or video recorder, etc.
Keep Learning More about Raspberry Pi
Raspberry Pi is a platform with many advantages and is admired by other developers. With the support and convenience in electronic projects, computer science, and robotics studies, Raspberry Pi makes learning enjoyable, and this module is developing day by day. Don’t you also want to improve further? We take you on a journey with Raspberry Pi to improve your Linux knowledge, dive into the electronics world, and carry out fun projects. Keep following the Raspberry Pi training series that has been prepared for you.