Create Project Need help?
Roel Arits

Long range IR beam break detector

Status: Proposal
3699
14
votes
December 8, 2019 , Latest update: March 13, 2020
thumb-20200301204358.png
Introduction

When i was designing the cat repeller, i first wanted to use a IR beam break detector to trigger a water-jet to chase away the cat. Afterwards i changed to a PIR motion sensor, because it doesn't need a transmitter and a receiver that both need a power supply and have to be installed at a long distance from each other and need to point to each other. But the IR beam break detector still is a useful circuit, especially because it can easily reach up to 7 m distance while using only 1 single IR LED. When using multiple IR LEDs or a reflector to collimate the IR light, the distance can easily reach up to 10 m.
Important for an IR beam break detector is that it is not disturbed by other light sources, such as sunlight, candescent lamps that are switched on or off, etc. Additionally we want a decent range using only 1 or a few IR LEDs so we don't waste too much power. So we need a sensitive IR receiver. So why don't we use the same principle as the IR remote control of our television ? Well, we don't want to send IR commands and encode these commands to see if our IR beam is interrupted or not. Instead, we go down to the basics of the IR communication and use an integrated IR receiver module in the simplest way.
These IR receiver modules come in different frequencies : 30.3 kHz, 33 kHz, 36 kHz, 38 kHz, 40 kHz, and 56 kHz. I had some 38 kHz types lying around, so i used one of this frequency. The receiver has an internal bandpass that is set to this frequency, so it only "listens" to signals with this frequency. Further these kind of receivers have an open-collector output, meaning that the output will be pulled low when the receiver receives a valid signal.  The power supply for the receiver is +5V.
But what is a valid signal for this kind of receiver ? 
When just taking an IR LED and connecting it to the output of a square wave oscillator (that is capable to drive a LED) with a frequency of 38 kHz, the IR receiver output will go low for a short period and go high again.  That is not what we want, because ideally we need the IR receiver output to stay low as long as a valid signal is received, and go high when no valid signal is received.
So generating a carrier frequency only is not enough for this kind of IR receiver. The carrier wave must be modulated, i.e. switched on and off shortly and repeatedly, so it becomes a sequence of bursts. This is because there is an integrator inside the IR receiver that ramps up while getting carrier wave pulses. When the integrator reaches a certain threshold, the output of the receiver goes low.  The integrator will ramp down while there are no carrier wave pulses, so it is ready for the next burst. But when there is a continuous carrier wave without any gaps (no carrier), the integrator will ramp up and never down, so it eventually saturates. The result is that the output goes low at the moment the carrier wave is received, but goes high again after some milliseconds even though the carrier wave is still received.
Some IR receiver types are happy with a non-modulated carrier wave only and will give a low output as long as the carrier frequency is received. The IR receiver type that i used is the TL1838. This type of receiver does not work with a non-modulated carrier wave only.
The TL1838 IR receiver. that i used for this project, will only work properly when a 38 kHz burst is applied and when this burst is interrupted for a certain time before a new 38 kHz burst sequence is applied. The datasheet of the TL1838 states that it needs a typical burst period of 600 us and the typical gap between the bursts of 900 us. Further it states that there should be a minimum time of 5 ms between the burst sequences. 
While experimenting with these parameters, i found that when modulating the 38 kHz carrier frequency with a very low frequency of 70 Hz and lower, the receiver will continuously output the modulation signal, which is a square wave with a frequency of 70 Hz or lower. I tried a modulation of 45 Hz with a few different IR receiver types and all seemed to output a stable 45 Hz square wave. So that is the way to go for our beam break detector design. 
See picture1 for the modulated 38 kHz carrier.

So now we know what kind of signal we need to send out with the IR LED, but how do we detect when the IR light beam is interrupted/broken ?  When the light beam is interrupted, the output of the receiver will go high and stay high as long as the beam is interrupted. So we could use an RC network on the IR receiver output to get the average voltage of the square wave and use a comparator to check if this average voltage level is exceeded, meaning the output is constant high, thus the beam is being interrupted.
But i've chosen for another approach using a circuit that is called : "missing pulse detector". This missing pulse detector is setup so it will react when a high to low transition is missing, meaning the signal stays high longer than the time period that is set in the missing pulse detector circuit. The detector timing will be set so it triggers when the output signal of the receiver stays high for longer than 20 ms. We are using a 45 Hz modulation signal, so the normal length of the high and low pulse are both 11 ms. When the high pulse is longer than 20 ms, the missing pulse detector will trigger, indicating that the beam was interrupted. The missing pulse detector will not trigger when the beam is interrupted briefly for less than 20 ms. Any time can be set by choosing other component values if necessary. 

Circuit description

The IR transmitter

Lets start with the IR transmitter. The transmitter is built using 2x NE555 oscillators. The first one is U1 and is configured to generate a 45 Hz square wave with about 50% duty cycle. To get this 50% duty cycle, we choose a value of R1 that is a bit smaller than the value of R3, and we use a diode to make sure that the charge time of C3 is only determined by R1 and the diode, while the discharge time is determined by R3. The high time will roughly be around 0.7 * R1 * C3 (neglecting the influence of the diode) and the low time will roughly be about 0.7 * R2 * C3. The total period of the square wave will roughly be 0.7 * (R1 + R3) * C3 (again neglecting the influence of the diode). With the chosen component values, the period of the  square wave at the output of U1 (pin 3) will be about 22 ms, resulting in a frequency of 45 Hz.
The second oscillator is built around U2, that will generate the carrier wave frequency of 38 kHz that is required for the IR receiver to operate. U2 is configured to generate a square wave with a near 50% duty cycle. The frequency can be adjusted by P1 between 34 kHz and 44 kHz. This frequency range can be extended by using a higher value potmeter and lower value for R5. The charge time of C4 will be determined by the sum of R2, P1 and R5 and the discharge time by the sum of P1 and R5. Because R1 is small compared to the sum of P1 and R5, the charge time will be very close to the discharge time, so the square wave will have a duty cycle close to 50%. The period of the square wave will be about 0.7 * (R2 + P1 + R5) * C4.
By connecting the output of the first oscillator U1 with the /RESET pin of the second oscillator, the first oscillator will gate the second oscillator. When the output (pin 3) of the first oscillator (U1) is high, the second oscillator (U2) will be outputting a 38 kHz square wave. When the output (pin 3) of the first oscillator (U1) is low, the second oscillator (U2) is reset and its output will be low as long as the output of the first oscillator is low. This way we create a 38 kHz burst signal using a 45 Hz modulation signal that is output by IR LED D2, that is connected to the output (pin 3) of U2.

The IR receiver

The IR receiver is built using the TL1838 IR receiver, a missing pulse detector and a monostable multivibrator (one-shot).
The TL1838 IR receiver U3 will output the 45 Hz square wave, that was used by the transmitter to modulate the 38 kHz carrier wave. When the light beam is interrupted, U3 will output a constant high voltage (5V level) at its output pin 3.  The output of U3 is connected to the input of the missing pulse detector that is built around U4 and Q2. Lets assume that the output of U2 is low. Then the tigger input of U4 is low, meaning that it will set its output (pin 3) high. At the same time, the base of PNP transistor Q2 is low, meaning that it will pull the threshold pin low and will discharge C11. The output (pin 3) of U4 stays high. Now assume that the output of U2 becomes high. Then the base of Q2 will be higher than its emitter, so the transistor does not conduct and C11 will start charging via R7. The trigger input (pin 2) of U4 now is also high now, but since it is a active low input, this does not change anything. C11 will keep on charging until the threshold (2/3 th of the power supply) is reached. When this threshold is reached, the output (pin 3) of U4 will go low. But the values of R7 and C11 are chosen so the time that is needed to reach the threshold is much bigger (approximately 2x bigger) than the period time of 45 Hz square wave that is output by U2 when the beam is not interrupted. That means that as long as U2 is outputting the 45 Hz square wave, the voltage over C11 will never be able to reach the threshold value, because before that time, the output of U2 has become low again and Q2 will have discharged C11 again. The time for C11 to reach the threshold is about 1.1 * R7 * C11 = about 24 ms, while the time that the output of U2 is high or low is about 11 ms. So the missing pulse detector output (pin 3 of U4) will only go low when the IR beam is interrupted longer than 24 ms. The red LED D4 will light up when the beam is interrupted When the beam is not interrupted, the output of the missing pulse detector (pin 3 of U4)  will stay high and the red LED D4 will be off.
Additionally U5 is added as a pulse stretcher (one-shot or monostable multivibrator). The output (pin 3) of U5 will go high for about 2.4 seconds after the output of the missing pulse detector went low, indicating that the beam was interrupted. The blue LED D4 will light up as long as the output of U5 is high. The time that the output pin 3 of U5 will stay high is given by 1.1 * R6 * C10. Because the trigger input of the NE555 is low active, the signal to trigger the monostable at pin 2 of U5 should go low momentarily when the output pin 3 of U4 goes low. This is achieved by coupling pin 3 of U4 to pin 2 of U5 via a differentiator formed by C9, R8 and D3 that will convert the high to low transition of pin3 of U4 into a low going spike  at pin 2 of U5.
The range of the long distance IR beam break detector easily reached 7 meter using a single IR LED driven with about 10 mA, which is well below the maximum current. When you need a longer range, you can add extra IR LEDs. The NE555 can sink and source 200 mA, so you could easily connect 10x IR LEDs to its output and you can increase the current through each IR LED up to 20 mA by lowering the series resistor for each IR LED to 100 Ohms (when you are using a power supply of 5V).  A reflector that collimates the light of the IR LED will also help to increase the distance because the light that would otherwise escape will now also be concentrated towards the receiver.
Read the full post
Show less
Images
38 kHz burst signal of the IR transmitter
IR transmitter
IR receiver

Loading comments...