Bat Detector

27K175121

Intro: Bat Detector

A dividing bat detector

I saw that there is an "Audio Challenge Contest" going on. How about sound you cannot hear, and then make that audible? So I made a simple bat detector, with just a handful of transistors a binary divider and an audio amplifier, no microcontrollers, Arduino or even Raspberri Pi, so no coding required.

Lets go

Now that it is summer in the Northern hemisphere we can often enjoy an evening in the garden. Around dusk is the perfect time for a chat with the neighbours, having a coffee or a beer.

And the right time to see bats flying over your head, hunting for those annoying mosquito's.

Depending on where you live there will be many or few bats. I live in an urban area where there aren't that many (unfortunately). To prevent having to watch an almost always empty sky, I made this bat-detector to warn me when the bats are around, now I can watch the sky and be sure that they are there.

EDIT:

there was an error in the schematic(s), R7 needs to be 2k7 instead of 2.7 ohm.

EDIT2:

I just added a "video" with 5 minutes of bat-sounds. Although video is not really the right word for five minutes of almost total darkness. See step 4.

STEP 1: Making the Bat-sound Audible

Bats navigate with sonar, a kind of radar but with sound. Those sounds are short pulses of a high frequency, the wave length therefore is very small enabling them to "see" small things, such a their food: insects. Those frequencies can range from 20 kHz up to 100 kHz. Humans cannot hear higher than 16 kHz, so we have to lower the frequency.

When I build it I decided to use the dividing method of detection. With that methode you amplify the sounds of the bats so much that it is clipped. It transforms from a sinewave to a squarewave. This squarewave still has the frequency that the bats use.

This is done with a simple binary counter. I used the CD4040 which is somewhat overkill as it can divide in steps of 2 up to 4096 and I chose the output that divides the input signal by 16. Only 4 stages of 12 of the binary counters are used.
A bat signal at 40 kHz thus is divided to 2500 Hz which is perfectly audible. And even a bat that produces sounds at 100 kHz can be heard at 6250 Hz.

There is another method of making bat-signals audible, called heterodyne. Here you mix the bat sounds with a tunable frequency, the result of that is the sum and the difference of those two frequencies. So when you have a bat making sounds at 40 kHz and you tune the detector to 45 kHz, you will have a signal at 85 kHz that you filter away (it isn't audibe anyway) and an audio signal at 5 kHz.
The advantage of the heterodyne method is that you do not amplify the bat sounds until they are squarewaves but keep them at lower levels, that way you do not lose the amplitude variations of the original sound. The disadvantage is that you need to know approximately what frequencies the bats in you neighbourhood make. If they use frequencies of say, 80 kHz and you have the detector tuned to 45 kHz, both resulting signals from the mixer are not audible (35 kHz and 125 kHz).

STEP 2: Microphone Amp and Filter

First of all we need a microphone and it needs to be able to detect high frequencies. It turns out the ordinary electret microphones work much higher than the specifications suggest. I use one that the specs say works up to 20 kHz, but it works fine up to at leat 40 kHz and probably even higher. The output signal of it will go down in volume with increasing frequency but that can be fixed with more amplification.

The first schematic above shows the first stage, it amplifies the small signal from the micrphone as much as possible with Q1

The second schematic is the High Pass filter. It is build with an emitter follower Q2 that has no voltage amplification. This makes certain that no low frequency noise enters the divider.

STEP 3: Variable Amplification

More amplification is done by transistor Q3. The amplification of this stage is variable with the potentiometer, but I tend to set it to almost the maximum to receive the bat-sounds from as far away as possible. Because of the filtering no other noise comes this far.
Transistor Q4 takes care of transforming the signal to digital levels and that signal is fed into the binary counter.

STEP 4: Dividing and Power Amplifier

Output port Q3 of the CD4040 has the input signal divided by 16. Of course you can experiment with higher or lower division rates, I found the division by 16 to give good audible sounds.
The last step is to amplifiy it for the loudspeaker. A LM386 takes care of that.

Power is delivered by an old phone battery, I chose not to put in a charger, the device uses to little current that it will probably work for years before it needs a new charge.

Some filtering of the power rail is done with R1 and C1 and C2 to prevent noise from the output coupling back into the amplifier. And R2 with C3 and C7 provide even cleaner power for the microphone

STEP 5: Building It

I had an old plastic box that had one single hole in a somewhat odd place in it. So that's where I planned the volume knob. Then I drilled a pattern of holes in the plastic box for the speaker and spraypainted it red. I think it looks nice, apart from the strange place of the volume knob. The speaker is "mounted" with a piece of double-sided sticky tape to the pcb and the microphone has a small hole on top, it is pressed in, no glue was needed. The electronics is build on perfboard as is my usual way of building.

STEP 6: Testing and Results...



Testing it is very simple, just shake a bunch of keys. There appears to be a lot of high frequent noise in that. A second way of testing is with an ultrasoon ranging module. I use one I build years ago into the distance meter, this gives a rapid clicking noise.

And to my surprise the zoom function of my camera (Canon) is very noisy on frequencies I cannot hear. Just watch the video to hear it.

And then the real results... I can tell you that it detects bats perfectly, up to 20 to 30 meters away. But I haven't been able to record them yet. There aren't a lot of them here (urban area) and every time one few over I was too late to record it. But I'll keep trying and as soon as I have one on video (or just the audio) I'll upload it here.

93 Comments

Is there a way to put a potentiometer in the circuit somewhere to adjust/know the frequency you are looking for?

I'm afraid not, the microphone records every frequency up to 40 kHz if I remember well. That is amplified and sent through a high-pass filter to remove human audible frequencies. And that's about it. To know the frequency emitted by the bats you would need to measure the signal entering the divider with a frequency counter.

That said, there are other ways to make bat sounds audible, look for a heterodyne type of bat detector, on those detectors you can set the mixing frequency and by doing so you will (approximately) know the frequency of the bat signal. I haven't made such a detector but no doubt you can find designs that you can make yourself (google is your friend).

Succes,

Wilko

By using Q3 from the CD4040 you divide by 8 when i am ot mistaking. Shouldn't you use Q4 to divide by 16?
Hi, I just checked and yes, you are correct. But there appears the be a difference between the datasheet of Fairchild and Kicad. Fairchild calls PIN5 Q4 while Kicad calls the same PIN5 Q3. I opened the case of the bat-detector to double check, PIN5 is used so the division factor is 16.
Thanks for your reply. I like tour design. I made a detector which is comparible with your design i am only using the LM386 also for the pre amplifier instead of transistors. Why did you choose transistors?
Well, it was quite a while ago so I do not remember everything of it. But I like making devices that use as little current as possible so that will be one reason. Another reason may be that I did not have, or did not want to use an opamp or other IC because of the price. And lastly, I had, and still have a lot of transistors. :-)
Thanks for the project - really nice and very interesting to do. I created the circuit in Fritzing, printed it out onto a copper board and etched it

It all seemed to work with the key jangles and pointing a sonic ranger directly at it but I couldn't catch any bat noises (even with them flying pretty close). I swapped out the cheapy electret mic you can see in the pics with a Panasonic WM-61A onmi-directional one but all the bats disappeared.

I just tried it again a few minutes ago and a few bats flew past and I got some great chirps and brrps!

Thanks!
Hi, I've built this circuit three times and still can't get it working. What kind of capacitors should I be using? The electrolytic ones are clear from the circuit diagram as they have a specific polarity, but I don't know what to use for the others... I've got ceramics and polyesters but have no idea which I'm supposed to use. Thanks
It doesn't matter what capacitors you use, the type and even the exact values are not critical, ceramics are fine. I used ceramics too. The same is true for the resistors and even the transistors, use what types you have lying around.

But there is one critical thing and that is the microphone. Not all microphones "hear" the frequencies used by bats. It may take a bit of experimenting with different types. Wiggle a bunch of keys in front of the microphone, it should produce quite some noise.

Succes,
Wilko
Can you plug two microphones in parrallel ?
Hmmm, I have never thought about that. Well, if I take a look at the schematic of an electret microphone (see the picture, stolen from wikipedia :-) ) I see no reason why it isn't possible. But whether it improves the reception of sound is another question.
What is your plan? Pointing both in the same direction, it might improve the sensitivity, but if you want to point one to the left and the other to the right, it may reduce the sensitivity of both microphones. But by all means, try it! And tell us about the results.
Finally got it together.
The folks at work pointed the little mistake I made.
I'll try that tonight !!!
Thanks for sharing your project !!!
I messed up somewhere. I have no sound coming out and 2.3volt at the speaker.

Any wizzard willing to help me ?

Great project btw !
That's odd. Did you place the C13 capactor in the wrong direction perhaps?
I must have plugged something wrong...
I'll ask at work if any of the electrical tech want to help me ! (I'm a mechanical tech)
First, sorry it took so long, I've been away for some time. No C4 and C5 are part of the high-pass filter. If you use those values it will pass much lower frequencies too and you don't want that. Stick to the values in the schematic. They are cheap ceramic capacitors.
Small update !
I found the right capacitor at a local electronic hardware store. I'll try to reverse the transistors tonight to see if that's the issue. All the capacitors seems to be in the right direction.
What do you mean with "reverse" transistors? They are all npn transistors where the collector needs to be on the positive side, the emitter on the negative side and the base should be (usually) somewhat in between. Actually the base will always be around 0.7volt more positive than the emitter.
More Comments