8 Channel Infrared Remote Control
This tutorial explains how to design and build an 8 channel infrared remote control receiver using PIC Microcontroller. The remote control used is a Sony Trinitron ( TV Remote ), available easily in the market and online. This receiver can be used to control up to 8 AC devices like Lamps, Fans, Tube Lights and other appliances. The circuit can also be used to to control DC loads.
This is the overall product :
The circuit is based upon PIC16F690 microcontrolller. Any other PIC can be used as well. The crystal speed is 4MHz. The master clear pin is pulled up by a 4.7K ohm resistor. Programming of the controller is done through ICSP pins ( PGC, PCD, MCLR and GND ). You can use any burner of your choice to download the program into the controller.
Code is written in PIC BASIC using Crownhill Proton Basic Compiler. I am providing the code under CC3.0 license. You may use it for non commercial purposes, share and modify.
The circuit is powered by a 12Volt transformer. 12 Volts AC is supplied to two rectifier bridges so that we get two separate DC power supplies. We will provide one DC source to the microcontroller, and the other will be used to run the relays. ( So that any spikes / unwanted high transients ) do not enter the microcontroller circuit. It is a better practice to keep controller on a separate course when switching AC loads. In the schematic diagram we call power voltage and ground provided first DC power supply as +V_A and GND_A. Similarly we call second DC supplies power as +V_B and GND_B
Isolation and Snubber:
Isolation between the controller circuit and the relay switching system is given by opto coupler PC817. Also across the switching terminals of the relay we have installed a snubber which absorbs any high spikes created during AC switching of the load. Snubber is simply a 47Ohm Resistor ( 2 watt ) and 0.1uF ( Code:104 ) Mylar 400V capacitor in series.
We are using Sony Trinitron TV Remote that uses Sony's protocol called "SIRC". It works on 38Khz carrier. When a button on the remote is pressed it sends out a header of 2.4 Mili seconds. This is to tell the receiver that it should get ready to receive the upcoming data. After the header, 12 bits of information are sent. These 12 bits are a combination of ones and zeros. A Logic "1" is indicated by a pulse of 1.2 Miliseconds, and a Logic "0" is indicated by a pulse of 0.6 Miliseconds. Between each bit (whether Logic 1 or Logic 0 ) there is a gap of 0.6 Mili seconds.
The above image shows a complete signal starting from a 2.4milisecond header, followed by 12 bits. The first 7 bits are the Command, while the last 5 bits are the address ( also known as device identification code ).
Command is the actual code that tells what action should be taken, and address defines for which device it is meant for. For example the command for Power Off might be 1100100. If there are two Sony appliances in the room ( for example TV and Music player ), the command will be sensed by both devices and they will both turn off. In practice only the TV should turn off because we are using TV remote. This is where address comes in. The TV expects to receive a command for turning off followed by its device identification i.e. 10000
Hence when the TV detects that the command is meant for it, only then it will turn off the TV, else it will simply ignore the whole 12 bits.
In our project we will be using both Command and Address so that our project responds to the Trinitron TV remote, and other Sony appliances that you might be using like LCD, DVD player, Blue Ray etc are not disturbed. Note that you cannot have a Sony TV in the same room where you install this project. Else when you put your TV to channel 1, your bulb or fan ( whatever you have connected to the first relay ) will turn on /off :)
Above photo shows the PCB labeling.
A Chinese after market Sony TV Remote control
Universal Infra Red Receiver. Soldered on a small vero
board along with a 10uF capacitor and 4.7Kohm resistor.
( See schematic Diagram for how to wire it up ).
I have used a 5 pin connector, but only 3 pins are being used.
Back side of the PCB.
Items for Download :
Schematic Diagram (Hand Drawn) : DOWNLOAD
PIC Basic Code (Proton+ Compiler) : DOWNLOAD
PCB Artwork (PCB Wizard) : DOWNLOAD
Remote Control Functions :
Remote Button 1 : Turn on/off Relay 1
Remote Button 2 : Turn on/off Relay 2
Remote Button 3 : Turn on/off Relay 3
Remote Button 4 : Turn on/off Relay 4
Remote Button 5 : Turn on/off Relay 5
Remote Button 6 : Turn on/off Relay 6
Remote Button 7 : Turn on/off Relay 7
Remote Button 8 : Turn on/off Relay 8
Remote POWER button : All Relays OFF
Incase of any difficulty, questions or comments feel free to contact me.