Electronic ScareCrow

I’ve been working on a little project for the past several weeks and now I’m documenting it, or some of it. I thought I would share my efforts with anyone who may be contemplating a similar project. I know I would appreciate it if I ran across this prior to getting into it in a big way.

It is an electronic scarecrow. See, I have this problem with my local avian friends pooping all over my pier. They sit on the handrail and let it fly all over the handrail and pier. I’m putting in a laser at one end of the pier, focused on the far end and running about 3” above the handrail. When the beam is broken several jets of water are sprayed all along the pier for several seconds, scaring the bird away. At least that’s the theory. Birds eventually get used to stuffed owls, snakes and cats used as scarecrows but this should be different.

The transmitting laser was bought from Amazon at the ridiculous price of 50 cents each (see attached photo). The laser even has a focus ring to help collimate the beam. At 300 feet the best I can get is a 2” x 3” oval spot. And having walked in front of the beam once, I was impressed with how bright the beam is as it swept across my retina. It left a streak lasting a few minutes. Detecting this laser at 300 feet was easy. The hard part was and still is, aiming the laser. Whatever it is mounted to needs to be incredibly stable. The other hard part was insuring that it worked in bright sunlight and at twilight. It needs a very wide dynamic range. It doesn’t need to work at night, so when I get around to it I’ll add an ambient light sensor to shut it down at night.

The laser is powered by 5v and has its own current limiting resister built in, and is modulated at 20 Hz by an Arduino. A 555 timer IC could be used just as well.

The receiving end of the beam does need a micro to detect that 20Hz and to control the water jets (Arduino of course. I’m using a Nano Every.) I went to some effort to try to eliminate false detections. To detect the beam the software looks for a low-to-high signal transition on an input pin from the detection circuitry. Receiving 2 low-to-high transitions separated by 50ms (+/- 1ms) constitutes a valid signal being received. If no such signal is received within 300mS we try to receive for another 300ms, and if nothing is received for that period we consider the beam as broken. As long as a valid signal is received we do nothing. When the beam is broken we activate the water valve for a few seconds and then start a lockout timer that effectively disables this software for 1 minute. At the conclusion of the 1-minute lockout time we continuously attempt to receive a valid laser signal for 1 minute continuous (indicating the beam is unbroken) before we reactivate the software. This prevents repetitive and/or continuous activation of the water valve caused by rain, lightning, or anything that will cause an abrupt change in the phototransistor's output. It needs additional software to lock out detections if we see an unreasonable number of activations over a period of time (like rain lasting for over 15 minutes or so). That’s on my to-do list.

Not shown in the attached schematic is an N-channel MOSFET driven by an Arduino output pin to control the water valve.

The purpose of the attached circuit is to keep the phototransistor within its active range via the constant current provided by the 2222, although when a signal is received it is so strong that it momentarily is driven out of its active range on every cycle. (If there was no signal then there will be a steady state voltage at TP3 of around 2v regardless of the effects of ambient light.)

I guess what surprised me the most was how much range you can get with a 50-cent 5mw laser and an op amp. 300 feet is not its limit.

Hope someone finds this helpful.

Wrong tool for the job.
Lasers are rarely used for beambreak, because it's visible, potentially dangerous and needs accurate aiming.
A common 5mm IR LED, modulated with 38KHz, and a 3-pin receiver has an invisible beam of 5mm diameter, will work in broad daylight, doesn't need accurate aiming, and can bridge more than 300 feet without optics.
This experimental setup did 600 feet (>60m)
Leo..