A computer vision-based bee monitoring system using ArUco markers and Raspberry Pi (also, check out the Dashboard!)
Detect-a-bee (or, in portuguese, Detecta-Bee) is an automated hive monitoring system that combines computer vision, environmental sensors, and embedded visualization to track bee activity and environmental conditions in real-time. Developed as part of a research project at NEEPC-UFSCar, this system uses ArUco marker detection to identify and monitor individual bees within a hive.
- Raspberry Pi 4 (2GB RAM minimum, 4GB+ recommended)
- PiCamera2 or compatible camera module
- OLED Display (SSD1306, 128x64 resolution)
| Sensor | Function | I2C Address |
|---|---|---|
| CCS811 | Air quality & CO₂ equivalent | 0x5A |
| BMP280 | Temperature & barometric pressure | 0x76 |
| MPU9250 | 3-axis accelerometer | 0x68 |
I2C Bus (GPIO 2 & 3):
- CCS811 (Air Quality)
- BMP280 (Temperature/Pressure)
- MPU9250 (Accelerometer)
Camera:
- CSI ribbon cable (auto-detected)
OLED Display:
- I2C bus (same as sensors)
# Core packages
- Python 3.9+
- pip (Python package manager)
- git
# System libraries (install on Raspberry Pi OS)
sudo apt-get update
sudo apt-get install -y python3-dev python3-pip libatlas-base-dev libjasper-devSee requirements.txt for complete list:
opencv-python- Computer vision and ArUco marker detectionnumpy- Numerical computingpicamera2- Raspberry Pi camera interfaceadafruit-circuitpython-ccs811- Air quality sensor driveradafruit-circuitpython-bmp280- Temperature/pressure sensor driveradafruit-circuitpython-ssd1306- OLED display driverPillow- Image processingsmbus2- I2C communication- Additional:
board,busio,RPi.GPIO,RPi.bmp280,board
git clone https://github.com/jvtoppa/detectabee.git
cd detectabeesudo raspi-config
# Enable: I2C, Camera, SPI
# Then reboot: sudo rebootpip install -r requirements.txt# Check I2C devices
i2cdetect -y 1
# Test camera
libcamera-hello --list-cameraschmod +x ./run.sh
./run.shOr directly:
python3 main.pypython3 main.pyThe system will:
- Initialize all sensors
- Start the camera feed
- Display readings on the OLED screen
- Log all measurements to database files
- Environmental readings (temperature, pressure, CO₂) appear on the OLED display
- Detected bee markers are highlighted in the camera feed
- Data is continuously written to
data/directory
Press Ctrl+C to gracefully shutdown the system.
# Verify camera is detected
libcamera-hello --list-cameras
# Test camera feed
libcamera-jpeg -o test.jpg
# Solution: Ensure ribbon cable is firmly connected, enable camera in raspi-config# List connected I2C devices
i2cdetect -y 1
# If devices missing:
# 1. Check power (3.3V) to sensors
# 2. Take off probes and put them back. CCS811 has a particular nasty problem with connecting to Raspberry pis (WIP).This project is part of ongoing research at NEEPC-UFSCar. This project is licensed under the MIT License. The author of this codepiece would like to acknowledge:
- NEEPC-UFSCar - Research center providing project support
- OpenCV Community - ArUco marker detection library
- Adafruit - Sensor driver libraries
- Raspberry Pi Foundation - Hardware and documentation
If you use DetectaBee in your research, please cite:
@software{detectabee2026,
title={DetectaBee: Automated Hive Monitoring with ArUco Markers},
author={Toppa, J. V.},
year={2026},
url={https://github.com/jvtoppa/detectabee},
organization={NEEPC-UFSCar}
}For issues, questions, or collaboration:
- Open a GitHub Issue
- Visit NEEPC-UFSCar
Made with 🐝 and ❤️ at UFSCar

