Remote controlled switch using Atmega 328p

Ever dreamt of controlling an appliance like a CFL or a fan at your finger tips and thinking for a cheap solution?
Well, then you are looking at the right instructable!!
This instructable will provide you with a cheap and best possible solution to control your switch operated appliances through an existing IR remote using a simple electronic circuit which uses an Atmega-328 microcontroller.
Remote controlled switch using Atmega 328p

Step 1: Things you need for this project.

  1. An existing IR remote(like TV remote).
  2. Atmega-328p Microcontroller-1
  3. IR Receiver Diode – TSOP38238
  4. 16 MHz crystal,10k ohm resistor and 22Pf Capacitor(2)
  5. 7805 voltage regulator
  6. 5v power supply(use any mobile charger if available)
  7. 4-channel relay board(Number of channel depends on the number of switches to be controlled)
  8. Arduino uno for testing and programming
  9. Some wire to connect to 220v supply


  1. For this project to be economical make sure to use atleast four switches. An additional switch only adds to a relay in the circuit. Hence more the number of switches less will be the cost per switch.
  2. Use 7805 voltage regulator only if you are using a supply capable of providing a voltage of 7 volts or above. If your supply voltage is anything less than this, it is safe to work without a regulator. Normally a mobile charger will not require a regulator.


  1. Bread board
  2. soldering gun
  3. wire strippper

Step 2: Selecting a remote!

Today due to the advancement in technology every home will have atleast one remote.
As mentioned earlier any IR-remote which is available can be used for this project.
To obtain the IR protocol in which the available remote is working we need to have the value of the IR pulses the remote is transmitting for various buttons. In order to obtain the protocol we use Arduino Uno and IR Receiver Diode – TSOP38238 to decode the pulses emitted by the remote.
Connect the circuit as per the diagram above for IR circuit.
Note down the pulse values emitted by the buttons which you wish to use.
The firmware required for the above process is shared as IR Receive.
For more information about IR Remote and its protocols visit this link.

Step 3: Connections and testing.

Remote controlled switch using Atmega 328p schematic

Once you are done with decoding of the pulses of the buttons of the remote its time to connect the actual circuit on a bread board.
For the purpose of testing rig up the same circuit which is used to decode the remote pulses and just include as many LEDs for the number of buttons you are planning to use.
The connections of LEDs to various pins depends on your choice, but make sure to change the pin numbers in the code according to your connections.
The code provided here is for 4 devices or LEDs. To add more just just replicate “cases” in the code.
For more information on the shared code visit this link.
Once done with the connections upload the code shared below.
After uploading the code you must be capable of controlling a particular LED from a particular button on your remote.
If you are familiar with the Relays then skip to step 5 to prepare your permanent board else follow the next step to learn how to connect a relay between a microcontroller and a switch of an appliance which you wish to control.

For more detail: Remote controlled switch using Atmega 328p

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top