badook
Posts: 43
Joined: Sun Dec 16, 2012 7:44 pm

Can I use this IR+Led with my rPI

Wed Jan 09, 2013 10:58 pm

Hi, I know what I'm about to ask can't probably be answered just looking at the following picture, but since there are many competent people around here I thought I might as well try.
I savaged an IR receiver + led board from a broken tv, do you know if it's possible to connect it to the raspberry pi's GPIO? The image should be clear enough to read all the writings.

Thanks!

Image
http://i.imgur.com/fB9KP.jpg

zardoz66
Posts: 77
Joined: Wed Jan 02, 2013 1:02 am
Location: Austin TX
Contact: Website

Re: Can I use this IR+Led with my rPI

Thu Jan 10, 2013 2:40 am

if you can, you would prob. need to use the GPIO and program it. I do not see any logic or controller on that board.
Zardoz
Raspberry Pi 3 | Raspbian Jessie | 32GB Samsung EVO+ | D-Link 7 port USB HUB | Sabrent CRW-EXT 6-Slot Card Reader | 64GB USB Storage. Other RPi's - 2x RPi1b, 1x Rpi1b+ 1x Rpi2b, 2x Rpi3b
Join us on IRC #raspberrypi at https://webchat.freenode.net/

User avatar
Burngate
Posts: 6160
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Can I use this IR+Led with my rPI

Thu Jan 10, 2013 12:17 pm

From what I can see:
In the top picture, counting from the left on the connector, pin 1 is a supply of less than 16v, and pin 5 is ground / 0v
It may work from 3v3 Or it may not. If not, try 5v

Pins 2 & 3 are feeding the bi-colour LED - feed each from a GPIO via a 330Ω resistor

Pin 4 is the output of the sensor. Feed that into a GPIO. If you are going to use more than 3v3 for your supply, then you'll need some protection for the GPIO

You should get some sort of signal. It may, however not make much sense. The tv will have some signal conditioning, such as automatic gain control to take account of ambient light, and some 50Hz/100Hz or 60Hz/120Hz filtering to remove mains hum from lighting

badook
Posts: 43
Joined: Sun Dec 16, 2012 7:44 pm

Re: Can I use this IR+Led with my rPI

Thu Jan 10, 2013 12:23 pm

Thank you. My main comcern is frying my raspberry... So if i connect the first pin to the 3.3 i shouldn't damage it, right?
Thanks again ;-)

SiriusHardware
Posts: 502
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Can I use this IR+Led with my rPI

Sun Jan 13, 2013 11:26 pm

Burngate wrote:From what I can see:
In the top picture, counting from the left on the connector, pin 1 is a supply of less than 16v, and pin 5 is ground / 0v
It may work from 3v3 Or it may not. If not, try 5v

Pin 4 is the output of the sensor. Feed that into a GPIO. If you are going to use more than 3v3 for your supply, then you'll need some protection for the GPIO

You should get some sort of signal. It may, however not make much sense. The tv will have some signal conditioning, such as automatic gain control to take account of ambient light, and some 50Hz/100Hz or 60Hz/120Hz filtering to remove mains hum from lighting
Actually, in my experience the signal conditioning is normally built into the IR receiver device - they are usually pretty sophisticated chips in their own right. They do however tend to be 'tuned' to a particular I-R carrier frequency which matches that used by the transmitter, so if you're using a salvaged IR receiver the best remote to use with it is the original one used with the unit, if available. Others will work, but if they don't use the matching carrier frequency the maximum range will be somewhat reduced.

The output is usually a clean logic-level data stream, but the actual format and timing of that stream depends on the remote data protocol being used. If you go to

http://www.sbprojects.com

And go to 'Knowledge Base' / 'IR Remote controls', there's an excellent description of remote control basics, plus links (in the upper left corner of the main remote controls page) to format and timing details for many commonly used remote control data formats.

In fact, that whole site is a very useful resource for the electronics hobbyist generally (and the site owner is a Pi fan too).

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12547
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Can I use this IR+Led with my rPI

Sun Jan 13, 2013 11:44 pm

yes, signal conditioning is built into such devices. They take the very short impulses the IR-LED emits, (normally at a rate of 38 KHz) and turns them (stretches them) into a stream of bits that can be decoded with a normal UART, such a one as the PI has. (the format of the bit stream depends on the transmitter).

Depending on the type of receiver it is tuned for a specific frequency of pulses, but the resulting baud-rate is often 1200 Bps.

As for this one, I'm afraid 9Ym4 sounds like a production date (year 9 month 4), so no use at all googling for that! Maybe it has a real designator on the back. All of these tranceivers are very alike, so this datasheet is as good a starting point as any. http://www.farnell.com/datasheets/1244274.pdf But note that most of them have 3 leads, and this one appears to have four, with two connected. Its probably of Chinese origin.

The output is normally (often) open collector, so you should use a pullup to 3V3, but if its using a pullup to its VCC (normally 5V) or its not using a pullup (TTL drive) then just place a 10K resistor in series with the RxD input of the PI, and that will protect the PI effectively. Also, the VCC of the receiver must be decoupled with a large elco, which is the case on your board.

So yes, you can use it, but it will be a bit of a puzzle!
On the software side, be aware that the PI boots up with the UART used for terminal interfacing, so the UART is "in use" and has to be "freed from that use" to be able to use it for your own purpose. But there are many examples on how to use the UART, with for example python.

SiriusHardware
Posts: 502
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Can I use this IR+Led with my rPI

Sun Jan 13, 2013 11:49 pm

badook wrote:Thank you. My main comcern is frying my raspberry... So if i connect the first pin to the 3.3 i shouldn't damage it, right?
Thanks again ;-)
if you run the device on 5V (which might be necessary, as it may only run on 5V) then it will output 0v-5V data on its data pin and that shouldn't really be connected straight to any of the Pi's GPIO pins as they expect a maximum of 3.3V in. (Mahjongg.. the ones I have played with have had direct logic-level drive outputs rather than open-collector outputs. It sounds like we need a part number to clarify things).

Run the device on 3.3V if it is happy to work on 3.3V, but otherwise run it on 5V and insert a low value resistor (say 47 to 100 ohms) between the IR receiver data output and the GPIO input. (this advice applies if it has a logic - level output driver - but if it has an open-collector output, then ... what Mahjongg said).

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12547
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Can I use this IR+Led with my rPI

Mon Jan 14, 2013 12:08 am

IMHO only a 10K resistor in series with the GPIO will offer enough protection, but if you want to "play it safe", simply divide the output by 3/5th with a 220K and a 330K resistor divider.

The output is often open collector, but with a built-in pullup!.

In the case of the example its a 33K pullup, so its drive strength is already quite limited, not enough to damage a PI, but a series resistor is still useful to protect against programming errors where the PI tries to output 3V3 to RxD, and the transistor in the receiver shorts it to GND.

SiriusHardware
Posts: 502
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Can I use this IR+Led with my rPI

Mon Jan 14, 2013 12:35 am

mahjongg wrote:IMHO only a 10K resistor in series with the GPIO will offer enough protection, but if you want to "play it safe", simply divide the output by 3/5th with a 2K2 and a 3K3 resistor divider.
The divider is a good (better) idea as well, but any significant resistance inserted in series with the data may cause unacceptable rounding of the corners of the data stream pulses, if the GPIO input has any significant amount of capacitance. You'd probably want to use the lowest combined values (while still maintaining the divider ratio) that the IR receiver's output is capable of driving.

As long as the GPIO inputs have the usual diode clamp protection then a relatively small series resistor will allow the receiver output to rise to whatever voltage it may wish to without also forcing the GPIO input up to that voltage. The small series resistor allows there to be a difference. If directly connected, then 5V out from the receiver straight into the GPIO pin could certainly cause damage.

The absolutely correct way to do this is to run the receiver on 5V and take its output to a non-inverting level-shifting buffer such as one element of a 4050 logic IC running on 3V, as that device can tolerate its input being driven by a higher voltage than the voltage it is running on. But I think the single resistor / resistor divider idea is probably safe enough.

obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

Re: Can I use this IR+Led with my rPI

Mon Jan 14, 2013 8:16 am

I don't think those output a stream that can be directly decoded with an uart. Philips for instance uses something they call RC5 code for their remotes. You might google for that to see how such protocol is build up. The modules usually work best behind a brown filter glass, as that filters out most ambient light.
If you connect the module to a 5V supply, you can measure the voltage at it's output. If it has a buildin pullup, you should measure 5V on it's output as well.
Another possible way of interfacing is using a BAT85 diode with it's cathode pointing to the ir module.
It will block the voltage coming from the ir module, but will still allow the ir module to pull the signal line to gnd. A 1K serie resistor to limit the current might complete the circuit.
You really need a (preferable memory) scope to analyse the signals coming from that module.

badook
Posts: 43
Joined: Sun Dec 16, 2012 7:44 pm

Re: Can I use this IR+Led with my rPI

Mon Jan 14, 2013 11:50 am

Thank you all for taking interest in this post! :)
I've tried to connect the ir to the 3.3v pin, and it works. Using OpenELEC and the lirc_rpi module, I was able to control xbmc by a remote. However as previously mentioned, some bulbs (I'm in EU) interfere with the receiver, and make it impossible to use the remote unless it's very near to the receiver.
With the lights off, the maximum range is not very impressive...I managed a maximum of 1-2 meters. I think I'll check out some other IR-receiver for better performance, or I'll try to connect it to the 5V pin...as soon as my ordered breadboard arrives.

Thank you all for your interest, the raspberry pi and this helpful community has finally made me approach electronics, and I'm slowly (sloooowly) learning and loving it!

SiriusHardware
Posts: 502
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Can I use this IR+Led with my rPI

Mon Jan 14, 2013 7:03 pm

obcd wrote:I don't think those output a stream that can be directly decoded with an uart. Philips for instance uses something they call RC5 code for their remotes. You might google for that to see how such protocol is build up.
That's true, I don't know any remote protocol which uses standard asynchronous serial data format, as used by serial UARTs. The website I referenced above has really good detail about many remote control data formats, including RC5.

Bleugh
Posts: 15
Joined: Fri Sep 14, 2012 2:34 am

Re: Can I use this IR+Led with my rPI

Tue Jul 09, 2013 12:22 am

connect it to the 5V pin, it'll go much further in range then :-)

Return to “General discussion”