Arduino Light-Barrier with TSOP4438

you just want to build a Light-Barrier (DE: Lichtschranke) ?

for example to measure speed? Or Count goals on a Table-Top-Football?

then you are at the right place.

We use a TSOP4438 as Receiver and some 5mm IR-LED as Sender.

the code

deep dive into the details

To get the TSOP4438 to work we need to send a 38kHz Modulated Signal from the LED. the catch: the receiver is designed to ignore CONTINUOUS signals – that is the way to also reject all the Disturbance from surrounding things like Fluorescent Lamps or other things…

therefore we need to modulate again the 38kHz signal:
so that there are times the signal is send and breaks where the beam is off. The timing requirements for this Pattern are described in the Datasheet :

Minimum burst length 10 cycles/burst

After each burst of length 10 to 40 cycles
a minimum gap time is required of ≥ 10 cycles

For bursts greater than  40 cycles
a minimum gap time in the data stream is needed of  > 10 x burst length

Maximum number of continuous short bursts/second 1500

To Be continued…

Research:

  • https://www.vishay.com/docs/82459/tsop48.pdf#page=6&zoom=250,-155,381
  • https://forum.arduino.cc/t/how-to-create-a-38-khz-pulse-with-arduino-using-timer-or-pwm/100217/12
  • https://forum.arduino.cc/t/how-to-create-a-38-khz-pulse-with-arduino-using-timer-or-pwm/100217/64
  • http://www.gammon.com.au/forum/?id=11504&reply=6#reply6
  • http://www.gammon.com.au/forum/bbshowpost.php?id=11504&page=2
  • http://www.gammon.com.au/images/Arduino/Timer_2.png
  • http://www.gammon.com.au/images/Arduino/Timer_1.png
  • https://arduino.stackexchange.com/questions/31187/irremote-send-and-receive-same-arduino
  • http://www.righto.com/2010/03/detecting-ir-beam-break-with-arduino-ir.html?showComment=1447463463512#c570784324410264988