Open Source Microcontroller-Based Systems for Studying Echolocating Bats and Other Vocally Active Animals
This repository contains the Arduino/ESP32 source code supporting the manuscript
Preprint Available on BioRxiv at: https://doi.org/10.1101/2025.08.11.669530
Currently, it includes the following complementary systems:
- Batsy4-Pro – a Teensy 4.1–based multichannel ultrasonic recorder designed for high-fidelity capture of echolocation calls at up to 192 kHz.
- Espertillio – a heterodyning, recording & playback unit using an ESP32, capable of live monitoring, bat call playback, and SD card recording. (Under further development)
- Esperdyne - A pocketable, real-time heterodyne bat-call listener and “tap-to-save” field recorder built on ESP32-S3.
Together, these systems allow researchers to perform field experiments involving localisation, call analysis, and behavioural playback under natural foraging conditions.
More projects will be added as the systems are developed and tested. Check back again.
See Bat Reviewer for a software tool for validating and sorting of field recordings from any of these devices, and to hear bat calls with heterodyne demodulation on the computer.
- Records 4 ultrasonic channels at 192 kHz - extendable up to 8 analogue channels.
- Uses PSRAM buffering.
- Automatically generates unique WAV filenames.
- Provides tunable live bat monitoring via heterodyning for informed recording. No more guessing or additional monitoring equipment.
- Designed for synchronised microphone array recordings.
- [OSHW] DE000165 | Certified open source hardware | oshwa.org](https://certification.oshwa.org/de000165.html)
- Heterodyne real-time playback* for live bat monitoring.
- FM/CF synthetic call playback for behavioural tests.
- Records ultrasonic input to SD card as WAV files.
- Switchable between FM and CF playback modes via a physical toggle.
- Supports Doppler-shift simulation for moving targets with synthesised CF calls. (Experimental feature for future development)
- Currently developed for a single channel use - if that's all you need. This version is much cheaper than Teensy-based hardware.
ESPERDYNE is a dual-channel heterodyne bat detector and recorder built on the ESP32-S3 with onboard PSRAM and SD storage. It enables real-time listening and immediate capture of ultrasonic signals in the field with an intuitive, low-power design.
- Live dual-channel heterodyne monitoring at 192 kHz sample rate
- Independent tunable carrier frequency per channel via rotary encoder (10–85 kHz range, 5 kHz steps)
- Stereo / Mix mode toggle for flexible playback (true stereo or averaged mono)
- Tap-to-save recording from a 5-second PSRAM ring buffer to WAV on SD card (REC###.WAV)
- OLED UI (128×32) displays carrier frequencies, volume, file index, and mode
- Rotary encoder with push-switch to toggle between frequency and volume adjustment
- Dedicated buttons for record, OLED toggle, channel 2 edit, and mix mode toggle
- Auto file indexing on boot (no overwrite of existing recordings)
- [OSHW] | DE000166 | Certified open source hardware | oshwa.org
This version supersedes the earlier proof-of-concept, integrating full UI controls, PSRAM-backed ring buffer recording, and independent heterodyne channels for scientific and educational use.
- Batsy4-Pro may be combined with an ESP-NOW-based remote trigger. This simple yet effective module frees hands during field recordings. The system may be set up and monitored from a distance, and recordings may be remotely triggered.
- You will need two ESP32 dev kits -- sender and receiver.
- I use an audio jack Bluetooth Plugin (e.g., Avantree Relay) to hear the heterodyned audio over Bluetooth headphones. This allows me to not be close to the setup and still be able to perform recordings. The BT addition has a perceptible delay, about 100ms or so, but immaterial for recording experiments.
- Teensy 4.1 microcontroller.
- Multiple ultrasonic microphones (e.g., Knowles MEMS series).
- SD card (high-speed, Class 10 recommended).
- APS6404L-3SQR PSRAM - 8MB (or equivalent)
- PCM5102A or similar DAC
- WM8782 I2S ADC
- Toggle buttons, rotary encoders etc (See code and BOM)
- ESP32 development board with I2S microphone and DAC output (e.g., PCM5102A).
- SD card breakout module.
- Buttons for playback and record control, and a mode toggle switch.
- Speaker or amplifier for output.
- Use the same ADC and Mics as above.
-
Clone this repository:
git clone git@github.com:raviumadi/Embedded_Ultrasonics.git
-
Open each
.inofile in Arduino IDE. -
Install dependencies:
- For Teensy: Teensyduino
- For ESP32: Install
esp32board support via Arduino Board Manager.
-
Compile and upload the appropriate firmware to your device.
-
Connect hardware according to the pin definitions in each
.inofile. -
Run field tests as described in the manuscript.
- All recordings are saved as 16-bit PCM WAV.
- Filenames are automatically generated in the format:
REC###.WAVfor ESP32 recordings.BAT###.WAVfor Batsy4Pro recordings.
- Sampling rate: 192,000 Hz (configurable in code).
- Teensy 4.1 Documentation
- i.MX RT1060 Processor Reference Manual R3
- Teensy Audio Library
- WM8782 - 24-bit 192 kHz Stereo ADC Datasheet
- PCM510xA 2.1 VRMS, 112/106/100 dB Audio Stereo DAC with PLL and 32-bit, 384 kHz PCM Interface
- SPU0410LR5H-QB MEMS Microphones
- Inter-IC Sound (I2S) ESP32 Documentation
- Arduino IDE
This documentation is licensed under the Creative Commons Attribution–NonCommercial 4.0 International (CC BY-NC 4.0).
See the LICENSE file for details.
The code in this repository is provided "as is", without warranty of any kind.
It is intended for research and educational purposes only.
Use in environments involving wildlife should comply with local regulations and ethical guidelines.
Please contact the author via https://biosonix.io if you are interested in developing commercial versions of the systems described here.
This project is developed and maintained independently as part of my open research work. If you find it useful and would like to support continued development, documentation, and free public releases, consider buying me a coffee.
All tools remain free for academic and research use.

