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.
Step 1: Things you need for this project.
- An existing IR remote(like TV remote).
- Atmega-328p Microcontroller-1
- IR Receiver Diode – TSOP38238
- 16 MHz crystal,10k ohm resistor and 22Pf Capacitor(2)
- 7805 voltage regulator
- 5v power supply(use any mobile charger if available)
- 4-channel relay board(Number of channel depends on the number of switches to be controlled)
- Arduino uno for testing and programming
- Some wire to connect to 220v supply
- 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.
- 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.
- Bread board
- soldering gun
- wire strippper
Step 2: Selecting a 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.
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.
Step 4: Working With Relay!!!
Relay as thlectrical device, typically incorporating an electromagnet, which is activated by a current or signal in one circuit to open or close another circuit.
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, such as solid-state relays.
Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits).
Read more: Remote controlled switch using Atmega 328p