Monday, 3 October 2011

Universal IR Txr / Rxr For Any Device



1--    Here am designed a Transmitter and Receiver. Which will receive the key code as per the           
          picture given bellow.


       .
       In this first two bits in key 1 are high for 1ms and low for 5ms, this can be identify the receiver
     which detect a new signal . Next  six (1ms high and 2ms low)bits, thats are d0  to  d5,you can give
     this as different values for different keys as per your requirement.After 100ms code will repeat.

2--Transmitter and Reciever circuit Diagram
                                                                  TXr  circuit


                                                                  Rxr  Circuit


  3--Program for Transmitter and Receiver
     
       This program is compiled with Wiz_C compiler


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Txr
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<pic.h>
#include<PortBits.h>
#include<delays.h>
unsigned int checktime=0;
bit var1=0,var2=0,var3=0,var4=0,var5=0,var6=0;       
void main()
{
ANSEL=0;
CMCON=7;
TRISA=0b111110;
TRISC=0b111111;
PORTA=PORTC=0;
/////////////////////////////////////////////////////
Wait(1000);
for(;;)
{
Wait(100);
if(bRA1==1||bRA2==1||bRC0==1||bRC1==1)
{
var1=1;var2=1;var3=bRC1^1;var4=bRC0^1;var5=bRA2^1;var6=1;
///////starting bit
bRA0=1;
Wait(1);
bRA0=0;
Wait(5);


bRA0=1;
Wait(1);
bRA0=0;
Wait(5);
}
//////////Data bit///////////////////////////
bRA0=var1;
Wait(1);
bRA0=0;
Wait(2);


bRA0=var2;
Wait(1);
bRA0=0;
Wait(2);


bRA0=var3;
Wait(1);
bRA0=0;
Wait(2);


bRA0=var4;
Wait(1);
bRA0=0;
Wait(2);


bRA0=var5;
Wait(1);
bRA0=0;
Wait(2);


bRA0=var6;
Wait(1);
bRA0=0;
Wait(2);


//////////////////////////////
var1=var2=var3=var4=var5=var6=0;
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Txr  Hex  file
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
:020000040000FA
:1000000000005F30A6000428263084003830A400A9
:10001000840A8001A40B08280D281F2826078400C5
:10002000122884000008A000840A0008A10008002B
:10003000A00026088400A603200880000800830191
:100040008A118312BA01BB018312B8108312B8114E
:100050008312B8128312B8138312B9108312B91124
:1000600083018A014C288A1101300E20840A8A11EA
:100070003B208A01080020082104031908000130F0
:10008000F920000000005430F5208A110A12A00364
:10009000200F3B28A1033B288316910183120730D0
:1000A000990083163E3085003F3087008312870118
:1000B000850103301820E830182033200230A607CD
:1000C000003018206430182033200230A607003991
:1000D0008518013EFF3E03197F2800390519013EAE
:1000E000FF3E03197F2800390718013EFF3E031920
:1000F0007F2800398718013EFF3E031DA028B81451
:10010000B81500398718013E013A0038B812031DAE
:10011000B81600390718013E013A0038B813031D1C
:10012000B81700390519013E013A0038B910031D0E
:10013000B914B91505140030C32005140030C320CC
:100140000039B818013E0510031D05140030D220F7
:100150000039B819013EE120B81A013EE120B81B70
:10016000013EE120B918013EE120B919013E051018
:10017000031D05140030D220B911B910B813B812FC
:10018000B811B81060281820013018203320023030
:10019000A607051000301820053018203320023043
:1001A000A607080018200130182033200230A607C7
:1001B0000510003018200230182033200230A60726
:1001C00008000510031D0514003018200130182008
:1001D00033200230A6070510003018200230182006
:1001E00033200230A60700390800A200A20BF6282F
:0E01F0000800A300F030F520A30BFA28080049
:10420000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE
:10421000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAE
:10422000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E
:10423000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8E
:10424000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E
:10425000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6E
:10426000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5E
:10427000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4E
:04400E000430FFFF7C
:00000001FF

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Rxr
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>
#include<pic.h>
#include<PortBits.h>
#include<delays.h>
unsigned int checktime=0;
bit var1=0,var2=0,var3=0,var4=0,var5=0,var6=0;       

void main()
{
ANSEL=0;
CMCON=7;
TRISA=1;
TRISC=0;
PORTA=PORTC=0;
/////////////////////////////////////////////////////
for(;;)
{
if(bRA0==1)
{
  Wait(1);
  Wait(.005);
  Wait(.005);
  Wait(.005);
  Wait(.005);
  Wait(.005);
  Wait(.005);
   if(bRA0==0)
     {
      Wait(5);
      if(bRA0==1)    
      {
        Wait(1); 
        if(bRA0==0)
          {
           Wait(5);
         ///////////  
            if(bRA0==1)
            {var1=1;}
            else
            {var1=0;} 
       Wait(3);
            if(bRA0==1)
            {var2=1;}
            else
            {var2=0;} 
       Wait(3); 
            if(bRA0==1)
            {var3=1;}
            else
            {var3=0;} 
       Wait(3);
            if(bRA0==1)
            {var4=1;}
            else
            {var4=0;} 
       Wait(3);
            if(bRA0==1)
            {var5=1;}
            else
            {var5=0;} 
       Wait(3);
            if(bRA0==1)
            {var6=1;}
            else
            {var6=0;} 
       
       ///////////////
Wait(500);    
   }
  }
}
}
if(var1==1&&var2==1&&var3==1&&var4==1&&var5==1&&var6==1)
{bRA1=bRA1^1;Wait(10);}

if(var1==1&&var2==1&&var3==1&&var4==1&&var5==0&&var6==1)
{bRA2=bRA2^1;Wait(10);}

if(var1==1&&var2==1&&var3==1&&var4==0&&var5==1&&var6==1)
{bRC0=bRC0^1;Wait(10);}

if(var1==1&&var2==1&&var3==0&&var4==1&&var5==1&&var6==1)
{bRC1=bRC1^1;Wait(10);}


var1=0;var2=0;var3=0;var4=0;var5=0;var6=0;
}}
///////////////////////////////////////////////////////
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Rxr  Hex file
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
:020000040000FA
:1000000000005F30A6000428263084003830A400A9
:10001000840A8001A40B08280D281F2826078400C5
:10002000122884000008A000840A0008A10008002B
:10003000A00026088400A603200880000800830191
:100040008A118312BA01BB018312B8108312B8114E
:100050008312B8128312B8138312B9108312B91124
:1000600083018A0133288316910183120730990096
:1000700083160130850087018312870185010039CD
:100080000518013EFF3E031D852800301820013071
:1000900018205F214A214A212221031D852832216F
:1000A000031D852800301820013018205F212221EF
:1000B000031D85283221031D5F28B8146028B8105D
:1000C0003E21031D6528B8156628B8113E21031D81
:1000D0006B28B8166C28B8123E21031D7128B8177A
:1000E0007228B8133E21031D7728B9147828B91057
:1000F0003E21031D7D28B9157E28B9110130182035
:10010000F43018205F210230A6070421031DA02827
:100110001321031DA0281D21031DA0280921031D53
:10012000A0281821031DA0280E21031DA028003996
:100130008518013E013A00388510031D85142A21D7
:100140000421031DBF281321031DBF281D21031DEA
:10015000BF280921031DBF280039B918013E031427
:100160000038031DBF280E21031DBF2800390519C3
:10017000013E013A00380511031D05152A2104210D
:10018000031DDE281321031DDE281D21031DDE288B
:100190000039B81B013E03140038031DDE28182166
:1001A000031DDE280E21031DDE2800390718013E3D
:1001B000013A00380710031D07142A210421031DEA
:1001C000FD281321031DFD280039B81A013E031430
:1001D0000038031DFD280921031DFD281821031DDA
:1001E000FD280E21031DFD2800398718013E013A24
:1001F00000388710031D87142A21B810B811B812CF
:10020000B813B910B9113F280039B818013EFF3EA4
:1002100008000039B81B013EFF3E08000039B9193B
:10022000013EFF3E08000039B819013EFF3E0800BC
:100230000039B918013EFF3E08000039B81A013EE6
:10024000FF3E08000230A60700390518013E0314DE
:1002500000380800003018200A3018205F210230D2
:10026000A607080000301820053018205F21023052
:10027000A60700390518013EFF3E0800003018208F
:10028000033018205F210230A60700390518013E0F
:10029000FF3E08000230A60700301820003018206A
:1002A0005F210230A60700301820003018205F219F
:1002B0000230A60700301820003018205F298A116C
:1002C00001300E20840A8A1167218A010800200863
:1002D00021040319080001307C2100000000543083
:1002E00078218A110A12A003200F6729A103672928
:1002F000A200A20B79290800A300F0307821A30BFB
:040300007D2908004B
:10420000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE
:10421000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAE
:10422000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E
:10423000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8E
:10424000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E
:10425000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6E
:10426000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5E
:10427000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4E
:04400E000430FFFF7C
:00000001FF
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



       if you haven't Wiz_c compiler then copy Hex file of Txr and paste to notepad and save as Txr.hex.
     similarly in Rxr. Burn this two file into PIC16f676 one for Rxr other for Txr.  

Simple Working
 
           After completion of hardware please press key 1, then Txr will produce corresponding IR code
     as per the above picture ,which will transmit through the photo diode.IR photo detector will receive
     this IR signal and produce negative out put.Which will be converted to positive through BC557 and
     given to pic. which will decode the code and ON corresponding output pin (pin 13--A1).If same
     key press again output will off(toggle).similarly you can control 4 different switches Independently. 

         You can increase the number of keys by just giving more keys into all pins of Txr.And change
     d0- -d6 values for each keys as your own way.Design corresponding Rxr code.

4--Proteus Simulation file is included with dowloading pack
  •   To Download complete file related to this project Click here               


   If you have remote hand set of any company then you need only design the reciever circuit corresponding to that remote transmitter, to know about that please  click here
 (Don't  forget write the comments about this project)




                     

IR Receiver For Any Remote Handset


 If you have a IR transmitter remote for any company, then you can design receiver for that particular company .There are some steps to make a  RF receiver


1-   Find the IR transmition code of that particular company  (Philips,Sony ...RC5 coding  etc..)
       Follow some steps.
         
       1.a--Copy the hex code that given bellow,  paste into new notepad and save as "irpic.hex"
          (you can give any name but extension must be   .hex  instead of .txt)
---------------------------------------------------------------------------------------
Hex  file
---------------------------------------------------------------------------------------
:020000040000FA
:0600000000008501052847
:08000800042807309900FF23D2
:100010008316900050309F000430850095003830E2
:10002000810083128101A0016400010803191428D2
:1000300000301C2864000108A100A006A000031DD8
:1000400085140319851028200000000000001A28DC
:10005000A1000508013885005920FE39211C01380E
:1000600085005A20FE39A11C013885005920FE392F
:10007000211D013885005920FE39A11D0138850058
:100080005A20FE39211E013885005920FE39A11E53
:10009000013885005920FE39211F013885005A207A
:1000A000FE39A11F0138850059205628FE398500E8
:0600B0000800000008003A
:02400E00CD3FA4
:00000001FF
-----------------------------------------------------------------------------------------
       1.b--Burn (program) this HEX file (irpic.hex) into PIC12f675 or PIC12f629 by using
               JDM Multipic programmer Click here
       1.c--Connect the circuit diagram as per the picture


       1.d--Download "IR Scope " Software ,for Download Click here
       1.e--connect  the serial port into your PC and Run  "IRscope"


              Set correct COM port and capture duration (700ms) and click on "capture" Button ,
              So you can hear beep sound then press any key from your remote control, After 700ms you      
              can see digital code (with timing) for  corresponding key.


                                                        Example for RC5 coding.


2--Make receiver circuit for corresponding detected code
         To design a IR receiver for particular IR code(that can be find from above method) please follow simple IR transmitter and receiver for my own code, after follow that project, you can make receiver for any IR code.To find that receiver design please click here 

(Don't  forget write the comments about this project)