Bats are fascinating animals, and despite all the myth and creepiness surrounding them, they really remind one more of a drunk bird lost in the night sky than the blood-sucking creature they’re often made out to be. Of course, some really fall into that category, and unlike actual birds, bats don’t tend to grace us with their singsong — at least not in ways audible for us humans. But thanks to bat detectors, we can still pick up on it, and [Marcel] recently built a heterodyne bat detector himself.
The detector is made with a 555, an MCP6004 op amp, and a 4066 analog switch — along with a bunch of passives — and is neatly packed into a 3D-printed case with a potentiometer to set the volume and center frequency for the detection. The bat signal itself is picked up by a MEMS microphone with a frequency range [Marcel] found suitable for the task. His write-up also goes in all the mathematics details regarding heterodyning, and how each component plays into that. The resulting audio can be listened to through a headphone output, and after putting together an adapter, can also be recorded from his smartphone. A sample of how that sounds is added in his write-up, which you can also check out after the break.
As somebody who loves technology and wildlife and also needs to develop an old farmhouse, going down the bat detector rabbit hole was a journey hard to resist. Bats are ideal animals for hackers to monitor as they emit ultrasonic frequencies from their mouths and noses to communicate with each other, detect their prey and navigate their way around obstacles such as trees — all done in pitch black darkness. On a slight downside, many species just love to make their homes in derelict buildings and, being protected here in the EU, developers need to make a rigorous survey to ensure as best as possible that there are no bats roosting in the site.
Obviously, the authorities require a professional independent survey, but there’s still plenty of opportunity for hacker participation by performing a ‘pre-survey’. Finding bat roosts with DIY detectors will tell us immediately if there is a problem, and give us a head start on rethinking our plans.
As can be expected, bat detectors come in all shapes and sizes, using various electrickery techniques to make them cheaper to build or easier to use. There are four different techniques most popularly used in bat detectors.
Heterodyne: rather like tuning a radio, pitch is reduced without slowing the call down.
Time expansion: chunks of data are slowed down to human audible frequencies.
Frequency division: uses a digital counter IC to divide the frequency down in real time.
Full spectrum: the full acoustic spectrum is recorded as a wav file.
Fortunately, recent advances in technology have now enabled manufacturers to produce relatively cheap full spectrum devices, which give the best resolution and the best chances of identifying the actual bat species.
DIY bat detectors tend to be of the frequency division type and are great for helping spot bats emerging from buildings. An audible noise from a speaker or headphones can prompt us to confirm that the fleeting black shape that we glimpsed was actually a bat and not a moth in the foreground. I used one of these detectors in conjunction with a video recorder to confirm that a bat was indeed NOT exiting from an old chimney pot. Phew!
[Roland]’s workflow consists of breaking up a recording from his backyard into one second clips, loading them in to a Python program and running some machine learning code to determine whether the clip is a recording of a bat or not and using this to determine the number of bats flying around. He uses several Python libraries to do this including Tensorflow and LibROSA.
The Python code breaks each one second clip into twenty-two parts. For each part, he determines the max, min, mean, standard deviation, and max-min of the sample – if multiple parts of the signal have certain features (such as a high standard deviation), then the software has detected a bat call. Armed with this, [Roland] turned his head to the machine learning so that he could offload the work of detecting the bats. Again, he turned to Python and the Keras library.