Skip to content

DIY IR Sensor 1 1

Powerful DIY IR Sensor with Relay for Smart in 3 Easy Steps

If you’re looking for a beginner-friendly electronics project, building a DIY IR sensor with a 5V relay is a great choice. This step-by-step guide shows how to assemble a DIY IR using an HW-201 IR proximity sensor, a 5V relay module, and a simple 5V power supply. You’ll learn how the DIY IR sensor detects objects, how the relay activates connected loads, and how to wire it correctly for reliable performance. With our instructions, anyone can create a DIY IR sensor that controls lights, fans, or alarms automatically. Whether you want a home automation upgrade or a simple object detection system, this DIY IR project is affordable and effective. Follow along to build your own DIY IR today.


Introduction.

When I first started experimenting with automation circuits over 10 years ago, one of the simplest yet most useful projects I built was a DIY IR sensor with a relay. It’s small, inexpensive, and can control anything from a table lamp to a security siren—all triggered by the wave of your hand or the movement of an object.

In this guide, I’ll walk you through creating your own using an HW-201 IR proximity sensor, a 5V relay module, and a few jumper wires. No programming is required—it’s pure plug-and-play electronics.


Materials for the Project

No.ComponentSpecificationQuantityClick & Buy
1HW-201 IR Proximity Sensor3.3V–5V, adjustable1Click & Buy
25V Relay Module1-Channel, 10A1Click & Buy
35V Power SupplyDC Adapter or USB1Click & Buy
4Jumper WiresMale-to-Male/Female4–6Click & Buy
5Load Device (Light/Fan/Alarm)AC or DC load1Click & Buy
6Breadboard (optional)830 tie points1Click & Buy

Useful Tools 

ToolQuantityPurpose / NotesClick & Buy
Soldering Iron Kit1For making permanent connectionsClick & Buy
Solder Wire (60/40, 0.8mm)1Electrical solderingClick & Buy
Wire Stripper & Cutter1Stripping jumper wiresClick & Buy
Mini Screwdriver Set1For module and relay terminal screwsClick & Buy
Multimeter1Testing voltages and continuityClick & Buy
Hot Glue Gun (optional)1Securing components in placeClick & Buy
Small Pliers1Holding and bending wiresClick & Buy
Heat Shrink Tubing Set1Insulating exposed wiresClick & Buy

Understanding the DIY IR Sensor with Relay

An IR sensor detects objects based on reflected infrared light. The HW-201 IR module emits infrared light via an IR LED and detects the reflection with a photodiode. When something comes close, the sensor’s output changes state, which we use to trigger a relay.

The relay acts as an electronic switch, controlling high-power devices while isolating them from the low-voltage control circuit.


Key Features of the HW-201 IR Proximity Sensor

  • Detection Range: Adjustable from ~2cm to ~30cm.

  • Operating Voltage: 3.3V to 5V.

  • Adjustable Sensitivity: Onboard potentiometer.

  • Output Type: Digital (HIGH/LOW).


Applications of This Project

  • Automatic light switching in hallways or cupboards.

  • Touchless control for fans or pumps.

  • The security alarm triggers when someone approaches.

  • Counting systems for objects on a conveyor.


Download Circuit Diagram

DIY IR Sensor


Circuit Diagram Explanation

Connections:

  1. HW-201 IR Sensor

    • VCC → 5V power supply

    • GND → Ground

    • OUT → Relay module IN pin

  2. Relay Module

    • VCC → 5V power supply

    • GND → Ground

    • IN → From IR sensor output

    • COM & NO → Series connection to load and power source

Working:

  • When an object is detected, HW-201 sends a HIGH or LOW signal (depending on configuration) to the relay.

  • The relay energizes and closes the circuit for the connected load.

  • The load turns ON automatically without manual switching.


Step-by-Step Build Guide

Step 1 – Preparing the Components

  • Gather the HW-201 IR sensor, 5V relay module, jumper wires, and power supply.

  • Optionally, use a breadboard for prototyping.

Step 2 – Wiring the IR Sensor to Relay

  • Connect HW-201 OUTRelay IN.

  • Connect power and ground pins for both modules.

Step 3 – Connecting the Load

  • Wire your AC or DC device in series with the COM and NO contacts of the relay.

  • Ensure relay ratings match your load voltage and current.

Step 4 – Testing the Setup

  • Power up the system.

  • Move your hand or an object in front of the IR sensor.

  • Listen for the relay click and observe the load turning ON.


Pro Tips for Reliable Operation

  • Adjust the potentiometer to fine-tune detection distance.

  • Use a stable 5V supply for consistent performance.

  • If using AC loads, ensure all wiring is insulated for safety.


FAQs

Q1: Can I increase the detection range beyond 30 cm?
Not with the HW-201—for longer range, use an ultrasonic sensor.

Q2: Can I use this outdoors?
Yes, but place the sensor in a weatherproof enclosure.

Q3: Will sunlight affect detection?
Yes, direct sunlight can cause false triggers; use IR filters or shade.

Q4: Can this work without Arduino?
Yes, this design works standalone without any microcontroller.

Q5: Can I use a 12V relay instead of 5V?
Yes, but match it with a 12V power supply and adjust wiring accordingly.

Leave a Reply

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