Smart Beehive Winter Monitor
"My strongest hive died overnight on November 9, 2025. The bees were alive at sundown — gone by sunrise. No predator. No disease. No starvation. The cause was hive rain: warm humid air from the cluster rose, hit the cold inner cover, condensed into water droplets, and rained down on the bees. If I had known the humidity was climbing, I could have ventilated. I could have saved them."
This is a CircuitPython sensor pod that watches the inside of a beehive and alerts the beekeeper hours before condensation forms. It runs on an ESP32-S3 Feather, sleeps between readings, publishes to a free Adafruit IO dashboard over Wi-Fi, and computes the dew-point spread — the leading indicator that humidity alone can't show.
What you can see live, anywhere on your phone:
- Temperature (°F and °C)
- Humidity %
- Dew point and dew-point spread
- Tiered alert level: OK / WATCH / ALERT / EMERGENCY
Total cost: ~$35 in parts / drill / NO Soldering. Difficulty: Beginner-friendly soldering. No code rewriting required — drop the file on, edit one settings file, done.
This was built and demoed at Boston College as part of Dr. John Gallaugher's Physical Computing Course.
Supplies
- ESP32-S3 Feather, 4MB Flash + 2MB PSRAM https://www.adafruit.com/product/5477 Adafruit $17.50
- AHT20 Temp & Humidity STEMMA QT https://www.adafruit.com/product/4566 $4.50
- STEMMA QT 4-pin cable, 50mm https://www.adafruit.com/product/4399 $0.95
- 4AA Battery Powered Outlet 5V USB Power Supply https://www.amazon.com/dp/B0FH2LF9QP/ref=sspa_dk_detail_4?pd_rd_i=B0FH2LF9QP&pd_rd_w=m0w9u&content-id=amzn1.sym.37a3b014-9925-4abb-9f3c-403afdd7d727&pf_rd_p=37a3b014-9925-4abb-9f3c-403afdd7d727&pf_rd_r=XB0WD4FHPPJ8M0HJBWM0&pd_rd_wg=ptIGP&pd_rd_r=8096c587-9444-4393-810f-f92e16710b89&sp_csd=d2lkZ2V0TmFtZT1zcF9kZXRhaWw&th=1 OR Lithium Ion Battery 3.7V 2000mAh https://www.adafruit.com/product/2011 $7.19 - $12.50
- PTFE-coated stainless mesh
- Standard Langstroth brood box (8/10 frames). In my example, I use an 8-frame brood box
- Adafruit MPR121 12-Key Capacitive Touch Sensor — STEMMA QT (#4830) — $7.95 — for Phase 2 cluster sensing
- Insulating foam board for cover https://www.homedepot.com/p/Owens-Corning-FOAMULAR-NGX-1-in-x-2-ft-x-2-ft-R-5-Project-Panel-XPS-Rigid-Foam-Board-Insulation-9WE/315401957?MERCH=REC-_-pip_alternatives-_-202090366-_-3-_-n/a-_-n/a-_-n/a-_-n/a-_-n/a
Drill the Sensor Aperture (One Hole, That's It)
The whole electrical install hinges on a single 2″ (48 mm) hole in the back wall of the brood box.
Why one hole: One large aperture gives clean airflow, doesn't structurally weaken the wall, and leaves room to add a camera or second sensor later without re-drilling.
Where to drill:
- Center horizontally on the back wall (178 mm from each edge on a standard 14″ × 10″ board)
- Top edge of aperture: 115 mm from the top of the board (this places it ~15 mm below the routed handle cutout)
- Bottom edge: 164 mm from top
- Center of aperture: 139.5 mm from top — right at the brood-arch level where bees cluster
Drill it:
- Remove the brood box from the hive before bees are installed (or in early spring before they're active).
- Use a 2″ Forstner bit. Drill from the outside in. Back the bit out partway through to clear chips and prevent splintering on the inside face.
- Sand the inside lip smooth — bees will worry at any rough edges.
Mount the Mesh (Bee Side Only)
The PTFE-coated stainless mesh keeps bees out of the sensor cavity while letting hive air reach the AHT20. Bees can't propolise PTFE — it's too slick.
- Cut a disc of mesh about 50 mm in diameter (10 mm larger than the aperture in every direction).
- Mix 2-part epoxy.
- Apply a thin bead of epoxy to the inside (bee-facing) face of the back wall, in a ring around the aperture. Don't get epoxy on the mesh openings themselves.
- Press the mesh disc flat against the bead, centered on the aperture. The mesh should sit flush with the inner wood surface — no recess for bees to investigate.
- Wipe excess epoxy with a paper towel before it cures.
- Let cure 24 hours before installing electronics.
Critical: the mesh must be on the inside face of the wall. If you mount it on the outside, the aperture becomes a 20 mm-deep tunnel that bees will fill with propolis from the inside.
Cut the Matching Plug and Insulate the Hole
- Cut out a matching plug and insulate the aperture
- Drill a clearance hole for the STEMMA QT cable that matches the back-wall aperture and mount the same way.
Wire It Up (No Soldering Required)
This is genuinely the easiest part if you use STEMMA QT.
- Plug one end of the STEMMA QT cable into the AHT20.
- Plug the other end into the Feather's STEMMA QT port (the small white connector near the USB-C).
- Plug the LiPo battery into the JST-PH connector on the Feather (the larger 2-pin white connector at the end of the board).
That's the whole electrical build. No breadboard, no jumper wires, no soldering.
Note that my AHT20 is mounted at the very front of the pod cavity so its sensor face points toward the aperture. The mesh-protected aperture exposes it to actual hive air. Don't bury the AHT20 deep in the pod — you'll measure pod air, not hive air.
Flash CircuitPython and Install Libraries
Plug the ESP32-S3 Feather into your computer with a data-capable USB-C cable.
Download the latest CircuitPython 9.x .UF2 for "Feather ESP32-S3 4MB Flash 2MB PSRAM" from circuitpython.org/board/adafruit_feather_esp32s3_4mbflash_2mbpsram/
Double-tap the Feather's reset button. A drive named FTHRS3BOOT should mount.
Drag the .UF2 onto that drive. The board will reboot and a new drive named CIRCUITPY will appear.
Install circup (the CircuitPython library installer): pip install circup
With the Feather still plugged in, run:
circup install adafruit_ahtx0 adafruit_minimqtt adafruit_connection_manager adafruit_requests adafruit_ticks
That installs every library the firmware needs.
Drop in Code.py and Settings.toml
The most current code.py code is located here https://github.com/goonart/Smart-Beehive
The firmware:
- Wakes every 10 minutes (60 seconds during demos — change WAKE_INTERVAL_S at top of file)
- Reads AHT20 temperature and humidity
- Calculates dew point (Magnus formula) and dew-point spread
- Classifies the alert level (OK / WATCH / ALERT / EMERGENCY) based on humidity, spread, and temperature
- Publishes 9 feeds to Adafruit IO over Wi-Fi
- Deep-sleeps until the next wake
settings.toml — create this file at the root of the CIRCUITPY drive:
CIRCUITPY_WIFI_SSID = "YourWiFiName"
CIRCUITPY_WIFI_PASSWORD = "YourWiFiPassword"
AIO_USERNAME = "your_aio_username"
AIO_KEY = "aio_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
HIVE_ID = "xxxxxx-hive-1"
Get your AIO key: sign in at io.adafruit.com → click the yellow key icon top-right → copy the username and the active key.
Note: the sample variable names in the AIO key panel are ADAFRUIT_AIO_USERNAME / ADAFRUIT_AIO_KEY, but our code uses AIO_USERNAME / AIO_KEY. Use the names this code expects, or change the os.getenv() calls in code.py to match.
Set Up the Adafruit IO Dashboard
When the firmware first publishes, it auto-creates a group called richford-hive-1 (or whatever you set HIVE_ID to). Inside the group you need 9 feeds. Adafruit IO won't auto-create feeds inside groups, so create them manually:
- Go to io.adafruit.com → Feeds → click into your richford-hive-1 group.
- Click the blue + in the group, choose "Create New Feed", and create each of these (just the name — no prefix):
- temp-c
- temp-f
- humidity
- dew-point-c
- dew-point-f
- dew-spread-c
- dew-spread-f
- alert-level
- alert-reason
- Build the dashboard: Dashboards → New Dashboard → "Richford Hive" → add blocks:
- Line Gauge for temp-f, humidity, dew-spread-f
- Line Chart combining temp-f and dew-point-f (24 hr range)
- Indicator for alert-level (color zones: 0 green, 1 yellow, 2 orange, 3 red)
- Stream or Text block for alert-reason
- Triggers (post-deployment): Adafruit IO → Actions → Triggers → New. Recommended:
- humidity > 75 for 4 hours → email (WATCH)
- humidity > 85 for 2 hours → email + SMS (ALERT)
- dew-spread-f < 2 → SMS (EMERGENCY — raining now)
The free tier supports email triggers. SMS requires IO Plus ($10/month), which is worth it for a hive at risk of overnight collapse.
This is an example of an output running the code in PyCharm:
============================================================
Wake @ 2788.3s — Richford hive monitor MPR121 not active this cycle (Phase 2 pending).
Temp: 20.72°C (69.29°F) Humidity: 39.7%RH
Dew point: 6.51°C Spread: 14.21°C
Alert: [OK] Normal
WiFi connected: 10.20.79.128
Published. Sleeping 60s...
Code done running.
Press any key to enter the REPL.
Use CTRL-D to reload.
Pretending to deep sleep until alarm, CTRL-C or file write.