HX711 load cell ESP8266

Hi there

I am trying to build a scale with the following components:

ESP8266 aka Wemos D1 mini
HX711
Load cell https://www.sparkfun.com/products/10245

I followed this tutorial where I used the below wiring from the right side of the HX711 and D1.
Bildschirmfoto 2022-06-04 um 01.30.37

I plan to only use one cell and used the wiring below between the load cell and HX711 (50kg Load Cells with HX711 and Arduino. 4x, 2x, 1x Diagrams. - Circuit Journal)

Unfortunately it doesnt seem to work, I cant get Arduino IDE to work in order to do the calibration.

question
has anybody knowledge how I could realize this with ESPHome and may help with the wiring? I have basic knowledge with ESPHome but not any with wiring load cells. I spent hours of research but couldnt find any suitable tutorial with my config including only one cell. for example I found this thread: ESP8266 + HX711 + 4 small load cells giving incorrect values

The goal is to use the scale for a “smart” toilet paper holder :wink:

all the best

Andrew

The wires colors on load cells are not always correct. With a resistance meter, a pair will be 2x the resistance. That pair should be the e- and e+ in your diagram

many thanks for the quick reply. I measured the resistance and as per 50kg Load Cells with HX711 and Arduino. 4x, 2x, 1x Diagrams. - Circuit Journal I have 1K between red and white or red and black.

this is how my code with ESPHome looks like:

esphome:
  name: loadcell

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "XX"

wifi:
  ssid: 'XX'
  password: 'XX'

# Example configuration entry
sensor:
  - platform: hx711
    name: "HX711 Value"
    dout_pin: D1
    clk_pin: D2
    gain: 128
    update_interval: 2s
    

the log always shows a value of 0 regardless how much pressure I put on the sensor. I even tried another HX711 and another load cell (also checked the resistance) but have the same results.

I tried this config here: HX711 Load Cell Amplifier — ESPHome

detailed wiring:

I use the full four load cells and never tried with less. The only thing I might suggest is trying with all 4 load cells to first make sure that the items you have are working.

thats a good idea, actually it doesnt work either :S I have no clue what I am doing wrong but I will put it aside for the moment :stuck_out_tongue: I never had issues with other ESP-projects. If I find a solution I will post it here.

This is the guide I used

https://learn.sparkfun.com/tutorials/getting-started-with-load-cells

2 Likes

salut andré
perso j’ai eu quelque souci aussi mais j’ai pris des risque et ça a payé.
j’ai une seul cellule de charge de 200kg et en faite les couleur sont :
rouge = v+
vert = v-
blanc = e-
noir = e+
rien a y comprendre mais ça a fonctionner pour moi .
bonne chance!

Hi, did you ever get this to work??

Did you manage to make one sensor work?

not really, I switched to a FSR-sensor FSR - the best bed occupancy sensor - #9 by tom_l which works awesome! give it a try, it easy to setup and very reliable.

For future reference: there are “single” load-cells with 4 internal sensors aka beam load-cells and these will plug straight into the HX711 (and have more wires).

The sensor that was being used must be configured as part of 4 into a Wheatstone bridge - Wikipedia or it simply won’t work; the HX711 is (from memory) measuring tiny tiny voltage differences and needs the cancellation and comparison effect of this bridge (which is a bit of a mind-bender in itself, and look how old it is)

Also the stamped metal sensor being used here is a bit …terrible (I have some). Its poor measurement repeatability and creep under load will be annoying, I’d suggest a cheap beam sensor is 10x better and simpler at the same time.

Hello @bwooce thanks for your idea. I need to build something to measure the weight of my chicken’s food and water.
What kind of beam sensor do you have in mind? Can you please give me an example on aliexpress ?

I got it to work with the above mentioned schema with one cell.
What helped me most was to measure everything after the wiring.
Measuring the cell:
Resistance of 1k between Black / Red and White / Red. 2k between Black / White. See 50kg Load Cells with HX711 and Arduino. 4x, 2x, 1x Diagrams. - Circuit Journal (scroll down).
Measuring HX711:
E+ to E-: approx. 4V (using 5V input).
E+ to A- and E+ to A+: approx. 2V (half of E+ to E-, if you are using 3.3V input it’s less)
My first HX711 did not have these values (I remember approx. 1.5 V E+/E-), with this I got the same error as mentioned above ("Got value -1).

1 Like

Thought I’d share a couple of points from a similar project of mine, monitoring how many pints of beer are left in two kegs.

My first problem was using 20kg x 4 weight sensors for 3 gallon Corney kegs, which only weight like 20-30 pounds full. Fixed my issue by changing to 5kg x 4 = 44 pound limit.

ESPHome code:

esphome:
  name: beer-scales
  friendly_name: Beer Scales

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "key"

ota:
  password: "pw"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.0.209
    gateway: 192.168.0.1
    subnet: 255.255.255.0
  power_save_mode: none
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Beer-Scales Fallback Hotspot"
    password: "pw2"

captive_portal:

sensor:
  - platform: hx711
    name: "Keg 1 Pints" #Left Keg + Scale
    clk_pin: GPIO4 #D4 = black
    dout_pin: GPIO5 #D5 = yellow
    gain: 128
    #id: keg1_pints
    icon: "mdi:beer-outline"
    unit_of_measurement: pints
    update_interval: 3s
    accuracy_decimals: 1
    filters:
      - calibrate_linear: # used to calibrate.  Put value reported followed -> by actual weight in ounces. The first one (# -> 0) is tare
          - 510000 -> 0 #tare number. Will need to tare with empty keg
          - 1385412 -> 97.2
      - multiply: .0625 #1/16 to convert to pints
      - offset: -0.3 # subtract sediment from pints left
  - platform: hx711
    name: "Keg 2 Pints" #right Keg + Scale
    clk_pin: GPIO18 #D18 = green
    dout_pin: GPIO19 #D19 = red
    gain: 128
    #id: keg2_pings
    icon: "mdi:beer-outline"
    unit_of_measurement: pints
    update_interval: 3s
    accuracy_decimals: 1
    filters:
      - calibrate_linear:
          - 916503 -> 0 #tare number. Will need to tare with empty keg
          - 1718857 -> 97.2
      - multiply: .0625 #1/16 to convert to pints
      - offset: -0.3 # subtract sediment from pints left