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.
Supplies
1 x Electret microphone
4 x BC549 or any other NPN transistor
1 x CD4040 (or another binary counter, at least divide by 10)
1 x LM386
1 x loadspeaker
1 x plastic projectbox
1 x potentiometer 5k
1 x switch
1 x lithium ion battery (old phone) or 3 AA (AAA) batteries
a handful of resistors, capacitors, see schematic
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).
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.
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.
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
Downloads
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.
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.