IR receiver

borz

Member
HI

I am using a TSOP4138.— VISHAY IR receiver to make object detection project. The question I have is that in the data sheet (pg 1 under Circuit application) it states The output voltage should not be held continuously at a voltage below Vo = 3.3v(Vo is between output pin and GND ) by external circuit. I am using a picaxe 08M to detect the output . Can someone please shed some light on this . Attached is the data sheet

thanks
 

Attachments

BCJKiwi

Senior Member
I use the Vishay TSOP4838 which appears almost identical.

Basically the output should not be held low (i.e. the PICAXE port set as an output low which basically shorts the output to ground!). Presumably this would draw too much current from the output stage and overheat/damage the receiver chip. As you are using the 08M and infrain2 can only use input 3 which is always an input (unless you do some poking) this should never happen.

The standard PICAXE setup as per manual2 page80 is different from the Vishay circuit. Use the Vishay circuit! (I'm using a 28X1 and don't actually have either the C or R installed at the moment and everything is fine. Will test the C and R before going to final assembly.
 

borz

Member
I use the Vishay TSOP4838 which appears almost identical.

Basically the output should not be held low (i.e. the PICAXE port set as an output low which basically shorts the output to ground!). Presumably this would draw too much current from the output stage and overheat/damage the receiver chip. As you are using the 08M and infrain2 can only use input 3 which is always an input (unless you do some poking) this should never happen.

The standard PICAXE setup as per manual2 page80 is different from the Vishay circuit. Use the Vishay circuit! (I'm using a 28X1 and don't actually have either the C or R installed at the moment and everything is fine. Will test the C and R before going to final assembly.

Thanks for that BCJKiwi. Makes alot more sense .

Now all I want to do with it is detect if the 38khz signal is present or when that IR beam interrupted which occurs when object is detected . The setup is with a 555 timer modulating the transmitter with 38KHz and IR receiver at the other end . Would that serve the purpose ie the infrain2. sorry mate if sounds all too simple for . I am still trying to get the hang of things

thanks
 

manuka

Senior Member
Borz- re the 555. Ahem -you DO realize the 08M can also generate 38kHz IR?

Aside from this, object detection by IR blocking rather depends on range. Close in there's so much IR bouncing around the vicinity that a typical detector mayl still respond even when the direct path is blocked. It's akin to ones TV remote still working when bouncing off the ceiling.

To beat this the IR detector may need very deep screening, or a hacked coin shop laser pointer may be used with a photo transistor instead. I recall this being discussed for a driveway a few months back.
 

Dippy

Moderator
Borz, I just re-read. If you're just looking at break-beam sesning from a TSOP you just look at pin logic. For a continuous 38kHz there is no need for Infrain.

What Stan/Manuka says is quite true about bouncing around so you will have consider shrouding the receiver too i.e. make the whole system more directional. Not difficult.
And as he says about 08Ms doing the 38kHz makes them a more precise/stable than a 555, albeit a few pennies more expensive. But it would have the advantage of being programmable so can be controlled easily.

Not sure whether laser is applicable. Laser without modulation can be hefty on batteries. And photo-transistors are quite sensitive so they would need careful shrouding/shielding if the ambient light level is high. If going the photo-t route consider the types which have 3 legs; by biasing the base leg you can 'adjust' the sensitivity as they are quite on/offy.

And then with pin-point lasers they will be more diffciult to set up (fine alignment) and less tolerant to being knocked slightly. They could operate over larger ranges but any wobble would mess it up.

And of course there will now follow 30 posts on warning about lasers...

I'd start with exactly what you are doing and then develop it if needed. Good luck.
 

borz

Member
Yes Manuka I am aware that 08M can also generate 38kHz .

That's right Dippy you are on to what I am trying to do . Just sensing the beam breaking . All I have to do is look at the logic of output pin which I am also aware of. What had me concerned or I wasn't sure about was that in the data sheet it says The output voltage should not be held continuously at a voltage below Vo = 3.3v . But if my 08M is programmed as an input Would I have a problem . The TSOP output is active low therefore when beam is broken output goes high. ie 5v .The distance I am sensing is maximum 30MM.

Thanks everyone
 

manuka

Senior Member
30 MM? Did you mean just 30mm (~an inch)? Even LED beam breaking may do if this small a distance.
 

slurp

Senior Member
That's right Dippy you are on to what I am trying to do . Just sensing the beam breaking .
Oops, you've got a problem with the TSOP devices for continuous signals.... check out the last page of the data sheet, the device will attenuate a continuous frequency.

I'd second the suggestion for direct detection, IR LED to Photo-transistor. Optek have a good application sheet:-

http://www.optekinc.com/pdf/App%20Bulletin%20213-Opto%20Assemblies.pdf

This works well for reflective or direct transmission.

regards,
Colin
 

borz

Member
Yup meant 30mm

I did try direct detection had problems with interference.Sunlight etc.

Thanks very much Colin will have look at that data sheet

How does this sound if I sent short brusts of IR, in other words, do not send continuously 38Khz signals, instead send some milliseconds, then stop for a few more milliseconds, and start again ?

thanks
 

Dippy

Moderator
I'm not exactly sure what that comment (re: continuous signal) means in reality. Maybe it just turns its AGC right down?
Personally, before going to any extra coding effort I'd try it. After all 30mm is a piddling distance.
It ain't going to explode. try it.

If you need to modulate then 2 things:
1) You will need to modulate your 555 with something else (a 556?).
2) You will need to: either write a 'missing pulse' routine for the receiver PICAXE or use a simple rectifier style input to sense. e.g. the received pulse keeps a capacitor pumped up and a missing pulse allows it to discharge; detectable.

Questions:
1. 30mm eh? Close enough for a little wire from PICAXE? Saves a 555.
2. Does the response time have to be super fast? What sort of object detection reaction time is needed? Seconds? nanoseconds?
(This may affect choice of bits :) ).
3. Prolonged battery powered?
 

borz

Member
Well dippy its for detecting letters in my mail box outside . So all I need it to do is break the beam . So time is not that important I think . Thinking of running it on solar ? want to add more extra bits to it . The only hitch I have with whole project is the detection method.

30mm is the gap from which the letter is being dropped.I have tried the setup it does work . But that was only on the breadboard . I just might run with it anyway and see what happens ?

someone has built a sensor like that . check the link out

http://www.trainelectronics.com/artcles/PulsedIR/index.htm

thanks again
 

Dippy

Moderator
Oh, so you could easily make the PICAXE do the transmission modulation and reception.

Do you need all that complication and expense?
If the mailbox was fairly light-proof you could just manually (in code I mean) on/off the IR LED to a suitable photo-t and AND it surely?
Switch LED on ... is my photo-t on? (logic 1 or 0 on a pin)... [switch LED off].....yes- nothing there ... no - something blocking beam .... keep checking for a block until its gone ... count. etc.
 

BeanieBots

Moderator
Well, the link you supplied gives more detailed information than you're likely to get here! It describes in great depth everything you need to know.
It's VERY simple for your application. Send 38khz via IR LED and the Rx will be held low until the beam is broken. Use an interrupt to detect when it goes high. Job done.

If you want to go solar, and presumably with an RF link, then it gets a little trickier. That's because your LED needs to be driven all the time and will need a significant power supply with backup.
IMHO, IR beam is overkill for "letter" detection.
How about a simple push-make microswitch on the letterbox flap?
That could be used to trigger a solar powered Tx module with ease.
You could even use a wireless doorbell!
 

andrew_qld

Senior Member
A couple of suggestions...

Point the sensor down & perhaps use a short but of tubing to keep the sun out ouf it.

I think you could do this with a pulsed IR LED and IR detector with a short duty cycle (pulsed at say 10 Hz with a short nap in between rather than 38 kHz). This would reduce the power, and it would be a fast postie that could deposit a letter in less than 1/10th of a second.

I think I'd use a physical microswitch if I was doing the same thing though.

Cheers,
Andrew
 

BeanieBots

Moderator
The 38khz is a required modulation frequency to 'activate' the Rx.
However, you could modulate the 38Khz as suggested above to save power. You could then either poll the Rx or sync the modulation with your interrupts.
 

Dippy

Moderator
Assuming the mailbox is fairly lightproof why go to all the expense of 38kHz/demod.
A simple on/off LED/Phot-t pair with simple code should be good enough.
I honestly don't know why all the extra effort/components is/are required(?), please explain.
 

borz

Member
I have tried the uSwitch idea . There is no flap to open just drop it thru the gap . also the lightest letter wouldn't even trigger the switch so that was that .


I revisited the first prototype (IR LED and photo transistor ) using last night and have changed the position of the RX ie pointing down and I stuck the leds in a black plastic tube worked a treat in the house with fluros on will try outside in the coming days . Just like what Andrew suggested.

Dippy I like the bell option too :)

thanks again everyone
 

dj_trippn

New Member
Hi Borz,

did you get your IR sensor working?

I am trying to implement a similar option. I have a human interface where they have to enter a business card sized card (alot thinner though). I have a IR led and a IR phototranistor. I simply turn on the IR led and then check the intensity of the IR receiver (ADC) then I have a SP value which allows me to detect which the beam is broken or not. This worked great for alot of testing but eventually I discovered the IR receiver is getting saturated by sunlight (I am using black tubing and have made a decent effort to direct the RX towards the IR LED and shielded from sunlight). But it is still causing problems every now and then.

My question is can I use a irout command to send some bogus data to a a 38kHz IR reciever and then read the data from the reciever on the same picaxe? This modulated signal should therefore not get affected by sunlight, correct?

Is this the correct way to do it? All I need to do it send a burst of 38Khz to the IR LED and look for a high on the 38kHz receiver input, but I dont know how to send a 38kHz burst while checking the input at the same time, unless I use a pwm (I can't as they are already used).

After writing this I am just wondering why I am not using a uSwitch.... I think i though I would have issues with the "business card" being to light, also the uSwitch failing (getting jammed etc.)


Thanks heaps
 

Andrew Cowan

Senior Member
The three pin IR recievers Rev ed use have a built in 38KHz demodulator - they handle the decoding.

Maye a 555 timer could be used to handle the encoding?

A
 

dj_trippn

New Member
Yes I am using this receiver thanks. My question was can I can the IR transmitter LED and the receiver from the same picaxe?
 

hippy

Ex-Staff (retired)
No, the PICAXE cannot be executing IROUT and IRIN at the same time, so whatever you sent with IROUT would have gone by the time you came back to read it with IRIN.

You could connect the IR LED to a second 08M and have that free-standing ( apart from power ) which simplifies modification, and have it regularly send an incrementing IR code. The main PICAXE can do a number of IRIN's and when the last received is one more than the previous you know you have a good link.
 

Dippy

Moderator
Assuming this is really short-range stuff, I am genuinely surprised that you can't get a little break-beam to work.

Black tubing will be almost useless with high ambient background light.
Though this depends on the absolute distances involved.
Many blacks appear white to an infra-red sensor.
And, regardless, there will be a lot of internal reflections with a simple tube.
I have shown a better way of shielding below using baffles.
This method is commonly used in refractor telescopes.
NOTE: That a plastic Photo-transistor will have to be shielded ALL THE WAY ROUND the back from ambient light.

In this diagram, washers (as in nuts & bolts) can be used as baffles in a fatter tube.
Some matte black aerosol spray paint is a good near-IR absorber.
I found rough matte black anodising very good, but a little tricky for this ;)

If you still have problems with ambient light, here are a couple of points:-

1. Photo-diodes have a much greater dynamic range than photo-transistors.
Photo-transistors saturate easily, so, for high ambient light apps, always use photo-Ds.
They will still need shielding/shrouding to get the best SIGNAL:NOISE ratio - as that is what you are after.
Modulating/demodulating is by far the best.
It is easier to 'pick out' an AC signal sitting on a DC (ambient), rather than a tiny change in DC (i.e. a signal sitting on ambient).
This would, however, require a bit more electronics to make effective, so maybe a little OTT for this little app.
But, for simple, very short range stuff, where shrouding/shieldng is easy then photo-tr should be perfectly good.

2. Using a pukka receiver module.
This is the most convenient as it will have the photo-DIODE (note), demod, amp and o/p stage all in a neat box.
Be aware, they tend to be wide-angle reception with AGC, so will need shrouding,sheilding too.
Why? To improve S/N and also to stop your signal 'creeping around the edges' or bounced off things.
I daresay, for thin card, that if you have your LED too bright then the AGC may be high enough to see it through the card. This WILL require some experimenatation by you. So, if it does then increase the Res to your LED. It may be fine but jut remember this point.

Yes, as said, you will need a secondary supplier to produce the 38kHz LED 'carrier' signal.

I, too, would try a 555 or similar astable (if on a budget) to provide it.
No modulation of that carrier would be needed here I ASSUME. It is simple on/off yes??

Right, that's your homework done, whats next :)
 

Attachments

boriz

Senior Member
I have been planning a beam break system for external security in the garden:

The RX: Use a (shaded) IR phototransistor with a transistor current source instead of a collector resistor. The current source is auto-biased to make sure that the IR phototransistors output is always roughly in the middle of the voltage range. The output is AC coupled to a single transistor voltage amplifier then to a PICAXE Schmidt input.

The TX: An IR LED driven with very short pulses of high current at a fixed frequency, somewhere between 1 and 10 kHz, by a 555. A short focal length lens is used to focus the IR into a beam. The beam at around hip height to avoid animals. (don’t expect anything bigger than a dog)

The PICAXE uses the COUNT command to determine if the appropriate number of pulses have been received in a short time interval. If not, then the beam has been broken. EG: @5kHz, if less than 1000 pulses are counted in 200mS then beam broken. To minimise possible false positives (eg. leaf or bird), the test will actually be less. Maybe 700 or so for 5kHz/200mS. Experimentation will provide the ideal figure.

The auto-biasing plus the modulation should take care of any ambient light problems. I have yet to determine the range, but I’m expecting at least 5 metres.
 
Top