IR Receiver / IR LED using AXE091 DEV BOARD and 08M2

hippy

Technical Support
Staff member
One question I have about IR receivers, do IR Receivers have a specific pulse width fequency and duty cycle associated to them?
Welcome to the PICAXE forum.

IR Receivers work best with certain frequencies of light coming out of the IR LED and certain rates of pulsing of that light ( usually somewhere between 36kHz to 40kHz ) but are also sensitive to how long such pulsing is present for. They like it best when that pulsing is turned on and off rather than when left on continuously.

What you can do is issue a PWMOUT at 38kHz, check if the IR Receiver sees the IR ( 0 = Yes, 1 = No, beam broken ), then turn PWMOUT off and leave it for a short while before repeating, turning it on and checking again.

Though this means the IR beam may sometimes be turned off, unless your wannabe intruder is a super hero travelling at fantastic speeds, they won't be able to get through the beam before it is turned on again.

I am not clear on what you mean by adjusting sensitivity of the receiver; it would probably help to describe in what way it's not doing what you want it to.
 

hippy

Technical Support
Staff member
I have it working, but a super hero can definitely get through the beam. It almost seems that there needs to be something obstructing the beam for almost a full second.
I suspect that is through using PULSIN rather than just checking the level of the IR Receiver output. If there is no IR there will be no pulses so the PULSIN will wait until it times out before proceeding.

In a perfect world, with continuous IR or continuous lack of IR, the IR receiver should not change output state so there will be no pulses and varA should always be zero regardless of beam being broken or not. This and the two second delay in LED control may be adding confusion as to what is actually happening.
 

rossko57

Senior Member
As Hippy says, PULSIN is not a good tool for detecting missing pulses. It's intended to measure the length of a pulse, and is fairly patient about waiting for that pulse to arrive, so it can never be quick telling you the pulse never does arrive.

As you are producing a stream of thousands of pulses per second with PWM, you might use COUNT instead. You choose a window of time, which can be very short, and it counts pulses arriving (if any). You could set up a window of say 5 expected pulses duration. If the count result is in the right area, say 4 - 6, the beam is "good". Outside of that, it's broken.
The advantage is that detection time is as long as the window you choose - which can be considerably shorter than PULSIN timeout.
You can tweak response to an extent by altering the window period, and the leeway you allow in expected pulse count, to allow some immunity to dust motes and flies, while still detecting cats or superheros etc.
 

hippy

Technical Support
Staff member
As you are producing a stream of thousands of pulses per second with PWM, you might use COUNT instead.
Though the IR LED is being turned on and off at 38kHz by the PWM, the IR Receiver output reflects only the presence of 38kHz IR or lack of it, so there won't be any pulses seen. Only if the 38kHz is applied then not applied will that appear as pulses on the IR receiver output.
 

Goeytex

Senior Member
Vishay is by far the leading supplier IR receivers. There are many different types of receivers where some are suited for
short bursts ( remote control) and some are better suited for make/break object detection. I am not sure what reveiver
Rev ED has included with the Axe091 since the datasheet does not provide any information on it.

What you need for best make/break performance is a TSSP4038 or TSSP58038. These are fixed gain receivers that are
recommended by Vishay for make/break digital output.

A continuous 38Khz PWM is applied to the IR transmitter and is received and "decoded" by the receiver. If the signal is present,
the output is low. When the beam is broken the output will be high. According to Vishay, the response time should be about 300us with
a continuous 38kHz beam.

If the Axe091 has a receiver that is specifically designed to be used with the SONY IR protocol, it may not be very good at object
detection (make / break). I have seen some receivers that would "time out" and not remain low in the presence of a continuous
38Khz beam.

Since the output of the receiver is either a 1 (no signal) or a 0 ( signal detected), then the code only needs to test if the input pin is either a 1 or a 0.
 

hippy

Technical Support
Staff member
This seems to work for me with my AXE091 board. The LED lights and stays on for a second as soon as the beam is broken.

It can be difficult to actually break the beam using the IR LED and IR Receiver on the board as IR can pass through whatever is being used to block the sensor or bounce around it. Disconnecting the IR LED wire simulates the beam being broken and should set the LED for testing.
 

Attachments

Top