buzz_monitor.py
A lightweight, non-intrusive acoustic bee monitoring device for pollinator research and urban ecology.
Buzz Monitoring in a Flowerbed:
A Proof-of-Concept for Ambient Acoustic Bee Detection
Background
I wanted to know whether my small patio pollinator garden was actually attracting pollinators. Existing remote monitoring methods for pollinators were too expensive or focused on hive management, so I set out to build a basic, self-contained pollinator monitor out of Raspberry Pi 4.
Pollinators are a hugely biodiverse bunch; mammals, birds, and insects of all ecological niches provide this service to flowering plants in the Puget Sound region. However, King County identifies the Western bumblebee as the most at-risk pollinator in the immediate region, and generally recommends broad, multi-species bee support as the most crucial immediate step to protecting pollinators. For the purposes of this project, we'll attempt to monitor the presence of bees in the flowerbed.
Bees are highly mobile, with unpredictable flight patterns interspersed by brief periods of rest and pollination on stems, flowers, and material surfaces. Their trademark buzz is ephemeral and leave no visible trace, but trained human observers can track bee activity in a given flowerbed with a high degree of accuracy thanks to bees' distinct visual and acoustic patterns. In addition to characteristic striping, bees buzz at highly specific frequencies (around 150-400Hz) both during flight and "buzz pollination" of flowers.
Monitoring solutions can obviously take advantage of the bee's characteristic patterns. Video monitoring could capture these rapid flight motions across a static field, particularly if augmented by motion detecting and machine learning for inference. However, for a proof-of-concept standalone remote monitor, these solutions are expensive, computationally heavy, and depend too heavily on optimal light and background conditions. Infrared photodiode sensors - another possible solution - are cheap, but too point-specific, easily triggered by wind or debris.
Acoustic monitoring, on the other hand, could harness bees' distinct buzz to measure activity, particularly if we apply light digital processing to highlight bee buzz against environmental and human-made background noise.
Approach
I built a weather-resistant, self-contained field recorder using a Raspberry Pi 4 paired with a SunFounder Mini USB 2.0 microphone. The unit is placed directly in a flowerbed within 1m of
The system records short audio bursts (5–10 seconds every minute), then processes each burst using Welch's method to estimate power spectral density. If energy appears in the “bee band” above a tuned threshold, the system logs a timestamped event for bee activity.
Architecture:
Hardware:
central compute: Raspberry Pi 4+ (any model should suffice)
microphone: USB 1.0 or 2.0 (I²S compatible, but not in proof-of-concept)
SD card: high-endurance microUSB (SanDisk or other)
Boot/Automation: Autostart via systemd/crontab
Recording and Processing:
buzz_monitor.py (Python script) captures audio in bursts. Applies Welch's method (SciPy signal.welch) generates frequency bins with corresponding power values and logs energy peaks around preset frequencies (200-320Hz for this proof-of-concept). Outputs frequency, power, and timestamp to .csv for offline analysis.
Application/Workflow
Real-time monitoring:
1. Flash preconfigured SD image.
2. Pi records audio on startup and automatically runs DSP/analysis.
3. Both audio files + analysis outputs are saved locally.
4 .Volunteers periodically retrieve data (SD card swap, SCP, or USB copy).
Batch monitoring:
1. Flash preconfigured SD image.
2. Pi records audio on startup and saves longer .wav files (60 mines)
3. Shell script analyses recorded files using a standalone C++ tool (buzz_batch)
4. Outputs a .csv file of "bee events" per preset interval (default is 60 seconds)
Everything runs automatically on startup after running the initial setup script, so volunteers can deploy a Pi in their own garden, power it up, and start collecting data immediately. Events are logged offline, accommodating locations without reliable Wi-Fi or network access.
Human observers can validate and adjust the frequency target and detection threshold, adjusting for species-specific acoustic signatures, sensor location, and background noise to maximize reliability.
The outcome is a low-cost, minimally invasive proof-of-concept for scalable volunteer data collection in support of pollinator conservation efforts. It doesn’t track species, count individuals, or pinpoint flowers, but it confirms that bees are actively visiting.
Future Iteration(s):
"Online mode" with cloud monitoring. Integrate WiFi/ethernet on unit to feed live dashboards. Flask API feeds JSON to InfluxDB for time-series storage, which will then populate Grafana dashboards for volunteer networks to pool and leverage data.













