We have some IR sensors (think garage door sensors mounted, except weatherproof) mounted on my dad's gates connected to a relay and timer relay, that controls a couple of bells, one inside and one outside.
Something goes through the gate, it activates the relays, and runs the bells until the object clears for ** seconds. The occasional bird or deer goes through, but only sets it off for a a second or 2, not long enough for a vehicle (he's on a highway, so no pedestrians).
I'd have to go over the wiring to tell you how its hooked up... we did the relay wiring 5 tears ago. .
Sent from my new phone. Autocorrect may have changed stuff.