Remote controlled light dimmer with Arduino

In the last project I made a simple light dimmer using Arduino where the intensity of light (lamp brightness) is controlled with a potentiometer, now in this project I’m going to show how to add a remote control to the circuit so that the lamp brightness is controlled from IR remote control instead of the potentiometer.

The IR remote control used in this project uses RC-5 communication protocol. A related project below shows how to decode RC-5 remote controls. Note that we need to decode our IR remote control in order to know the IR code of the buttons which we’re going to use in the Arduino code.

Related Projects:
220V Light dimmer with Arduino – Lamp brightness control
Arduino RC5 IR remote control decoder

Hardware Required:
Basic component list required for this project is below.

  • Arduino board
  • BT136 Triac  —  datasheet
  • 220V AC lamp
  • IR receiver
  • LM393 (or LM339) comparator
  • Optocoupler (MOC3020, MOC3021, MOC3022, MOC3023)  —  datasheet
  • 2 x 1N4007 diode (or 1N4001)
  • 2 x 220k ohm resistor
  • 10k ohm resistor
  • 470 ohm resistor
  • 120 ohm resistor
  • 100 ohm resistor
  • 47µF capacitor
  • 0.01µF capacitor
  • Breadboard
  • Jumper wires

Arduino light dimmer with remote control

Arduino remote controlled light dimmer circuit:
The circuit schematic diagram is shown below.

Arduino remote controlled light dimmer circuit

All grounded terminals are connected together.

Generally the IR receiver has 3 pins: GND, VCC and output, in this example the output pin is connected to Arduino pin 2 which is an external interrupt pin (INT0). The IR sensor as well as the LM393 comparator IC are supplied with 5V (comes from the Arduino board).

The LM393 comparator is used for zero crossing detection.

Arduino remote controlled light dimmer code:
As shown in the circuit diagram, the IR receiver output pin is connected to Arduino external interrupt pin (pin number 2), that means when a button is pressed (from the remote control) the Arduino starts reading the IR signal immediately.

The remote control used in this example uses RC-5 protocol, the RC-5 code message is 14-bit long:
2 start bits, 1 toggle bit, 5 address bits and 6 command bits. The 2 bits (start bits) are always 1 and the toggle bit may be 1 or 0.

In this project I didn’t use the 2 start bits and the toggle bit at all because they have no effect (also to simplify the code). I used a TV remote control which means all the address bits are zeros (address = 0).

What’s left is the important part of the RC-5 code message which is the command number, I used two buttons. the first one with code = 0x10, it increases the light intensity and the second button  with  code = 0x11 which decreases the light intensity. The other buttons of the remote control have no effect on the circuit.

The frequency of my AC source is 50Hz which means the period is 20ms, so the half wave period is 10ms = 10000µs.

Full Arduino code:

Arduino remote controlled light dimmer video:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.