Programming built in comparator need advice.

Thread Starter

oookey

Joined May 24, 2010
70
Hi everybody, :)
I’m trying to use the signal from the TV remote control to trigger the 12F615 in order to produce PWM for output, via photo diode as receiving the signal.

Having though of using op amps to receive and amplify the signal to 5V, then feed to the MCU, to produce the O/P, this involves quite number of components, perhaps I could use the built-in comparator of the 12F615.

I used to play with “FLOW CODE” to program my PIC projects, however it seems a difficult task for this software to program the built-in comparator mode. Hoping the experts here could guide me in C programming, to have my MCU working.

The circuits of my project and datasheet of the MCU attached.

Thanks
oookey
 

Attachments

THE_RB

Joined Feb 11, 2008
5,438
You don't need the comparator.

To receive/decode the TV remote you need a 3pin IR sensor, commonly available from all the hobby suppliers. That sensor outputs 0-5v digital directly, so you can read it with any digital input pin.

To decode the control code you need to program the PIC to recognise that particular pattern. There are lots of websites showing the standard Sony and Philips IR codes. A google search will give you a lot of info. :)
 

John P

Joined Oct 14, 2008
2,026
Even so--detecting the carrier is quite a challenge in the presence of interfering light. If you buy the integrated receiver, all the work is done for you. They're incredibly cheap, so this isn't a place to be tempted to build your own. Just be careful to get a receiver that matches the frequency you'll be transmitting.
 

MMcLaren

Joined Feb 14, 2010
861
I would also recommend using an IR receiver IC.

I built something awhile ago using a 12F683 (assembly language) with a Sony SIRC remote (see diagram below). The program simply samples the IR receiver output periodically to decode the SIRC remote keys and it generates bit-banged gamma corrected PWM outputs.

Regards, Mike

 

Attachments

Thread Starter

oookey

Joined May 24, 2010
70
Even so--detecting the carrier is quite a challenge in the presence of interfering light. If you buy the integrated receiver, all the work is done for you. They're incredibly cheap, so this isn't a place to be tempted to build your own. Just be careful to get a receiver that matches the frequency you'll be transmitting.
Thanks for the advice.
I agreed there is very wide range of carrier frequencies, though if I use a phototransistor(datasheet attached), the circuit as attach shows, may be able to overcome the problem of choosing the correct type of IR receiver, because of the carrier frequency.

My working assumptions:

1. The carrier frequency ranges from 25kHz to 455kHz, then the Xc of 1uF capacitor would be 6Ω to 0.3Ω,
2. The 100kΩ is to pull MCU port to 0V when no signal received,
3. After a signal pulse received, a debounce of 28Usec is introduced, prior next instruction. assuming 60% duty cycle for the carrier frequency.

The distance of the remote source is 2M max away from the receiver, will the circuit work?
 

Attachments

ErnieM

Joined Apr 24, 2011
8,377
will the circuit work?
No it will not.

About the only thing it is good for is to connect it to an oscilloscope, point the specific TV you wish to use at it and measure the carrier frequency. Then go and buy a 3 pin IR receiver that is close to that frequency.
 

THE_RB

Joined Feb 11, 2008
5,438
...
The distance of the remote source is 2M max away from the receiver, will the circuit work?
No (as ErnieM said).

IR LEDs transmission power decreases at the square of the distance.

The 3pin sensor everyone is telling you to use has an inbuilt special high gain amplifier, that allows it to detect weak IR signals if they are approx 39kHz.

I have done experiments with direct IR LED to IR photodiode, and the best distance you can get is a few inches, and requires correctly setting up the biasing of the sensor.

If you don't want to buy a 3-pin sensor, there is one inside every TV, VCR, settop box, (anything that has an IR remote) so you can salvage a sensor if you like.

And of course you can get IR transmitting LEDs from inside any old remotes.
 
Top