Bat Detector

19,381

168

86

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

3 People Made This Project!

Recommendations

  • Halloween Contest

    Halloween Contest
  • Teach With Tinkercad Contest

    Teach With Tinkercad Contest
  • Microcontroller Contest

    Microcontroller Contest

86 Comments

0
dcarroll10
dcarroll10

Question 4 months ago

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

0
WilkoL
WilkoL

Answer 4 months ago

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

0
grandmontj
grandmontj

Question 1 year ago

Can you plug two microphones in parrallel ?

0
WilkoL
WilkoL

Answer 1 year ago

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.

Electret_condenser_microphone_schematic.png
0
jonathangrandmont
jonathangrandmont

1 year ago

Finally got it together.
The folks at work pointed the little mistake I made.
I'll try that tonight !!!
Thanks for sharing your project !!!

PXL_20210820_195527104.jpgPXL_20210820_195533525~2.jpg
0
jonathangrandmont
jonathangrandmont

1 year ago

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 !

PXL_20210809_232115372.jpg
0
WilkoL
WilkoL

Reply 1 year ago

That's odd. Did you place the C13 capactor in the wrong direction perhaps?

0
jonathangrandmont
jonathangrandmont

Reply 1 year ago

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)

PXL_20210817_220454411.jpg
0
jonathangrandmont
jonathangrandmont

Reply 1 year ago

Here is the C4 and C5 I used.
Is 2.2uF and 1uF right ?

PXL_20210809_232731425.jpg
0
WilkoL
WilkoL

Reply 1 year ago

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.

0
grandmontj
grandmontj

Reply 1 year ago

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.

0
WilkoL
WilkoL

Reply 1 year ago

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.

0
jonathangrandmont
jonathangrandmont

Reply 1 year ago

Yes. Maybe I installed them wrong...

0
Lanius
Lanius

Question 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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?

1
WilkoL
WilkoL

Answer 1 year 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 1 year 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.