TTGO HiGrow with ESPHome

Hi,

I have the battery, salt, soil and BH1750/lx readings but no temp and no humidity readings.

Could not find a valid BMP280 sensor, check wiring!
BH1750 Advanced begin

Regards.

I dont understand why you linked the two 3.3 volts together with a wire?

On this dht22, there is a 4M resistor between the NC and GND pin and VCC
and the usual 3.2 K between vcc and data.

I did not found them on the lilygo board.

Regards

JPD

How about the pins order?

I soldered 4 wires to the probes hole: vcc-data-gnd-nc and then I tried with the dhat 12 right pin order.

Then I replaced it with a dht22 pluging the wires accordingly.

Zero success. Humidity and temp stays at 0 in all configuration.
What is salt ?

This probe could have been something else than a piece of shit.

More info here
https://github.com/Xinyuan-LilyGO/TTGO-HiGrow/issues/1

I Lost track of the total working solution. Can you please provide me the total .yaml configuration?

1 Like

In case you still need it, this is my config which also includes a change to use MQTT rather than the API

esphome:
  name: higrow1
  platform: ESP32
  board: lolin32

wifi:
  ssid: "<ssid>"
  password: "<key>"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Higrow Fallback Hotspot"
    password: "<key>"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant via API
#api:

# Enable Home Assistant via MQTT
mqtt:
  broker: <mqtt server ip address>
  username: <mqtt user name>
  password: <mqtt password>

ota:

i2c:
  sda: 25
  scl: 26
  scan: True
  id: bus_a

switch:
  - platform: gpio
    pin: GPIO4
    name: "Sensor Power"
    id: spower
    restore_mode: ALWAYS_ON
    internal: true

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO35
      mode: INPUT_PULLUP
      inverted: True
    name: "Wake Button"

sensor:
  - platform: dht
    model: dht11
    pin:
      number: 16
      mode: input
    temperature:
      name: "HiGrow1 Temperature"
    humidity:
      name: "HiGrow1 Humidity"
    update_interval: 60s
    setup_priority: -100
    
  - platform: adc
    pin: 32
    name: "HiGrow1 Soil"
    update_interval: 60s
    unit_of_measurement: '%'
    filters:
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 1.1 -> 0.0
          - 0.0 -> 100.0
    
  - platform: adc
    pin: 33
    name: "HiGrow1 Battery"
    attenuation: 11db
    unit_of_measurement: 'V'
    update_interval: 60s
    filters:
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 2.06 -> 1.89
      - lambda: return x * 2.0;
        
  - platform: adc
    pin: 34
    name: "HiGrow1 Salt"
    update_interval: 60s
    unit_of_measurement: '%'
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 1.1 -> 100.0
    
  - platform: bh1750
    i2c_id: bus_a
    name: "BH1750 Illuminance"
    address: 0x23
    update_interval: 60s
2 Likes

Alright, apologies for my earlier post, I jumped the gun too soon. But the below config appears to work for the light sensor. It seems it takes a while for the BH1750 to show up on the i2c bus and ESPHome boot timing will miss it unless you use the setup_priority function on a few components.

esphome:
  name: garden_bed_01
  platform: ESP32
  board: lolin_d32
  on_shutdown:
    then:
      - switch.turn_off: spower
wifi:
  ssid: "SSID"
  password: "password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garden Bed 01 Fallback Hotspot"
    password: "password"

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "password"

ota:
  password: "password"

deep_sleep:
  run_duration: 60s
  sleep_duration: 60m

switch:
  - platform: gpio
    pin: GPIO4
    name: "Sensor Power"
    id: spower
    restore_mode: ALWAYS_ON
    internal: true
    setup_priority: 1000

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO35
      mode: INPUT_PULLUP
      inverted: True
    name: "Wake Button"

i2c:
  sda: 25
  scl: 26
  scan: True
  id: bus_a
  setup_priority: -200

sensor:
  - platform: dht
    model: dht11
    pin:
      number: 16
      mode: input
    temperature:
      name: "HiGrow1 Temperature"
    humidity:
      name: "HiGrow1 Humidity"
    update_interval: 60s
    setup_priority: -100
    
  - platform: adc
    pin: GPIO32
    name: "HiGrow1 Soil"
    update_interval: 60s
    attenuation: 11db
    #unit_of_measurement: '%'
    #filters:
    #  - calibrate_linear:
    #      # Map 0.0 (from sensor) to 0.0 (true value)
    #      - 1.1 -> 0.0
    #      - 0.0 -> 100.0
    
  - platform: adc
    pin: 33
    name: "HiGrow1 Battery"
    attenuation: 6db
    unit_of_measurement: 'V'
    update_interval: 60s
    filters:
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 2.06 -> 1.89
      - lambda: return x * 2.0;
        
  - platform: adc
    pin: GPIO34
    name: "HiGrow1 Salt"
    update_interval: 60s
    unit_of_measurement: '%'
    accuracy_decimals: 4
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 1.1 -> 100.0
    
  - platform: bh1750
    i2c_id: bus_a
    name: "BH1750 Illuminance"
    address: 0x23
    update_interval: 60s
    setup_priority: -300
1 Like

What kind of battery life do you get with this? I have a similar one that gets terrible battery life.

I’m using a 1000mAh lipo on these. While the config posted (60s on, 1h off) wouldn’t last much more that a day or so, I am currently doing some power testing on a 60s on, 4hr off config and it looks like I’m getting about 1-2 weeks of battery life.

I’m currently building a little solar charging setup to attach to the sensor so that it tops off the sensor battery during the day so that it can run it continuously.

1 Like

I’m looking to do an improved version of this board, i2c everything where possible and support better (100% RH) and additional external sensors (ds18b20 or another sht30/31/35) and maybe swap lux sensor for LDR, and inspired by the feather S2 im going to have the power supply to sensors controlled to off by using a second dedicated sensor LDO with enable pin tied to gpio.

My needs also tempt me to add a low current relay with power sense for DC up to ²⁶volt using the INA219 to control a valve per device.

Will keep you in the loop as am on nodered right now but wish to get HA running comfortably

1 Like

how would it be with more deep sleep sets??
Is this possible?
Like set deep_sleep1 4h if soil 70%
and deep_sleep2 2h if soil 40% and so on…
but this should be automated from ha or node red I guess so the deep_sleep trigger comes from outside esp?

Dont know how to code it, Im relative new in this area…

2 Likes

I imagine that you could use a combination of global variables and lambdas to make updates to the sleep interval during each wake period. That’s my unofficial guess just by looking at the docs. You might try hitting up the Discord channel.

On the one i have, the sensors are directly attached to power and not controlled by the ESP. this is the main cause of power loss. No matter how much you put it to sleep, the battery drops like a rock. i would suspect this might be suffering from a similar issue.

On the ESP32, you have the option of waking up on any RTC pin. However, there’s one scenario that you need to tell ESPHome how to handle: What if the wakeup pin is already in the state with which it would wake up when the deep sleep should start? There are three ways of handling this using the wakeup_pin_mode option:

  • IGNORE (Default): Ignore the fact that we will immediately exit the deep sleep mode because the wakeup pin is already active.
  • KEEP_AWAKE : Keep the ESP32 awake while the wakeup pin is still active. Or in other words: defer the activation of the deep sleep until the wakeup pin is no longer active.
  • INVERT_WAKEUP : When deep sleep was set up to wake up on a HIGH signal, but the wakeup pin is already HIGH, then re-configure deep sleep to wake up on a LOW signal and vice versa. Useful in situations when you want to use observe the state changes of a pin using deep sleep and the ON/OFF values last longer.

…On the ESP32, you additionally have the option to wake up on any RTC pin ( GPIO0 , GPIO2 , GPIO4 , GPIO12 , GPIO13 , GPIO14 , GPIO15 , GPIO25 , GPIO26 , GPIO27 , GPIO32 , GPIO39 ).

Don’t know if it helps :wink:

(PS: I can’t test anything for now, my T-Higrow are still in China @ packaging…)

1 Like

I think this might be the earlier version? The version of the board that I have has an enable pin on one of the 3.3v regulators that feeds the sensors. It’s connected to GPIO4, referred in the config above as Sensor Power/spower. I make sure to turn that off before shutting down.

Go to:

LILYGO TTGO HIGrow

There is a fully functional program and a tutorial for setting this module up and integrate into Home-Assistant.

Also a 3D print is available for a case to the module

2 Likes

Thanks for the info :wink:
I don’t know about the others in this thread, but my goal is to use the higrow with esphome and not have to manage a clean code by ardruino ide…

would be nice if it work to convert the orginal bin of the seller to a esphome yaml, so we could see what are the breaking differences :smiley:

I did look into the ESPHome, but that was too Chinese to me.

I and BeardedTinker is working on to get the mqtt autodiscover to work with the module, so all the configuration yaml code will disappear.

This will be the version 2.0.
Version 2.0 of the INO sketch will be a one only, meaning, that no matter how many modules you have, you only need one sketch.

2 Likes

how this going? i want to do the exact same thing control a dc valve and monitor everything else. Did you prototype our own PCB?

LilyGo released on Twitter image yesterday (and video) of small pump attached to PCB to pump water based on sensor data.

saw that, but the newest higrow gives me poor data compared to the 8266 version. its why i was curious if @tyeth made any headway

Hi,
Anyone has experience with the bme280 version? How to set the yaml file?
Second question: Do i need to include the configuration.h file?

Regards

2 Likes