Bat Detector

15,884

153

73

Introduction: 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

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.

Audio Challenge 2020

First Prize in the
Audio Challenge 2020

1 Person Made This Project!

Recommendations

  • Summer Fun: Student Design Challenge

    Summer Fun: Student Design Challenge
  • DIY Summer Camp Contest

    DIY Summer Camp Contest
  • Fandom Contest

    Fandom Contest

73 Comments

0
Lanius
Lanius

Question 5 months ago on Step 6

Hi there. I really love this, it is actually my first serious project since getting into electronics as a hobby. I have managed to build this on solderless breadboard and I have got it working with key jangle and a simple ultrasonic emitter circuit I built from here: https://www.homemade-circuits.com/best-ultrasonic-...
I find the next step slightly daunting and I know it will be a steep learning curve. Although I have managed to convert your schematic to breadboard, permanently soldering it to a circuit board will require rethinking and reconfiguring the layout so that its efficient and sensible. I was wondering if you have any pictures of your circuit board from the solder side. Being fairly familiar with this circuit by now I would really like to use this project to learn from someone else's circuit board layout and try to get a handle on the processes involved. I would be very grateful for any tip, tricks and help you can offer. Best wishes.

0
Ym54
Ym54

Answer 4 months ago

Hi, Did you manage to get a nice schematic for the layout? I like to try laser cut markings and holes in plywood, so that the legs of each component can pushed into the holes, and soldered on the underside to the next component. The IC is always the hardest as there are so many components coming off it. I have seen circuits with trillions of jumpers, but I really want to do justice to this circuit and make it neat, with as few jumpers as possible. I don't do PCB etching (as yet). Does anyone have a nice layout for this circuit?

0
Lanius
Lanius

Reply 4 months ago

Hi,
I was very fortunate in that WilkoL (the author) provided me with really sound advice and pictures of his layout top and bottom (Below this post). I then used a free program called EasyEDA to work through the circuit and create a layout of my own which is largely based on the wilkoL's original. I have posted a picture of it here. The Position of the Switch, Mic, Speaker and battery are pretty arbitrary on the diagram as they will all be on plugs and sockets so they can be detached if necessary. Also the program automatically routes some of the earths to where it thinks is most convenient (shortest route I assume). The bright pink lines were supposed to be insulated bridges but the one running from pin 9 on the counter (I used CD4024BC) to R12 I managed to reroute under R19 and then up the left side of the counter and between its legs. I don't think I'll be able to do the same with the bridge from C1 / C2 to r16.I haven't got that far yet. The length of this diagram is actually not to scale, I deliberately stretched it out for clarity because the program uses footprints which are too big and it becomes jumbled. The width is the same size as my perf board. I used this board from e-bay UK https://www.ebay.co.uk/itm/Single-Sided-Universal-Board-PCB-Bakelite-Prototype-Plate-Printed-Circuit-Matrix/192956632462?ssPageName=STRK%3AMEBIDX%3AIT&var=493147722661&_trksid=p2057872.m2749.l2649, Its pretty cheap 7x9 board with holes at 2.54mm and copper pads on one side. It's functional but not perfect. I hope that helps somewhat, I am very inexperienced but very happy to share what I have discovered so far.

Bat detector board lay out.jpg
0
Ym54
Ym54

Reply 4 months ago

Thank you for your excellent advice.
Ideally, I would like the legs of most components reach the next component, so there is far less delicate soldering than a pcb. This circuit might be too complicated for that. Either way, you diagram (and program) will save a lot of time on the layout design for us.
I have added a picture of one that I have almost finished, just needs testing, and is also for WilkoL to see. (Pulldown resistor r4 is wrong ad should connect to q2 emitter)

image.jpgimage.jpg
0
WilkoL
WilkoL

Reply 4 months ago

A layout for a circuit is a schematic... isn't it?
Are you making a wooden frame for all the components? Isn't that much harder than making a pcb?

0
WilkoL
WilkoL

Answer 5 months ago

Hi Lanius,

The way I transfer a circuit from the breadboard to a perfboard is quite simple. I keep following the schematic when I place the components on the board. Only when I see that it gets too big or if there is a better way of placing the parts I change the layout.

There are some rules to follow, for instance the crystal for a microcontroller needs to be very close to the microcontroller. When you have analog signals, try not to have digital lines coming close. If there are parts that get hot, place them at the edge of the board so that you can attach a heatsink and do not place electrolytic capacitors close to parts that get hot.

When I am happy with the layout I solder the parts and start with the connections.
With (low level) analog signals, I start with those analog connections, trying to keep them as short as possible. Next are the ground connections.
With a (mostly) digital design I start with ground and other power lines, followed with digital signals.

If possible I place all ICs in sockets and leave the ICs out until I have checked the power connections. Then I apply power to the board and measure the voltages at the pins for the ICs. Only when I see that those are okay, I will power off, place the ICs and reapply power. Usually I start with a lab-power-supply set to the correct voltage and the current-limit set to (what I think) is the expected supply current.

Happy experimenting

Pictures of the bat-detector, top and bottom

IMG_5637.JPGIMG_5638.JPG
0
Lanius
Lanius

Reply 4 months ago

Thank you so much for taking the time to post a really comprehensive and helpful reply, it's much appreciated and has boosted my confidence somewhat. I analysed your layout in some detail and used it to plan mine. I am some way through soldering everything onto perfboard and I will post pictures when it's complete. I do have another question though. I accidently wired this up to 12v having forgotten to change back to 3.7v and the output was much higher and the range was better. Now, I am still looking at different mics so my my output may yet be improved that way but it did lead me to wonder if running this circuit at a higher voltage would have any detrimental affects on it? Another reason for possibly wanting to do this would be that a 9v battery would fit better into the case I plan to use. An advice, gratefully received.

0
WilkoL
WilkoL

Reply 4 months ago

That should work, the CD4040 and LM386 both can work with up to 15V resp. 12V so 9V shouldn't be a problem. You might want to keep an eye on the current drawn from the battery, if that is very high it will drain the battery in no-time.

CD4040.JPGLM386.JPG
2
ironcircuits
ironcircuits

1 year ago

Just built this and it works great! Just after sunset I went out in the backyard and a bat swooped low twice over me and lots of speaker noise! Very neat lol! I was wondering if the speaker was producing noise that the bat was interested in, hence the two low swoops over me? I added a power on LED so I remember to turn it off, and used a 10K pot with the high gain set when the wiper is at ground. I tried a couple of electret mics using the key jingling and selected the highest output one. The mic was fitted into a rubber holder to isolate feedback from the speaker- this made a difference at high gain. The speaker was mounted on a 1/2"L 1/2"diam wooden dowel attached to the lid with Goop glue. The mic, pot with switch, speaker all had 2 pin connections to the board which was point to point wired underneath. A 1S 600mAh LiPo was used to power it. Great project, you got my vote!

Bat Detector Build.jpg
0
Lanius
Lanius

Reply 5 months ago

Hi, Love your build of this brilliant little device. I have managed to put it together on breadboard and even got it working (after realising all my transistors were reversed). The next bit is quite tricky for me because I don't have a lot of experience here. Making this permanent on a circuit board is quite daunting and I will have to map it all out first. I am really keen to learn from others and I was wondering if you could post a picture of the underside of your board and the point to point soldering you did, this would really help me to understand how to get from schematic to final product. I understand it may already be fixed down so not possible. Do you have any tips to help with this process? Do you use software or just pencil and paper? Many thanks in advance.

0
Louis1246
Louis1246

Reply 11 months ago

Nice build. Could you please tell what mic you used? I got 10 mics for $7 off Amazon and after building it I have to jingle keys or use my HC=SR04 ultrasonic sensor right next to the mike to get an output. I tried aiming it at bats but got nothing. Thanks

0
ironcircuits
ironcircuits

Reply 11 months ago

I had several mics in my salvage collection, I don't know what the specs are. I tried each one looking for the highest response. You could check Digikey or Mouser and pick a high sensitivity one, they're not expensive at all, and high quality too.

0
Louis1246
Louis1246

Reply 11 months ago

My old Samsung mic looks likes a tiny surface mount IC probably on a multilayer board. No idea how to remove it. I Ordered one made by Panasonic from Amazon. Digikey was out of stock on it. Hopefully this one will work.

0
WilkoL
WilkoL

Reply 11 months ago

That tiny thing is probably a mems microphone, nice but not useful here. I got my microphones from headsets like the (very ugly) one in the picture.

headset.JPG
0
ironcircuits
ironcircuits

Reply 11 months ago

Jingle some keys at a distance that just causes an output, then compare with another mic to see if there's more or less output.

0
Louis1246
Louis1246

Reply 11 months ago

Thanks. I just tore apart an old Samsung phone I'll try the mic.

0
WilkoL
WilkoL

Reply 11 months ago

Unfortunately I don't know what type of microphones I have. They come from old telephone headsets that I scavenged for the microphones. The headset are from Samsung, Nokia, Motorola and HTC.

0
WilkoL
WilkoL

Reply 1 year ago

Nice build and good to hear you had a result so soon. The powerled also is a good idea, I might add that to my detector.
Thanks for your vote!

0
ironcircuits
ironcircuits

Reply 11 months ago

It was a satisfying and useful circuit to test outside too, thanks for sharing the build.

0
Ym54
Ym54

6 months ago

Quick question please.
There are 3 types of electret mics online, do you know which is better? Reading the comments it seems mobile phone microphones are best, but I don't know what type they use. (See types below). Also, as I have CD4060 (cheaper) can that be used instead, and can I use any of the Q3-Q13 pins?

1) omnidirectional
2) unidirectional
3) noise cancelling