Tutorials
Remote Controlled Bulb
Have you ever imagined switching your light ON and OFF with your TV remote?
In this project, we’ll turn that idea into reality by building a remote-controlled bulb using an Arduino, an infrared (IR) receiver, and a relay module.
It’s a simple and fun home automation project that teaches how to read IR signals, decode remote buttons, and control electrical devices safely.
What You’ll Need
| Component | Quantity | Description |
|---|---|---|
| Arduino Uno / Nano | 1 | The brain of the project |
| IR Receiver (e.g. TSOP1838) | 1 | Detects infrared signals from a remote |
| Relay Module | 1 | Acts as an electronic switch |
| IR Remote Control | 1 | Any TV or set-top remote works |
| Jumper Wires | — | For connections |
| Bulb or LED Lamp | 1 | The load controlled by the relay |
Circuit Connections
| Arduino Pin | Connected To | Description |
|---|---|---|
| D3 | IR Receiver OUT | Signal pin |
| 5V | IR Receiver VCC | Power |
| GND | IR Receiver GND | Ground |
| D2 | Relay IN | Relay control pin |
| 5V | Relay VCC | Power |
| GND | Relay GND | Common ground |
| Bulb | Through Relay Output | Switched load |
🔸 Important: If you’re working with mains electricity (110V/220V), test with a low-voltage LED bulb first for safety.
🧮 Step 1: Get Your Remote Button Code
Before controlling the bulb, we need to find out what IR code your remote sends when you press a button.
Upload this simple sketch to your Arduino:
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 3 // IR sensor pin
void setup() {
Serial.begin(115200);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
Serial.println("Press any button on your remote...");
}
void loop() {
if (IrReceiver.decode()) {
Serial.print("Code received: 0x");
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
IrReceiver.resume();
}
}
🧾 What to Do:
-
Open the Serial Monitor (set baud rate to 115200).
-
Press any button on your remote.
-
You’ll see something like this:
Code received: 0x649BF708
-
Copy the hexadecimal value (the part after
0x).
That’s your unique remote button code.
We’ll use that code in the next step.
💡 Step 2: Use the Code to Control the Bulb
Now that you have your remote’s button code, let’s use it to control a relay connected to a bulb.
Replace 0x649BF708 in the code below with your own remote code.
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 3 // IR sensor pin
#define RELAY_PIN 2 // Relay control pin
bool bulbState = false; // Bulb initially OFF
void setup() {
Serial.begin(115200);
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW); // Start with bulb OFF
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
Serial.println("Ready to control bulb with remote...");
}
void loop() {
if (IrReceiver.decode()) {
unsigned long code = IrReceiver.decodedIRData.decodedRawData;
Serial.print("Code received: 0x");
Serial.println(code, HEX);
// Replace this with your remote button code
if (code == 0x649BF708) {
bulbState = !bulbState; // Toggle bulb state
digitalWrite(RELAY_PIN, bulbState ? HIGH : LOW);
Serial.println(bulbState ? "Bulb ON" : "Bulb OFF");
}
IrReceiver.resume();
}
}
⚡ How It Works
- The IR receiver detects signals from your remote.
- The Arduino reads and decodes the signal into a unique hexadecimal code.
- When it matches your chosen button’s code, the relay toggles, switching the bulb ON or OFF.
🧩 Ideas for Improvement
Once you’ve mastered this, try:
- Using two buttons (one for ON, another for OFF).
- Adding an LCD to show “Bulb ON” or “Bulb OFF.”
- Controlling multiple relays for different devices.
- Upgrading to a Wi-Fi module (ESP8266/ESP32) for mobile app control.
🏁 Conclusion
You’ve successfully created a remote-controlled bulb using Arduino!
You learned how to read IR remote codes and use them to switch a relay on and off.
This same method can be applied to control fans, lamps, or other appliances — bringing you one step closer to building your own DIY smart home system.