Skip to content
stef41Public

About

Open-source DIY weatherproof wildlife, rare-species, insect & ultrasonic bat sound trap (STM32U575 C99 firmware, zero-solder 3D-printable PETG CAD, 100%-offline WebAudio Studio)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Sound trap

A sound trap is to sound what a camera trap is to images: a weatherproof box left in the field for weeks that records, and UTC-dates, the sounds animals make near it — from sub-bass megafauna rumbles (23.4 Hz) and wind-swept bird choruses to katydids, rare nocturnal specialists, and ultrasonic bats (92 kHz).

Sound Trap 3D CAD overview — closed enclosure, open interior with 6x AA cells and main PCB, underside acoustic ports, and sealed lid

3D CAD overview (170 × 83 × 175 mm): rain-shedding closed front, open interior with 6× AA holders and PCB, dual underside windscreened microphones + self-test sounder + side GORE PolyVent, and sealed lid with silica desiccant and humidity card.

Highlights

  • Global all-taxa coverage (23.4 Hz–92 kHz): Six switchable CONFIG.TXT presets span infrasound/megafauna (low_freq), general wildlife (broadband), flying insects and sustained choruses (insects), echolocating bats (ultrasound), cryptic/endangered nocturnal species (rare / conservation), and full canopy surveys (expedition / canopy). Multi-constellation GNSS ($GP, $GN, $GA, $GL, $BD) timestamps WAV files anywhere on Earth.
  • Field endurance & battery safety: Calculated ~115 days in triggered mode (10 % activity) or 147 days continuous listening at 48 kHz (5.98 mW average on the 3.0 V rail) from 6× 1.5 V Energizer Ultimate Lithium L91 AA cells (-40 °C to +60 °C operating envelope; redundant dual 3S banks with Schottky OR-ing). SAFETY WARNING: ONLY fit nominal 1.5 V L91 cells — NEVER install 3.6 V Li-SOCl2 AA cells, whose 10.8 V open-circuit stack exceeds the TPS62840 6.5 V absolute maximum rating.
  • Zero-solder 12+ DIY build: Keyed poka-yoke plug-in harnesses (unique pin count per cable so nothing can plug into the wrong socket), press-in M3 square-nut slots, no heat-set inserts, no knife trimming, and internal USB-C ROM DFU (no external programmer). Printable on a 180 × 180 × 180 mm PETG bed (mechanical/out/stl_diy/); $261.37 USD single-unit BOM (docs/bom.csv, excluding cells & SD card).
  • Honest prototype status: Complete verified software, FatFs E2E tests, Cortex-M33 QEMU cycle profiling, schematic netlist/ERC, 40-check parametric CAD, and real-audio validation. NOT TESTED ON HARDWARE — no physical PCB or enclosure has been fabricated or IP67/cold-chamber tested yet.

Presets at a glance

Configure via a one-line CONFIG.TXT on the SD card (or click through the offline docs/studio.html builder):

Preset Sample rate Detector passband absorb_after_s Target wildlife & ecosystems
broadband (default, all) 48 kHz 200 Hz–20 kHz (100 Hz fine) 20 s Birds, frogs, temperate/tropical mammals, general monitoring
low_freq 48 kHz 25 Hz–12 kHz (23.4 Hz resolved) 30 s Elephants, lions, red deer stags, bitterns, sub-bass rumbles
insects 96 kHz 100 Hz–44 kHz (100 Hz fine) 0 (never absorb) Crickets, katydids, cicadas, insect wingbeats & endless choruses
ultrasound 192 kHz 10 kHz–92 kHz (fine = 0) 10 s Echolocating microbats & ultrasonic bushcrickets
rare (conservation) 96 kHz 25 Hz–44 kHz (23.4 Hz resolved) 0 (never absorb) Shy, cryptic, endangered terrestrial/nocturnal/ground wildlife
expedition (canopy) 192 kHz 1.2 kHz–92 kHz (fine = 0) 0 (never absorb) Tropical canopy & cave surveys from stridulating insects to high bats

Documentation

Document What it covers
docs/diy-guide.md Illustrated 10-step beginner build guide: zero soldering, zero heat-set inserts, zero knife trimming, zero external programmer, keyed plug-in connectors, and SD prep.
docs/studio.html 100%-offline single-file Sound Trap Studio: point-and-click CONFIG.TXT builder (6 global/conservation presets), endurance estimator, EVENTS.CSV / WAV spectrogram viewer, 4× sub-bass boost & 1/10× ultrasonic bat slow-mo, and LED decoder.
docs/hardware.md System overview, component selection, power/storage budget (tools/power_budget.py), enclosure summary, cost, and hardware verification plan.
docs/electronics-connections.md Pin-by-pin schematic netlist for the STM32U575RIT6Q, SMPS, microphones, keyed plug-in connectors, internal USB-C DFU, ESD/reverse-polarity protection, and ERC notes.
docs/bom.csv Complete 58-line single-unit prototype bill of materials ($261.37 USD excl. cells & SD card) with source checks, plug-in harnesses, and industrial MPNs.
docs/mechanical.md Parametric build123d 3D enclosure CAD model (mechanical/), 40 geometric/clearance checks, STEP/STL exports, and zero-insert beginner PETG kit (out/stl_diy/).
docs/processor-load.md Instruction-level Cortex-M33 QEMU load profiling (46.6 MHz mid eq. at 98.304 MHz for 48 kHz, plus 96/192 kHz profiles at 147.456 MHz, CPI 1.16–1.45) and battery impact.
docs/software.md Portable C99 detector/recorder architecture, six global/conservation presets (broadband, low_freq, insects, ultrasound, rare, expedition), absorb_after_s = 0, SD card layout (EVENTS.CSV, STATUS.CSV, WAV), and simulator.
docs/firmware-port.md Application state machine, host/FatFs E2E test suite, STM32U575 HAL drivers, 64 KB SD-card bootloader, and unbuilt-silicon boundary.
docs/validation-report.md Real-recording validation across public wildlife, weather, rare/niche creatures, and bat archives: methodology, results, and limits.
docs/field-guide.md Field installation, magnet status checks, maintenance, card readout, FIRMWARE.BIN updates, and troubleshooting.

Hardware, sealing & zero-solder DIY build

Every mechanical part, acoustic port, silicone compression seal, and plug-in harness is modeled parametrically in mechanical/ (49 solids / 30 distinct parts, 40/40 checks) and cross-checked by tools/verify_electronics.py.

Exploded 3D CAD assembly of all mechanical, acoustic, sealing, and electronic components

Exploded assembly along the lid, main body, tree mount, underside acoustic ports, and rain roof axes (docs/mechanical.md).

Zero-solder poka-yoke wiring map — unique pin count per cable prevents mis-wiring

Plug-and-play beginner assembly: 2-wire Wago L91 battery clamps (J3/J4), 4-pin primary/spare MEMS microphone cables (J6/J7), 3-pin piezo test-sounder cable (J5), and internal USB-C DFU setup (J8) (docs/diy-guide.md).

Hardware architecture block diagram

System block diagram: STM32U575RIT6Q MCU (ADF1 + SDMMC1 + internal SMPS), TPS62840DLCR 3.0 V regulator, dual IP57 IM72D128 PDM microphones, daily PKLCS1212E40A1-R1 self-test sounder, load-switched SD socket, RV-3032-C7 TCXO RTC + supercap, MAX-M10S multi-GNSS, SHT40 humidity/temp, and DRV5032FBDBZR magnet wake (docs/hardware.md).

Dimensioned orthographic views of the 170 x 83 x 175 mm enclosure

Scaled front, left tree-mounted profile, and bottom views showing the 25 mm drip-rimmed acoustic windscreens, GORE PolyVent, translucent side status LED windows, and mounting strap slots.

Underside IPx8 acoustic port & bayonet windscreen Lid silicone gasket stop (30 % squeeze) & tree mount
Bottom waterproof GORE acoustic port and bayonet windscreen cross-section Silicone lid gasket 30% compression stop and tree-strap cross-section

Bioacoustic detection in real weather

Rather than tripping on raw volume (which fills cards during wind gusts and rainstorms), the portable C99 detector (firmware/core/) runs three parallel tests ~190 times per second after click limiting and adaptive per-bin background tracking:

  1. Spectral CFAR + continuity — detects tonal whistles, harmonic calls, and wide trills/buzzes standing out from simultaneous neighbouring frequency bins.
  2. Fine 2048-point sub-bass tracker (23.4–300 Hz) — two-stage rate-adaptive decimation isolates close low-frequency harmonics (elephants, lions, stags, owls) while rejecting broadband wind and thunder slopes.
  3. Time-domain click/rhythm detector — catches woodpeckers, insect stridulation pulses, and bat echolocation trains while rejecting random raindrop impacts.

Real birdsong in windy woodland — red trigger marks on calls, silence in wind-only gaps

Unmodified windy woodland recordings: red trigger marks lock onto real birdsong and stay silent across wind gusts alone (docs/validation-report.md).

Simulated 2-hour deployment across calm, wind, heavy rain, and thunderstorm vs fixed loudness triggers

Simulated 2-hour weather progression (calm -> wind -> wind & rain -> heavy rain -> thunderstorm -> calm): the CFAR detector records 14 % of the timeline (catching real calls down to -10 dB SNR) while fixed +12 dB / +18 dB loudness triggers flood to 59 % / 38 %.

Six real animal calls detected at -5 dB SNR inside wind, heavy rain, thunder, and snow

Six real animal calls buried -5 dB quieter than heavy weather noise: eagle owl in gusting wind, robin in heavy rain + thunder, midwife toad in heavy rain, red deer stag in blustery rain, lion in a snow storm, and crane in torrential rain.

Detection recall vs SNR across 12 uncompressed weather recordings

Recall across 12 uncompressed public weather recordings (95 % at 0 dB SNR, 97 % at +5 dB, 99 % at +10 dB).

State of the work

  • Portable core & application (firmware/core, firmware/app): Written in strict C99, statically analysed (clang --analyze, zero warnings), and verified under ASan + UBSan across 233 core checks, 343 app scenario checks, 125 multi-day checks, and 66 real 36 MB FAT32 RAM-disk E2E checks (including FIRMWARE.BIN -> .OLD/.BAD), plus 56,432 core stress checks and 1,443 FatFs/long app stress checks (tools/stress_test.py). Supports worldwide GNSS constellations ($GP/$GN/$GA/$GL/$BD), -40 °C to +60 °C L91 deployments (overtemp above 55 °C), and six global presets (broadband, low_freq down to 23.4 Hz, insects at 96 kHz with absorb_after_s = 0, ultrasound at 192 kHz, rare / conservation at 96 kHz 23.4 Hz–44 kHz with absorb_after_s = 0, and expedition / canopy at 192 kHz 1.2–92 kHz with absorb_after_s = 0). Validated offline across all taxa, weather beds, and 16 rare/niche creature archetypes (validation/run_global_taxa.py, validation/verify_detect_anything.py).
  • STM32U575 target & bootloader (firmware/target/stm32u575): Full HAL drivers with dynamic 98.304 / 147.456 MHz clock scaling and 24..192 kHz ADF1 configuration (192 kHz MDF_RSF_DECIMATION_RATIO_1 to confirm on silicon), 37/37 ST open-pin verification (verify_pins.py, including internal USB_OTG_FS PA11/PA12 ROM DFU), CMSIS-DSP Cortex-M33 QEMU load profiling (firmware/target/loadtest, including rare_96k at 90.75/147.456 MHz and expedition_192k at 117.20/147.456 MHz), 64 KB SD-card bootloader (boot.elf, 39.1 KB), and main application (soundtrap.elf, 159.7 KB Flash / 531.9 KB RAM) plus signed/CRC FIRMWARE.BIN. NOT TESTED ON HARDWARE — no PCB has been fabricated yet.
  • Electronics & mechanics (docs/bom.csv, mechanical/): Complete schematic connection list verified by tools/verify_electronics.py, and parametric build123d CAD model (49 solids / 30 distinct parts) passing 40/40 geometric/assembly checks with exported STEP (30 parts + assembly.step), STL (7 SLS/heat-set insert parts in out/stl/), and zero-insert beginner PETG STL kit (8 parts incl. diy_assembly_jig.stl in out/stl_diy/, fitting a 180 × 180 × 180 mm bed). No physical prototype has been built or IP67/cold-chamber tested.

Folder layout

docs/         documentation, offline studio.html configurator/player, BOM (bom.csv), and generated figures/
firmware/     portable C99 core, host simulator, app + FatFs E2E tests, STM32U575 HAL + bootloader, QEMU loadtest
mechanical/   parametric build123d CAD scripts, checks, exports (out/step, out/stl, out/stl_diy), and renders
tools/        ERC/BOM checker (verify_electronics.py), SD prep (prepare_sd.py), power budget, diagrammer, FIRMWARE.BIN packer, master verify_all.py
validation/   scripts that fetch archives and run detector validation suites
data/         cached recordings and test audio (large; generated/downloaded once)

Reproducing checks & results

Run the 12-check master verification suite (checks electronics/BOM, core & app/FatFs tests, Clang analyzer, Docker STM32U575 bootloader + app + FIRMWARE.BIN, QEMU loadtest SHA sync, global & all-taxa detection matrices, mechanical 40/40 checks + STEP/STL/PNG assets, beginner DIY tools, repo hygiene, and the 5-stage system stress suite):

.venv/bin/python tools/verify_all.py

Or run subsystems individually:

make -C firmware test stress
make -C firmware/app test stress
mechanical/.venv/bin/python mechanical/checks.py
.venv/bin/python tools/stress_test.py

The validation needs Python with numpy, scipy, matplotlib and soundfile, and ffmpeg for converting audio. The first script downloads about 2.4 GB of recordings from Wikimedia Commons, xeno-canto, the ESC-50 dataset and the freefield1010 dataset. It takes about an hour, because Wikimedia Commons limits the download rate.

python validation/fetch_data.py
.venv/bin/python validation/run_global_taxa.py
.venv/bin/python validation/verify_detect_anything.py
python validation/run_final.py

The file data/SOURCES.csv lists every recording with its author, licence and web page. The recordings are under Creative Commons licences; several require attribution, and the ESC-50 clips do not allow commercial use. They are used here for testing only and are not part of the device.

About

Open-source DIY weatherproof wildlife, rare-species, insect & ultrasonic bat sound trap (STM32U575 C99 firmware, zero-solder 3D-printable PETG CAD, 100%-offline WebAudio Studio)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages