In this tutorial, you will learn how to build an infrared remote-controlled door lock system using Arduino. Instead of RFID cards or keypads, this version uses an IR remote transmitter to unlock a solenoid door lock wirelessly.
This project demonstrates an important real-world embedded system concept: wireless command decoding and actuator control.
By completing this project, you will learn how to:
Advantages of IR door locks:
Push Button → IR Transmitter → IR Receiver → Arduino → Relay → Solenoid Lock
When the correct IR code is received, the Arduino activates a relay that powers the solenoid lock.
This method improves usability and reduces mechanical wear.
In this project we use the NEC IR protocol, which sends a unique 32-bit code for each button press.
The IR receiver filters out ambient light and detects only signals at this frequency, which makes the system reliable indoors.
A solenoid lock requires 12V and high current, which Arduino cannot provide directly.
This project demonstrates an important real-world embedded system concept: wireless command decoding and actuator control.
By completing this project, you will learn how to:
- Send IR signals using an Arduino-based remote
- Decode IR signals using an IR receiver
- Control a relay and solenoid door lock
- Implement a simple wireless security system
Why Use IR for a Door Lock?
There are many ways to build electronic door locks such as RFID cards, keypads, Bluetooth, and WiFi. Infrared control offers a simple and low-cost alternative.Advantages of IR door locks:
- Very inexpensive components
- Easy to program and debug
- No internet required
- Ideal for indoor security systems
- Works even without smartphones or apps
- Requires line-of-sight
- Short operating range (typically 3-6 meters)
Watch Project Overview
How the System Works
This project uses two Arduino boards:- Transmitter Unit (Remote) → Sends IR signal when a button is pressed
- Receiver Unit (Door Lock Controller) → Receives signal and unlocks the door
Push Button → IR Transmitter → IR Receiver → Arduino → Relay → Solenoid Lock
When the correct IR code is received, the Arduino activates a relay that powers the solenoid lock.
How the Toggle Lock Mechanism Works
Instead of unlocking only for a few seconds, this version uses a toggle system:- First press → Unlock door
- Second press → Lock door
This method improves usability and reduces mechanical wear.
Components Required
- Arduino Uno (Receiver)
- Arduino Nano (IR Remote)
- IR Transmitter Module (KY-005)
- IR Receiver Module (KY-022)
- Push button
- 220Ω Resistor
- 5V Relay Module
- 12V Solenoid Door Lock
- 12V Power Adapter
- Breadboards and Jumper wires
Understanding Infrared Communication
Infrared communication works by transmitting pulses at a carrier frequency of 38 kHz. These pulses are invisible to the human eye but can be detected by IR receiver modules.In this project we use the NEC IR protocol, which sends a unique 32-bit code for each button press.
The IR receiver filters out ambient light and detects only signals at this frequency, which makes the system reliable indoors.
Each button press sends a unique HEX code, which acts like a digital password. The Arduino reads this code and decides whether to unlock the door.
Project Architecture
Transmitter (Remote Unit)
- Push button pressed
- Arduino sends IR signal using IR LED
Receiver (Door Lock Unit)
- IR receiver detects signal
- Arduino verifies the code
- Relay powers the solenoid lock
Why We Use a Relay
The Arduino operates at low voltage (5V) and can supply only a small amount of current.A solenoid lock requires 12V and high current, which Arduino cannot provide directly.
The relay acts as an electrically controlled switch:
12V Adapter → Relay → Solenoid Lock
Safety Note: The relay isolates the Arduino from the high-current solenoid.
Sketch → Include Library → Manage Libraries
Search and install: IRremote by Ken Shirriff
File → Examples → IRremote → IRrecvDump
Open Serial Monitor and press the remote button.
Write down the HEX IR code displayed.
This code acts as your digital key.
Open your camera and point it at the IR LED while pressing the button.
If you see purple light, the transmitter works.
You learned how to:
- Arduino controls the relay
- Relay controls the high-power solenoid
Wiring
Receiver Circuit (Door Lock)
IR Receiver Connections (KY-022)
- S - D11
- (+) - 5V
- (-) - GND
Relay Module Connections
- S - D6
- (+) - 5V
- (-) - GND
Solenoid Lock Connections
Relay acts as a switch for the 12V lock.12V Adapter → Relay → Solenoid Lock
Safety Note: The relay isolates the Arduino from the high-current solenoid.
Transmitter Circuit (IR Remote)
IR Transmitter Module (KY-005)
- S - D3
- (+) - 5V
- (-) - GND
Push Button Connection
- One side - D2
- Other side - GND
Power Supply Design
This project uses two different power sources:
- Arduino Boards - 5V
- Relay Module - 5V
- Solenoid Lock - 12V
All GND connections must be common. This is a very important concept in electronics called common ground reference.
Step 01: Install IRremote Library
Open Arduino IDE:Sketch → Include Library → Manage Libraries
Search and install: IRremote by Ken Shirriff
Step 02: Find your IR Code
Upload example:File → Examples → IRremote → IRrecvDump
Open Serial Monitor and press the remote button.
Write down the HEX IR code displayed.
This code acts as your digital key.
Step 03: Receiver Program Logic
The receiver program must:
- Wait for IR signal
- Decode received code
- Compare with stored code
- Toggle relay state
If received code == stored code
Toggle door lock
Else
Ignore signal
We toggle using:
value = 1 - value
This flips between ON and OFF states.
Step 04: Transmitter Program Logic
The transmitter program must:- Detect button press
- Send IR code using NEC protocol
- Wait 40ms before next transmission
Testing the IR Transmitter
Infrared light is invisible, but your phone camera can detect it.Open your camera and point it at the IR LED while pressing the button.
If you see purple light, the transmitter works.
Testing the Door Lock
- Power Arduino receiver
- Power 12V solenoid supply
- Press remote button
- Relay should click and unlock the door
Troubleshooting Guide
IR Receiver Not Detecting Signals
- Check pin D11
- Confirm correct IR library installed
- Verify baud rate in Serial Monitor
Relay Not Activating
- Check D6 connection
- Ensure relay module has 5V power
Solenoid Not Working
- Verify 12V adapter
- Confirm relay wiring
Safety Notes
- Solenoid locks draw high current
- Never power from Arduino 5V
- Always use external 12V supply
- Double-check wiring before powering
Conclusion
In this tutorial, you built a complete wireless door lock system using infrared communication and Arduino.You learned how to:
- Transmit and decode IR signals
- Implement basic authentication logic
- Interface relays with high-power devices
- Build a practical home security project






Comments
Post a Comment