Can't seem to get M5stack HX711 scale to work

Hello,

I am trying to use ESPhome together with the M5Stack Scales kit (a HX711 with four half-bridge resistive strain gauges) and a M5Stack Basic Core v2.6 development kit to create a scale.

I currently have the following configuration:

esphome:
  name: esphome-coffee-scale
  friendly_name: esphome-coffee-scale

esp32:
  board: m5stack-core-esp32
  framework:
    type: arduino

# Enable logging
logger:

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

ota:
  password: "REDACTED"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Coffee-Scale"
    password: "REDACTED"

  manual_ip:
    static_ip: 192.168.1.162
    gateway: 192.168.1.1
    subnet: 255.255.255.0

captive_portal:

spi:
  clk_pin: 18
  mosi_pin: 23
  miso_pin: 19

color:
  - id: my_blue
    red: 94%
    green: 97%
    blue: 100%

font:
  - file: "gfonts://Roboto"
    id: font_roboto_15
    size: 15
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/³µ'

display:
  - platform: ili9xxx
    model: M5STACK
    cs_pin: 14
    dc_pin: 27
    reset_pin: 33
    rotation: 0
    lambda: |-
      Color RED(1,0,0);
      Color BLUE(0,0,1);
      Color WHITE(1,1,1);
      it.printf(0, 0, id(font_roboto_15), id(my_blue), COLOR_OFF, TextAlign::TOP_LEFT, "The current temperature is %.1f °C", id(living_room_temp).state);
      it.printf(0, 20, id(font_roboto_15), id(my_blue), COLOR_OFF, TextAlign::TOP_LEFT, "The current load value is %.1f", id(hx711_value).state);

sensor:
  - platform: hx711
    name: "HX711 Value"
    id: hx711_value
    dout_pin: GPIO21
    clk_pin: GPIO22
    gain: 128
    update_interval: 30s
  - platform: homeassistant
    id: living_room_temp
    entity_id: sensor.living_room_temperature

binary_sensor:
  - platform: gpio
    id: M5_BtnB
    pin:
      number: 38
      inverted: true
    on_click:
      then:
        - switch.toggle: backlight

# GPIO pin of the display backlight
switch:
  - platform: gpio
    pin: 32
    name: "Backlight"
    id: backlight
    restore_mode: ALWAYS_ON

However when running this, I get the following message in the logs [hx711:037]: HX711 is not ready for new measurements yet! and the display shows “nan” for the current load value.

I suspect I’m missing something quite obvious, but I’ve been stuck on this for a while now and have run out of ideas.

Any help would be appreciated!

Cheers,
Dinyar

How is your scales kit actually connected?
Maybe some pin mapping confusion…

Hi @Karosm,

Yeah, I think this was the problem. It looks like the pins that are connected to the grove port can’t be used as GPIO, but somehow are stuck in I2C mode. When I instead use one of the GPIOs that are exposed differently on the Core it works.

Cheers,
Dinyar