Tuesday 21 July 2015

Bat Detector Overhaul

About 8 or 9 winters ago, I made a bat detector based upon a circuit published by Chris Eve.

It has never quite lived up to expectations, and has been modified a few times over the years without great effect.

But now its time has come, and I'm looking more closely at ways to improve performance.

I have to admit that my bat detector is only ever used in our garden, and only during the late summer, usually as the sun goes down after a B-B-Q. As there are relatively few occasions when all the boxes are ticked (e.g. warm evening, not raining, clear sky, not out somewhere else, nothing good on tv & so on) it has not seen much action.

I don't know what has happened to Chris Eve (or his website) but his circuit has been reproduced a few times around the web, like on this site.

The original circuit calls for a small electret microphone, which I initially used in my detector. But I had sensitivity and stability problems, so at some point I replaced it with an ultrasonic receiver. This allowed me to detect real live bats at a range of (maybe) 10metres, providing I could see the bat coming straight towards me!

Electret mic (mk1) & ultrasonic receiver (mk2)

When this design is working properly, the range should be more like 30m than 10.

So in the last few days I've removed the ultrasonic receiver and replaced it with another electret microphone module. This one was salvaged from a headset, and leaves me with the problem of how to fill the huge hole in the box, left by the removal of the previous sensor.

Instability problems? ...I'm not surprised!

The original mic was 9mm in diameter, while the latest mic is only 6mm. I remember reading somewhere that the smaller the mic, the better its high frequency range (at least for this application). And a few crude tests using a cat scarer and rubbing my hands together seemed to show an improvement in sensitivity.

Cats & Hands?

Ultrasonic devices designed to scare cats produce some sort of rough signals which trigger the bat detector. Unfortunately when I switched our one on in the house to test my bat detector, my son went ape!

I can't hear it at all (...I blame Deep Purple who were the loudest band in the world when I saw them at the Rainbow in the early 1970s) but to his young ears it is the worst kind of torture. The lowest frequency in that sequence is only 16kHz, which is bound to upset anyone under the age of 30.

The other useful source of ultrasonics is to rub your dry hands together. This produces a good (but rough) rasping sound on my bat detector.

You can also do the Chris Packham thing, where you rub your hands on the thighs of your Levis. That works too. But I don't think Chris does it to test his detector or even attract bats, he just does it when he gets excited.

The Bat Detector Design

Getting back to Chris Eve's design, this detector picks up ultrasonic frequencies (say 20kHz to maybe 100kHz) and feeds the amplified signal to a divider chip. This chip triggers on pulses and affectively divides the incoming signals by 8. So a 50kHz signal (which none of us can hear) is divided down into a 6.25kHz signal (that most of us can hear).

Since the divider is a CMOS logic chip, its output switches from about 0Volts to almost the supply voltage. This signal is then attenuated via the volume control and fed into an audio amp which bumps the signal up to a level required by the loudspeaker or headphones.

The Instability Problem

Instability in my detector starts out as an occasional loud burp. Depending upon the sensitivity setting (and/or volume) this can trigger the device into rapid burping mode (like a machine gun) which is extremely unpleasant!

This instability is clearly more of a problem when the internal speaker is enabled (but still a problem with headphones). It is as if the sound from the speaker is getting back into the microphone and creating a feedback loop.

Using headphones with the detector is better, except that even just the single occasional burp goes right through your head! The sharp, sudden change from 0V to 9V and back to 0V fed from the divider to the audio amp is bound to sound unpleasant.

Looking again at the component values in the amp it suddenly struck me that Chris had just used a general purpose audio amp design, possibly straight from the LM386 application sheet.

Back to basics

What am I trying to do? ...detect bats in my back garden in Sussex.

After a quick search on the internet I took a list of bat species in Great Britain, filtered it by Sussex and then added the bat echolocation frequencies.

This allowed me to determine that I'm probably only going to "detect" the first 4 on this list, and that they all "shout" in the 45-55kHz band of frequencies. However, hope springs eternal, so I'd like to operate at least over the range 20 - 55kHz.

Bats operating above 55kHz are very/extremely rare at my location, and I suspect that my microphone has a pretty dreadful response above 55kHz anyway.

What this means is that the audio amp should be designed with a limited frequency response (range) based upon the divider output, i.e. 20kHz to 55kHz divided by 8. This equates to an audio range of 2.5kHz to 6.9kHz.

We can limit the frequency response of the audio amplifier using simple low pass and high pass filters. The simplest filter consists of a resistor and capacitor in series.

We can calculate the frequency where this kind of filter starts to attenuate the incoming signal (sometimes called the cut-off frequency) using this formula:-

f = 1/(2pi x C x R)

...where pi is approximately 3.142, R is in Ohms and C is in Farads
...or R in M Ohms and C in uFarads.

I created a simple spreadsheet so that I could play around with component values.

I was also limited to some extent by my stock of components, so I settled on values giving an audio frequency range of 1.6kHz to 7.2kHz. Outside of these values, the amp response falls away at the rate of 6dB/octave (e.g. it approximately halves for halving of frequency below 1.6kHz or doubling of frequency above 7.2kHz).

My amp circuit

So my modified audio amp looks like this:-

The volume control (RV1 = 10k) and capacitor C1 (0.01uF) form the high pass filter, passing frequencies above 1.6kHz onto R2. And R2 (2k2) and C2 (0.01uF) form the low pass filter, removing (or at least attenuating) frequencies above 7.2kHz. Note that C1 is now 100 times smaller than it was in Chris Eve's original circuit.

The story so far

By filtering the audio I appear to have improved stability and improved the sound coming out of the speaker. The filters has softened the burps by rounding off the square waves. And I can advance the sensitivity control much further and still not get random burps (but I can still get the machine-gun affect if I push too far).

What I really need now is a tame bat! So far I've spent a few hours spread over several nights standing in the garden, in the twilight. But haven't seen or heard a thing, other than the ultrasonic sound produced by the legs of my Levi's rubbing together as I patrol the back garden.

While I'm waiting for a suitable bat, there are a few more things I can look at.

The 220uF coupling capacitor in the audio amp is probably much larger than is necessary (I reckon 10uF would be fine). I also need to look at the filters in the high-frequency stages, but that will have to wait for that slow boat from China to arrive.

Thats the one that is bringing me a signal generator, which I need to do further testing, and will probably form the basis of part 2 of this post.

No comments:

Post a Comment