Automating household or office systems can be achieved using an Arduino Nano, a passive infrared (PIR) motion sensor, and a relay.
The primary aim is to create a control system that activates or deactivates electrical devices in response to human movement, enhancing convenience and energy efficiency.
The core component, the Arduino Nano, is a compact, versatile microcontroller board that processes signals from the PIR motion sensor. The PIR sensor detects changes in infrared radiation caused by human presence or movement within its range.
When movement is detected, the sensor sends a signal to the Arduino Nano, which processes the input and triggers the relay. Fig. 1 displays the prototype.
The relay functions as an intermediary switch, controlling connected devices based on commands from the Arduino. This configuration enables the system to turn on lights when a person enters a room and switch them off after a set period of inactivity, thus optimising energy usage and user convenience.
Bill of Materials | |
Components | Quantity |
Arduino Nano (MOD1) | 1 |
PIR sensor (S1) | 1 |
230V AC to 9V, 250mA secondary transformer (U1) | 1 |
5V voltage regulator 7805CV (IC1) | 1 |
Ceramic disc capacitor 100nF (C1) | 1 |
Electrolyte capacitor 1000µF, 40V (C2) | 1 |
5mm LED (red, green colour) | 2 |
Resistors 330 ohm (R1, R2) | 2 |
5V SPST relay (RLY 1) | 1 |
5V DC adaptor (optional) | 1 |
230V AC 60W bulb (as a load for testing) | 1 |
Arduino Motion Sensor – Circuit and Working
The circuit diagram of the automation device using a motion sensor is shown in Fig. 2. It consists of an Arduino Nano board (MOD1), a PIR sensor (S1), a 230V AC to 9V secondary transformer (U1), a bridge rectifier, a 5V voltage regulator 7805CV, IC1 and other essential components.
A ready-made 5V adaptor can alternatively be used instead of the transformer, bridge rectifier, and voltage regulator.
The device operates on a 5V DC supply, with capacitors C1 and C2 filtering any ripples.
The Arduino Nano serves as the controller. The PIR motion sensor detects human movement and transmits data to the Arduino. The PIR sensor has three pins: VCC, GND, and OUT.
A 5V single-pole, double-throw (SPDT) relay used to control the load (230V AC, 60W bulb) acts as a switch. The 5V power supply is connected to the 5V (Vin) and GND pins of the Arduino Nano to enable the circuit.
The VCC and GND are shared by the Arduino Nano, the PIR sensor module, and the relay, as illustrated in Fig. 2.
The OUT pin of the PIR sensor connects to digital pin 10 (D10) on the Arduino Nano. Pin 9 (D9) connects to the base of the relay driver transistor BC547 through resistor R2 and LED1.
The Arduino Nano processes inputs from the PIR motion sensor. When motion is detected, the sensor signals the Arduino Nano, which triggers the relay and activates the bulb. The relay acts as a switch to enable or disable the connected 230V AC, 60W bulb according to the motion sensor’s input.
The Arduino software platform is used to develop the source code. The code defines the motion sensor and relay pins, setting one as input and the other as output. The loop continuously checks for motion, and when detected, the Arduino Nano signals the relay to turn on. Fig. 3 shows a code snippet.
Also Check: Awesome Arduino Projects for Engineers and Beginners
Construction and Testing
Assemble the circuit on a general-purpose PCB and connect the secondary side of the transformer across the input connector (U1).
Once the components are connected as per the circuit diagram, the device should be installed in a suitable location to ensure that the PIR motion sensor can detect human movement at the main entrance.
Connect the 230V AC, 60W bulb across the output connector (U2) as the test device. Any electrical appliance may be used in place of the bulb to test.
After assembling, enclose the system in a cabinet for protection and proper installation. Once installed, the device can be powered and is ready for use. The primary aim of this device is to automate the control of home appliances and save energy.
Dr Latif Khan is an assistant professor, while Yogesh Kumar Jatav, B.Tech, is a design engineer (CII) at Geetanjali Institute of Technical Studies, Udaipur.