If you need to detect motion, a PIR is the obvious choice. On the other hand, it picks up any sort of movement in an area and doesn’t let you choose where you’d like to detect movement. IR beam sensors are one short-range alternative, but for a long distance “no-cross” line, this project presents a (literally) laser-focused sensing system.
The setup has two parts, a laser diode assembly — basically a normal laser pointer with an extended battery pack and a tripod mount for easy aiming — and a receiver containing a Particle Argon board and a phototransistor. Once initiated, the laser shines a constant beam on this sensor, and when someone or something interrupts it, the alarm “sounds.” In this case the alarm isn’t an audible tone (though one could presumably be added), but a WiFi signal to an always-on computer running HomeBridge. This allows the new — and otherwise unsupported — IoT device to work with Apple’s HomeKit home automation framework.
From there, the HomeBridge/HomeKit computer — a Mac Mini, though other systems could be used— relays this info to the wider Internet, and your smartphone if you so desire. Check out a demo of the rig action below!