Pages: [1]   Go Down
Author Topic: IR leds and 38KHz receivers as a optoencoder or similiar  (Read 1856 times)
0 Members and 1 Guest are viewing this topic.
Recanati (MC)
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here we are again: i have an IR led (940nm) working quite well (i could see it with my phone) from an arduino IO pin. I also bought a vishay IR 38KHz receiver, precisely a TSOP38338SS1V (this one http://www.vishay.com/docs/81744/tsop381.pdf ). i know this one acts as a filter, de-modulator and stuff, but i just want it to send HIGH if any IR signal is detected or LOW if not, on another IO pin of the same arduino. any suggestion? thanks in advance!
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 44
Posts: 2459
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The IR beam must be modulated at 38Khz and must be sending a PCM-style signal -- it will reject a continuous 38Khz signal (see page 5 of your datasheet). I don't think it will be possible to have the IR receiver send a continuous high signal.
Logged

Recanati (MC)
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nice.. so, shall i use another device in order to achieve what has been written above? if so, which one?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   As the previous poster has said, all you need to do is switch the IR Led on and off at 38Khz. There are examples for doing this using an Arduino Timer if you search for 'Arduino 38Khz'. I would suggest that you drive the IR LED using a transistor rather than directly from an Arduino pin, this will allow you to drive it with a higher current, again you can probably find examples of this in the search results.

   You could also drive the IR Led from a 555 Timer, the 555 timer would generate the 38Khz signal and then all you need to do on your Arduino is use the 555 Timer 'reset' pin to control when the Timer is active or not.

   As the previous poster mentioned, most IR Receivers will reject a constant 38Khz signal after a short period, my own set up for an RC Car Lap Timer rejects the 38Khz pulse after about 2 Seconds, in my application this is not a problem as I am only interested in detecting the initial presence of the car in the detection zone.

   If your application requires you to test for the continued presence of an IR Signal, you might get away with generating a dummy signal, you may not be interested in the contents of the signal, but it will be enough to keep the receiver happy.

   Based on my own experience a valid signal still requires a gap in the signal transmission during which the output of the IR Receiver will return to the high state so this approach is not suitable for very high speed beam breaking type applications as the beam may be broken during a transmission gap with no means for you to detect it.

   If your application can work with gaps longer than a few ms, you should be ok. If you just need to detect reflection, transmission or beam breaking over short distances you can use a normal IR (not demodulated) Detector.

   If you describe what you are aiming for as an end result we guide you in the right direction.

   Duane B

rcarduino.blogspot.com




Logged


Recanati (MC)
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi! firstly, thanks a lot for the interest. secondly, all i have to do is a sensor that check whenever a person passes between an IR led and the receiver, using only one arduino and keeping the RX and TX pins free. any advice?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   The best advice at this point is to get on and do it, when you have problems come back, but try and see how far you can get first.

   The first thing you will need to do is generate the 38Khz signal, you can do this on Arduino, there are lots of code examples for using the timers to do this.

EDIT: As Chargin has mentioned already, there are some restrictions on the type of signal the IR Detector will accept. You can see these on page 5 of the datasheet you linked. I suggest that you do the maths on some of these restrictions and determine whether you think this device is suitable for your application.

Duane B

rcarduino.blogspot.com
« Last Edit: March 13, 2012, 02:55:48 am by DuaneB » Logged


Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   This hack has just occured to me -

1) When the IR Receiver you are using detects a valid 38Khz signal, it initially changes its output to show it has a valid signal
2) Shortly afterwards it will change back because the continuous 38Khz signal is not within the signal rules (page 5 of the datasheet)
3) From this point onwards, the receiver will ignore the presence of the 38Khz signal

Now for the hack -

If someone happens to walk in front of the receiver, it breaks the continuous 38Khz signal briefly.

As soon as the person passes and the receiver picks up the 38Khz again, it assumes - 'Hey this is a good 38Khz signal' until after a short period it realizes - 'No, its not'. The good news is that during the brief 'Hey this is a good 38Khz signal' the output will change allowing you to count traffic.

Its a bit of a hack, but it is based on a valid interpretation of the datasheet.

Using this method you could use a separate 555 timer to generate the constant 38Khz signal, this would free you from running wires between the transmitter and receiver.

Duane B

rcarduino.blogspot.com



Logged


Recanati (MC)
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, that's what i was thinking about! also, the 555 stand-alone signal generator is such a brilliant idea! so, as soon as i'll get the 555 timer works, i will write some code to manage its pulses!

thanks, by now smiley-wink
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33301
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
shall i use another device in order to achieve what has been written above? if so, which one?
Yes.
Use a TSOP4038, that will stay high when you send a continuous modulated signal to it.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

That's useful to know, it's handy to have the 38khz detection but the additional signal rules that most receivers come with are a real pain to live with in lots of applications, including my lap timer and the OPs traffic counter.

Thanks

Duane B

rcarduino.blogspot.com

Logged


Pages: [1]   Go Up
Jump to: