Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

Philips RC5 single LED Decoder and Transmitter circuitAuthor
Giorgos Lazaridis
September 16, 2012

The proof of concept for the single LED IR transceiver
As I've already mentioned in my relative RC5 and RC6 theory pages, i plan to make a large scale project related with IR decoding and transmission protocols. Obviously, i must first make some test circuits to prove that some ideas that i have really work, and to write the necessary assembly libraries for the PIC microcontrollers.

To follow this circuit, you need to have some basic and advanced knowledge regarding the Philips RC5 protocol. Visit the references page of this article to find the necessary theory pages.

The single LED decoder-transmitter idea

The same LED which is used to transmit the pulses can be used to receive pulses as well
I do not really remember the coherence that i made to come up with this idea... But i eventually decided to test something neat: I will use only one IR LED to both read the IR pulses from a Philips remote controller and to regenerate the same series of data. The idea is based on the fact that any LED generates a very small amount of current (10 to 1000 uAmps) when light falls onto the PN junction. I used once the very same technique to make a short range IR Beam cut detector receiver. The IR LED is reversed biased (cathode to +V). When IR pulses fall on the LED, a voltage appears across the series resistor R1.

I will use this technique for this circuit again, but this time i will use a high brightness narrow beam IR LED. At this point, i must give credits once more to Alan Parekh from Hacked Gadgets for providing me some wonderful LEDs and IR transistors for my projects. You can find the same LEDs in his online store.

Since i will be using a PIC microcontroller, it will be very easy to change the LED bias on the fly - by connecting the LED leads on 2 I/O ports, i can bias it forward or reversed simply by changing the port output (HIGH-LOW). Having the anode HIGH and the cathode LOW, the LED is forward biased for transmitting pulses. On the other hand, having the anode LOW and the cathode HIGH, the LED is reverse-biased to receive pulses.

The Circuit
Here is the circuit schematic:

Click to enlarge

The interesting part is how the LED is connected to the PIC. R5 is a large 33K resistor. This resistor is used to generate the appropriate voltage drop across its leads when the LED is reverse-biased to read the incoming pulses from the remote controller. To receive the pulses, output RD3 is driven HIGH and output RD2 is driven LOW - thus reverse biasing the LED. R6 (100 Ohms) is relatively small compared to R5 so it takes no part during the reception cycle. When IR pulses reach the LED's PN contact, a small current goes through the LED and through R5. This small current is enough to generate some 3 V voltage drop across R5. These pulses are then driven to the inputs RB5 and RA4 which are programmed as inputs with a very high impedance.

RB5 is used to trigger the Timer 1 Gate of the PIC, and RA4 is used to count the pulses with the Timer 0 module of the PIC. Both modules are needed to fully decode the received signal down to its carrier frequency signal. It is obvious that the LED output during signal reception will generate the IR carrier frequency pulses. So, a sophisticated software is needed to read these pulses, extract the pulses and decode the bits. I've tried to document the assembly listing as detailed as possible, yet following the software might be an unpleasant situation for beginners.

Now let's see how the same circuit can transmit pulses. To transmit pulses, RA4 is programmed as an output and driven HIGH. The port RB5 is not used so it maintains as an input with high impedance. The output RD2 has no big effect due to the high resistor R5 which allows max 3.3/33000=100uA of current to go through. Bringing the output RD3 LOW, the LED turns on through the limiting resistor R6. The max current through the LED set by the small resistor R6 which provides the proper voltage drop so that we do not exceed the 25mA which a PIC port can handle. Bringing this output HIGH turns the LED off. This is how the pulses can be transmitted.

The Circuit Operation

Just approach the remote control close to the circuit's LED and press a button. The PIC will read, decode, save and display the signal data

Then press the button to transmit the saved data with the same signal characteristics (carrier frequency, bit length etc)
So, here is how the circuit works: First, the circuit has to read one command from a remote protocol which uses the RC5 protocol. To do so, we approach the RC LED close to the circuit's IR LED (max distance 8mm) and we press a button to transmit the code. The PIC reads and decodes the received pulses to extract the toggle bit, the address and the code bits. These data are then shown on the 20x4 LCD display. Moreover, the PIC stores the received byte and the signal characteristics into the EEPROM memory in order to reproduce it later:

EEPROM Offset 0x20: Received Byte (High)
EEPROM Offset 0x21: Received Byte (LOW)
EEPROM Offset 0x22: Bit Length - This number shows how many carrier signal pulses exist during a HIGH bit period
EEPROM Offset 0x23: Frequency - This byte holds the number of Fosc/4 pulses during one eights (1/8) of a carrier signal pulse
EEPROM Offset 0x24: BitPeriod - This byte holds the number of Fosc/4/64 pulses (precscaller 1:64) during a complete signal bit period. This number is not used during transmission instead is used during the reception. As a matter of fact, this number is used to reproduce the transmitter's clock according to the starting bit (as explained in the RC5 theory)

When a command is saved, the circuit can immediately reproduce it simply by pressing the push button. As long as this button is pressed, the circuit sends the saved data with approximately 90mSec interval. The circuit emulate also the toggle bit in order to operate normally. Thus, if the button is released and pressed back again, the same data will be sent again but the toggle bit will be inverted. Note that for the toggle bit the circuit does NOT use the data received during the teaching time (signal reception). The toggle bit during transmission is totally irrelevant to the data previously read.

This is actually everything that this circuit can do. Please do not ask for a more complex version with more buttons and such, because this is only a proof of concept for the single LED transceiver idea. A next circuit version will follow shortly with a programmable constant current driver to drive the LED with much higher current for longer transmission distance. With this setup i managed to effectively control my TV from about 4 meters away.

Bill Of Materials
R1Resistor 2.2 KOhm 1/4 Watt 5% Carbon Film 
R2Resistor 10 Ohm 1/4 Watt 5% Carbon Film 
R3Resistor 220 Ohm 1/4 Watt 5% Carbon Film 
R4Resistor 10 KOhm 1/4 Watt 5% Carbon Film 
R5Resistor 33 KOhm 1/4 Watt 5% Carbon Film 
R6Resistor 150 Ohm 1/4 Watt 5% Carbon Film 

The PIC Software

Here is the first version of the PIC software (assembly listing and HEX file):

Download file
RC5 Single LED Transceiver - Hex file - Version 1.0

Download file
RC5 Single LED Transceiver - Assembly listing - Version 1.0

   Continue reading. Click here to view the references.



  Email (shall not be published)


Notify me of new posts via email

Write your comments below:
BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


  • At 17 February 2016, 9:19:22 user james wrote:   [reply @ james]
    • Hi,
      I admire and love you work, pls can you help with the code in c-language? i greatly appreciate it.

  • At 9 December 2014, 5:54:40 user Vinay H.Parmar wrote:   [reply @ Vinay H.Parmar]
    • Dear Friend,
      Source code developed using C will be very understandable to all.
      Request to this suggestion.

  • At 8 December 2014, 10:54:22 user Sky Viktor wrote:   [reply @ Sky Viktor]
    • Nice work,I am aspiring to be and one of you guys(mentor)

  • At 23 November 2012, 13:50:49 user vinay wrote:   [reply @ vinay]
    • c code would have been better understanding.

  • At 30 September 2012, 5:16:12 user circuit board maker wrote:   [reply @ circuit board maker]
    • Very nice and helpful information has been given in this article. I like the way you explain the things. Keep posting. Thanks..

    reddit this Reddit this

     HOT in heaven!

    NEW in heaven!

    New Theory: AC electric motor working principle

     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy