Skip to content

PierreNeumann/zephyr_app_bee_sauna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bee Sauna — Varroa Thermal Treatment Controller

Warning

DISCLAIMER — USE AT YOUR OWN RISK

This software is provided "as is" under the Apache-2.0 license, without warranty of any kind. It is experimental and has not been certified for use in safety-critical applications.

The author(s) shall not be held liable for any damage — including but not limited to loss of beehives, property damage, fire, or personal injury — arising from the use or misuse of this software.

You are solely responsible for validating the correct operation of your installation. A hardware-independent thermal cutoff device (e.g. a mechanical thermostat rated at ~45 °C wired in series with the heater relay) is strongly recommended as an additional safety layer independent of this software.

Overview

Bee Sauna is a Zephyr RTOS application that performs thermal treatment of beehives to eliminate Varroa destructor mites. It reads temperature and humidity from an SHT35 sensor over I2C and runs two independent PID control loops:

  • Heater relay — maintains hive temperature at 42 °C (the lethal threshold for varroa while safe for bees).
  • Humidifier relay — maintains hive humidity at 65 % RH to prevent desiccation of brood during treatment.

The PID outputs drive two relays in on/off mode (bang-bang modulated by PID to smooth thermal cycles).

Hardware

  • Controller board: ESP32-WROOM 2-channel relay board (AliExpress, DC 5-60 V variant) — esp32_relay_2ch custom Zephyr board.
  • Sensor: Sensirion SHT35 breakout on I2C bus (address 0x44).

Pin Assignment

Function GPIO Notes
Relay 1 GPIO 16 Active high
Relay 2 GPIO 17 Active high
Status LED GPIO 23 Active high
I2C SDA GPIO 21 Expansion
I2C SCL GPIO 22 Expansion
UART TX GPIO 1 Console
UART RX GPIO 3 Console

The SHT35 sensor is not part of the board definition. It is added via a devicetree overlay in the application (boards/esp32_relay_2ch_procpu.overlay). In this project, Relay 1 drives the heater and Relay 2 drives the humidifier.

Building and Flashing

cd zephyr-workspace/workspace
poetry shell
west build -b esp32_relay_2ch/esp32/procpu applications/bee-sauna
west flash

Serial console at 115200 baud will show sensor readings and relay state each second.

Configuration

Hard-coded setpoints and PID tuning parameters are defined at the top of src/main.c:

  • TEMP_SETPOINT_C — target temperature (default 42.0 °C)
  • HUMIDITY_SETPOINT_RH — target humidity (default 65.0 %RH)
  • TEMP_KP, TEMP_KI, TEMP_KD — temperature PID gains
  • HUM_KP, HUM_KI, HUM_KD — humidity PID gains
  • RELAY_THRESHOLD — PID output threshold for relay activation (default 0.5)

Safety Features

The firmware implements several software safety mechanisms:

  • Over-temperature hard cutoff — if the measured temperature reaches TEMP_HARD_CUTOFF_C (default 45 °C), the heater relay is immediately turned off and locked out until the temperature drops below TEMP_RESUME_C (default 40 °C). Uses hysteresis to prevent relay chattering.
  • Over-humidity hard cutoff — same logic for humidity at HUMIDITY_HARD_CUTOFF (default 90 %RH) / HUMIDITY_RESUME (80 %RH).
  • Sensor failure protection — after SENSOR_FAIL_MAX (default 5) consecutive sensor read failures, all relays are shut down until the sensor recovers.
  • All safety events are logged at LOG_ERR level for diagnostic traceability.

Important

These are software-only safeguards. Software can fail. Always install a hardware thermal cutoff (mechanical thermostat or thermal fuse) in series with the heater relay as an independent safety layer.

Future Work

  • Bluetooth Low Energy interface for runtime configuration of setpoints and PID parameters.
  • Persistent storage of settings via NVS.
  • Hardware watchdog integration with automatic relay shutdown on firmware hang.

About

Low Cost Beehive Heater for Varroa mite control based on ESP32. Temperature and Humidity is controlled with a simple PID algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors