IR break beam sensor

Hi, I am trying to create a break beam sensor using infrared.

I want to mount the detector 30cm away from the emitter. When an object passes through the beam I should be able to read this with my arduino.

I tried with this to begin with:

this was successful when transmitting the beam over about 4cm. It read 39 over analog when there was a beam and 999 ish when the beam was interrupted. When I tried this over greater distances the performance worsened the further I moved them apart. At 30cm it is really unpredictable and its performance is affected greatly by the level of ambient light in the room.

So I am looking at other solutions. I saw this article/ project:

They have created a successful break beam over what looks about 6ft of distance. They said they used this receiver:

I am just wondering what emitter they paired it with. He states that he got the emitter emitting at 38Khz using code. I was wondering if you can ready buy emitters that emit at 38khz? Either way can anyone suggest a good emitter to pair it with. I am looking at this:

Would it be easy to drive this at 38khz using pwm or something?

Thanks for any help you can offer, Will offer much karma in return ! :)

You want the part TSSP58038 or TSSP4038. The TSSP58328 is OK, but you have to send it specially patterned codes rather than the plain, boring, 38KHz signal that the 58038 or 4038 allow.

Then read:

You can create a 38KHz beam with a 555 timer or an ATTiny or such. Just depends how cheaply you need to make your transmitter where size or price is an issue.

You can reliably expect ~3' distance with a 20ma red LED as the emitter, 6' with a 20ma white LED, 10' with a 20ma IR LED, and "lots" of distance using a cheap, red laser pointer.

Hi thanks for the advice, Im using a TSOP38238 to receive and a 950nm infrared led. It seems to work if I just blast the receiver with 38Khz, no codes, and it recognises when the beam is broken. So all seems to be pretty sweet, but if i have any issues il look at those other sensors Thanks

I would have expected you to see problems; the datasheet for the TSOP38238 states distinctly that it needs a 10 pulse pause after 70 consecutive pulses.

So those other models dont need the 10 pulse break? and I can just blast them without codes with 38khz IR LED?

Just so you have a clearer picture of what im doing, Im running the led through a 330 ohm resistor. one side runs to ground, the anode side runs to digital pin 4 on an uno.

Im using the tone( ) func to put a 38khz frequency over that wire out of pin 4. Seems to work, I cant see it pausing, is it because im not sending codes and merely just turning the led on?

I might wish to send codes, I havent totally figured it out yet, if so which of the two sensors you mentioned is the best at blasting straight IR at 38khz with no breaks

Thanks again

TSSP58038 and TSSP4038 are essentially identical – just differently shaped packages.

You say you can’t “see” it pausing; do you have a circuit with the TSOP38238 lighting an LED (etc.) to see when the beam is open/closed? Because it might actually be forcing pauses but blinking so quickly that you can’t see it.

I just didn’t expect it would work so I’m saying you should double check things. Don’t read into it any more than that :slight_smile:

Ok cool, just looking into this now, do you know anything about the viewing angle of these sensors? I am planning to use a few beams close together but want to avoid inteference. I am using a ir led with a narrow viewing angle. I cant figure out from the data sheets which has the narrowest viewing angle out of the 4 or 5? or do you think this might not be an issue if I use a led with a narrow viewing angle? Thanks

Just enclose the IR receiver in a short tube to shade it from other nearby emitters.

Hi IR guys, would you peak into my issue at "Light sensor reading problems"... i think you got the knowhow to see what's wrong.


I picked up some TSSP58038 to test them out the other day. I read the data sheet and they said they can take continuous bursts and the datasheet from the TSOP 3* says they need breaks. The TSSSP5 also says its made for break beam applications. Where as the TSOP3 is made for remote control etc. So I was convinced the TSSP5 would perform better. So I picked a few up to test. Strangely they performed far worse than the TSOP3 and were pretty unpredictable. The TSOP3 is solid and works perfectly for this application as far as I can tell, whereas I had real problem with the TSSP5.

Is real strange, the datasheets make the TSSP5 sound like the perfect choice for this application. Either ways thought Id post this incase anyone else reads this post when trying to make an IR break beam.

Thanks for all the advice, I totally agree with you that the TSSP5 should be the perfect choice for this application and the TSOP3 in theory should be buggy, but it is strange how it works out. Thanks again

Two things with respect to unreliability:

  1. Receiver is in bright light / direct sun. This causes it to send lots of spurious signals.
  2. The datasheet recommends use of a capacitor and resistor near the receiver to filter out dirty power. I didn’t need that myself and was using ~1 meter cables to connect the receivers, but y’know.

Other than that, I dunno. Your results are interesting to say the least.