Motion Detection and Rangefinding

When you look at these schematics, I hope you will keep in mind that this ain't popular electronics. These drawings are made after the machine is working, not before. Good engineering practice is recognized in the shop, but cut-and-fit tinkering is the process. Art and design are not the same thing. Design is problem solving.

Passive Infrared Motion Detector

This circuit was originally reverse -engineered from a motion detecting yard light that I ripped apart. That's still probably the best way to get the parts at a reasonable price, especially the pyroelectric sensor and the absolutely necessary Fresnel lens. The signal at pin 7 of the 324 is very interesting and fooling with the filtering around the first amplification stage can make it even more so. The LM324 is a wonderful little bug, and you will find many uses for the window comparator if you look at it the same way you would learn a new really useful knot. It all works on a single 5 volt supply. The sensor is only sensitive to changes across its surface, so don't expect a signal from a static object even if it is hot. Yard lights are turning up at flea markets and yard sales as people find themselves heads up every time the cat walks past. This circuit is in a machine that sees people moving 40 feet away.

40KHz Ultrasonic Rangefinder


This is an echo detector which will reach up to about 25 feet. This particular circuit resolves about 6-7ft. into six bits, so the resolution is a little more than an inch. The digital output is useful for interfacing with a processor, but if you get the send and receive parts working, you can treat the signals any way you want.

If you see a way to make it more simple, please let me know. It is essentially a bistable switch which is set by an external pulse, causing the send transducer to beep, and starting a counter that runs until the beep echo returns and resets the switch - OR until the counter goes around to zero, whichever comes first.


The transducers are cheap and available in surplus these days. All the ceramic ones I have tried seem to work, but watch out for those requiring a high-voltage drive. Digi-Key has a set that will do (Panasonic type U). Start by building the send circuit (transistor 2n4401). The parallel resistors are for trimming the frequency to 40KHz. You don't need to measure, just connect pin1 to the positive supply, hook the receive xducer to a scope and with the xducers close coupled, peak the signal by adjusting the resistance.

If this looks like a mystery, find out about the 4093 CMOS quad Schmitt nand gate, possibly my personal favorite.


The receiver is a little more touchy because the second stage is a filter that's tuned by the two caps and feedback resistor. Work on it live with the sender blasting away, and peak the signal at the output of the second stage. This is not real selective filtering, but it keeps most audible sounds from triggering the receiver. You don't need some fancy scope to do this.


The start pulse should be short as possible at the gate input, and almost any negative edge can be accomodated by adjusting the cap and resistor.

Another possibility is to buy the cheapest ultrasonic 'tape measure' you can find and pull the signals out of it. I can never get those things to look right in my machines.

back to q and a