Friday, June 4, 2021

Using a Break Beam Sensor with Python and Raspberry Pi #RaspberryPi #PiDay @Raspberry_Pi @simon_prickett

Simon Prickett (@simon_prickett) writes about using a break beam sensor with Python and Raspberry Pi.

The emitter and receiver work together so that when something passes between them breaking the infrared beam, an event occurs that your code can pick up and use. These events are detected by using the third wire on the receiver to connect to a GPIO pin on the Pi that is set as an input. From a setup and coding perspective, break beam sensors are a very similar sort of input to a button or the magnetic door sensors the I’ve written about before.

These sensors are pretty cheap, I got mine from Adafruit (product page here) for a couple of dollars each. They sell them in various sizes – basically the bigger the size, the further apart you can place them and still expect them to work. I’d imagine that the larger ones also really do need 5v power rather than 3.3v, but I haven’t tried them.

See the video below and project details on the blog here.

No comments:

Post a Comment