Beehive scale and hive monitor

A load-cell scale with a temperature probe tracks honey flow and hive health on solar or a Li-ion cell.

Smart home Board: ESP32 DevKit V1 (WROOM-32) Level: ●●○ ⏱ 2–3 h

⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

Watch the colony without opening the lid

A hive on a scale shows the nectar flow as a steady gain, sometimes a kilogram or two a day, and a swarm as a sudden loss. For a beekeeper with several apiaries, that saves trips and helps to time the extraction.

Weighing right

Four load cells in a bridge under the corners, an HX711 amplifier, and a waterproof junction box. Calibrate with a known weight such as bottles of water. Load cells drift with temperature, so log the temperature next to the weight and correct the trend, or compare only readings taken at the same hour.

  • Read once an hour and sleep in between; a small solar panel and a Li-ion cell are enough.
  • Wind and rain influence the numbers. A light roof and a hard mounting help.
  • Apiaries often have no Wi-Fi. A GSM or LoRa module can send a short message instead.
  • Make the platform stable and level: a tilted scale lies.

Components

  • ESP32 DevKit V1 (30 pin, WROOM-32)
  • HX711 + 4 load cells (platform scale kit)
  • DS18B20 waterproof probe
  • 18650 Li-ion cell + holder
  • TP4056 USB-C Li-ion charger with protection
  • Plastic project enclosure

Wiring

Module Module pin ESP32 pin Note
HX711 DT / SCK digital GPIO16 / GPIO17 VCC 3V3
HX711 E+ E- A+ A- load cells four cells in a bridge follow the colour code of your cells
DS18B20 DATA 1-Wire GPIO4 4.7 kΩ pull-up to 3V3

Libraries

  • HX711 (bogde)
  • OneWire
  • DallasTemperature
  • PubSubClient

Code

#include <WiFi.h>

const char* WIFI_SSID = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";

bool connectWiFi(uint32_t timeoutMs = 20000) {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  uint32_t t0 = millis();
  while (WiFi.status() != WL_CONNECTED && millis() - t0 < timeoutMs) {
    delay(250);
    Serial.print(".");
  }
  Serial.println();
  if (WiFi.status() == WL_CONNECTED) {
    Serial.print("IP: ");
    Serial.println(WiFi.localIP());
    return true;
  }
  return false;
}
#include <PubSubClient.h>

const char* MQTT_HOST = "192.168.1.10";   // IP of your Raspberry Pi / mini-PC
const uint16_t MQTT_PORT = 1883;
const char* MQTT_USER = "esp32";
const char* MQTT_PASS = "mqtt-password";

WiFiClient netClient;
PubSubClient mqtt(netClient);

bool mqttConnect(const char* clientId) {
  mqtt.setServer(MQTT_HOST, MQTT_PORT);
  uint32_t t0 = millis();
  while (!mqtt.connected() && millis() - t0 < 10000) {
    if (mqtt.connect(clientId, MQTT_USER, MQTT_PASS)) return true;
    delay(500);
  }
  return mqtt.connected();
}
#include <HX711.h>
#include <OneWire.h>
#include <DallasTemperature.h>

HX711 scale; OneWire ow(4); DallasTemperature ds(&ow);
float CAL_FACTOR = 22000.0;                       // raw units per kg: calibrate with a known weight (see tips)
const uint64_t SLEEP_US = 15ULL * 60ULL * 1000000ULL;
RTC_DATA_ATTR float tareOffset = 0;

void setup() {
  Serial.begin(115200); ds.begin();
  scale.begin(16, 17);
  if (scale.wait_ready_timeout(2000)) {
    if (tareOffset == 0) { scale.tare(10); tareOffset = scale.get_offset(); } else scale.set_offset(tareOffset);   // first boot with an empty platform = zero
    scale.set_scale(CAL_FACTOR);
    float kg = scale.get_units(10);
    ds.requestTemperatures(); float t = ds.getTempCByIndex(0);
    if (connectWiFi() && mqttConnect("beehive1")) {
      String j = String("{"weight_kg":") + String(kg, 2) + ","temp_c":" + String(t, 1) + "}";
      mqtt.publish("home/beehive1/state", j.c_str(), true); mqtt.loop(); delay(200);
    }
  }
  scale.power_down();
  esp_sleep_enable_timer_wakeup(SLEEP_US); esp_deep_sleep_start();
}
void loop() {}

Build tips

  • Calibrate with a known weight: CAL_FACTOR = raw difference / weight in kg.
  • Shield the electronics from rain and sun, and re-zero after adding a super.

What you need

Buy the parts kit · Estimated total: $19.30

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
HX711 + 4 load cells (platform scale kit) × 1
$6.00
Buy at AliExpress Buy at Amazon.com
DS18B20 waterproof probe × 1
$1.50
Buy at AliExpress Buy at Amazon.com
18650 Li-ion cell + holder × 1
$4.00
Buy at AliExpress Buy at Amazon.com
TP4056 USB-C Li-ion charger with protection × 1
$0.80
Buy at AliExpress Buy at Amazon.com
Plastic project enclosure × 1
$3.00
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Other countries: order these parts on AliExpress with the links below.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Related ideas

⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

Door / window sensor

A battery sensor with a reed switch that wakes from deep sleep only when the door opens.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●○○ Beginner
  • Build time 1–2 h
Pick parts / kit
⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Night-tariff water heater scheduler

Heats the water heater only in the cheap night tariff zone or from surplus solar power, with a temperature limit.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●● Advanced
  • Build time 3–5 h
Pick parts / kit
⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

Orchard and greenhouse frost alert

A battery sensor that wakes up rarely and sends an alert when the temperature falls toward freezing.

  • Board ESP32-C3 SuperMini
  • Level ●○○ Beginner
  • Build time 1–2 h
Pick parts / kit

← All module ideas →

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.