Newbie needs help with ESP8266, HX711 and a load cell


I’m quite pleased with my Cayenne now. It shows weight, temperature, humidity, uptime and RSSI. However, it would be nice with a battery indicator as well. Is it possible to create one in Cayenne and if so, is there any example code somewhere or someone who can help? I am using EPS8266 Wemos D1 mini Pro.


google search to read battery voltage and see first without adding cayenne you can read battery voltage.
here are some post from community Battery Widget and ESP8266 Sleeping Temperature Station


Thanks for support. I’ll check this out.


Hi, you inspire me for a project that control hives in various place.
I am stuck with the weight sensor because i can’t have solid reading. How you manage it? I’m using load cell (10 kg for testing) + hx711 + wemos d1 r2.


can you post the code you are using and first of all solder the pins correctly to HX711.


#include “HX711.h”

// HX711.DOUT - pin #d4
// HX711.PD_SCK - pin #d3

HX711 scale(D4, D3); // parameter “gain” is ommited; the default value 128 is used by the library

void setup() {
Serial.println(“HX711 Demo”);

scale.set_scale(); // this value is obtained by calibrating the scale with known weights; see the README for details
scale.tare(); // reset the scale to 0
Serial.print("put know weight);

Serial.print(":calibration factor is\t");
float fattore= scale.get_units(10)/1000;


void loop() {
Serial.print(“one reading:\t”);
Serial.print(scale.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale.get_units(10), 1);

scale.power_down(); // put the ADC in sleep mode


The pins are solder correctly and strong i think, i will post a photo tonight



Unless I’m missing something, your readings are not varying by more than 1%. How accurate is the device? (precision!=accuracy)


I don’t have a datasheet, but the cell come from a kitchen balance that have accuracy reading (+ - 100 grams is too much)!


From your screen shot it’s only ±10 grams, unless I’m not understanding it. But like I said in the last post, just because it has 1 digit precision does not mean it is 1 digit accurate and vise versa. Here is a good read about it


Now my Beehive scale has been running 10 weeks under real conditions. Everything has worked well so far.
Now, I wonder if it is possible to arrange some kind of floating trigger. It would bee nice with a warning if the weight suddenly drops about 2 kg or more. It would be a good indication that I had a bee swarm. I’m thinking of a floating trigger that automatically adjusts 2 kg below the total weight. I know I can set triggers manually, but then I have to adjust it every day.


what do you mean by this. can you provide more details?


Hmm … how should I explain … let’s say that the wave shows 80 kg and I want it to alert if the weight drops to 78 kg. If the wave shows 85 kg, I would like it to alert if the weight drops to 83 kg. If a swarm leaves the Beehive, I get a message and can catch the swarm. A normal swarm weighs approximately 2 - 5 kg.


something like this:

x1 = 80;      //read the value from the senso.
if ( x2 != x1)  //see whether x1 has changed.
x2 = x1;
x = x2 - x1;
if ( x == 2)
cayenne.virtualWrite(1,1,"digital_sensor", "d");

this is the flow you have to use, you might have to do the neccesay changes in this code.


ok, will try it after this season.

Thanks for support.