Pool Sensor with ESP32

When you get the logs from ESPHome dashboard it will show the dialogue for the i2c component scanning your channel for a device. It will show the address if it finds something. That address is what you then use in your sensor set up. Can you post your full log from the dashboard?

Edit: post text not photo. And make use of the formatting for yaml.

See page 5 of the Atlas pool kit doc for the addresses

…and the little led will be blue when powered on and flick green for a split second each time a reading is taken which is a good indicator things are working….aside from seeing values in any output console you have.

And there is sample Atlas code on their website which (IIRC) has all the i2c addresses.

Here’s the full log from the Dashboard:

It looks like it didn’t find I2C devices, so something must still be wrong.


INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/pool-chemistry.yaml...
INFO Starting log output from pool-chemistry.local using esphome API
INFO Successfully connected to pool-chemistry.local
[08:34:45][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 14 2023, 08:38:20
[08:34:45][C][wifi:505]: WiFi:
[08:34:45][C][wifi:363]:   Local MAC: 0C:DC:7E:CB:62:08
[08:34:45][C][wifi:364]:   SSID: 'Noble-Guest'[redacted]
[08:34:45][C][wifi:365]:   IP Address: 192.168.2.27
[08:34:45][C][wifi:367]:   BSSID: 76:A7:41:AF:25:EC[redacted]
[08:34:45][C][wifi:368]:   Hostname: 'pool-chemistry'
[08:34:45][C][wifi:370]:   Signal strength: -66 dB ▂▄▆█
[08:34:45][C][wifi:374]:   Channel: 11
[08:34:45][C][wifi:375]:   Subnet: 255.255.255.0
[08:34:45][C][wifi:376]:   Gateway: 192.168.2.1
[08:34:45][C][wifi:377]:   DNS1: 94.140.14.49
[08:34:45][C][wifi:378]:   DNS2: 94.140.14.59
[08:34:45][C][logger:301]: Logger:
[08:34:45][C][logger:302]:   Level: DEBUG
[08:34:45][C][logger:303]:   Log Baud Rate: 115200
[08:34:45][C][logger:305]:   Hardware UART: UART0
[08:34:45][C][i2c.arduino:053]: I2C Bus:
[08:34:45][C][i2c.arduino:054]:   SDA Pin: GPIO21
[08:34:45][C][i2c.arduino:055]:   SCL Pin: GPIO22
[08:34:45][C][i2c.arduino:056]:   Frequency: 50000 Hz
[08:34:45][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[08:34:45][I][i2c.arduino:069]: Results from i2c bus scan:
[08:34:45][I][i2c.arduino:071]: Found no i2c devices!
[08:34:45][C][ezo.sensor:015]: EZO 'ph_ezo'
[08:34:45][C][ezo.sensor:015]:   State Class: ''
[08:34:45][C][ezo.sensor:015]:   Unit of Measurement: 'pH'
[08:34:45][C][ezo.sensor:015]:   Accuracy Decimals: 0
[08:34:45][C][ezo.sensor:016]:   Address: 0x63
[08:34:45][C][ezo.sensor:020]:   Update Interval: 10.0s
[08:34:45][C][ezo.sensor:015]: EZO 'RTD Temperature'
[08:34:45][C][ezo.sensor:015]:   State Class: ''
[08:34:45][C][ezo.sensor:015]:   Unit of Measurement: '°C'
[08:34:45][C][ezo.sensor:015]:   Accuracy Decimals: 2
[08:34:45][C][ezo.sensor:016]:   Address: 0x66
[08:34:45][C][ezo.sensor:020]:   Update Interval: 10.0s
[08:34:45][C][captive_portal:088]: Captive Portal:
[08:34:45][C][mdns:108]: mDNS:
[08:34:45][C][mdns:109]:   Hostname: pool-chemistry
[08:34:45][C][ota:093]: Over-The-Air Updates:
[08:34:45][C][ota:094]:   Address: pool-chemistry.local:3232
[08:34:45][C][ota:097]:   Using Password.
[08:34:45][C][api:138]: API Server:
[08:34:45][C][api:139]:   Address: pool-chemistry.local:6053
[08:34:45][C][api:141]:   Using noise encryption: YES
[08:34:47][E][ezo.sensor:088]: read error
[08:34:48][E][ezo.sensor:088]: read error

Exactly how is it all wired up?

It’s the box directly from Atlas with pH, ORP, and Temperature probes. Everything was already preinstalled in the kit, so I just connected the probes to my pool equipment, flashed it with homeassitant using ESPHome dashboard. Took a stab editing the yaml and failed. Did you use the kit directly from Atlas? If so, can I see what your YAML looks like?

This is my latest attempt, but the logs indicate that nothing is working:

esphome:

  name: pool-chemistry

  friendly_name: Pool-Chemistry

esp32:

  board: esp32dev

  framework:

    type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "redacted"

ota:

  password: "abcdefg"

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Pool-Chemistry Fallback Hotspot"

    password: "vL1ncqnp0x5b"

sensor:

  - platform: ezo

    i2c_id: bus_a

    id: ph_ezo

    address: 99

    unit_of_measurement: "pH"

    update_interval: 10s

 

  - platform: ezo

    i2c_id: bus_a

    id: ph_orp

    name: "Chlorine"

    address: 98

    unit_of_measurement: "ppm"

    update_interval: 10s

  - platform: ezo

    i2c_id: bus_a

    id: rtd_ezo

    name: "Temperature"

    address: 102

    accuracy_decimals: 2

    unit_of_measurement: "°C"

    update_interval: 10s

i2c:

   - id: bus_a

     scan: true

   - id: bus_b

     scan: true

   

captive_portal:

Here’s the associated logs:


INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/pool-chemistry.yaml...
INFO Starting log output from pool-chemistry.local using esphome API
INFO Successfully connected to pool-chemistry.local
[15:46:37][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 15 2023, 15:42:59
[15:46:37][C][wifi:505]: WiFi:
[15:46:37][C][wifi:363]:   Local MAC: 0C:DC:7E:CB:62:08
[15:46:37][C][wifi:364]:   SSID: 'Noble-Guest'[redacted]
[15:46:37][C][wifi:365]:   IP Address: 192.168.2.27
[15:46:37][C][wifi:367]:   BSSID: 7E:8A:20:D7:E1:48[redacted]
[15:46:37][C][wifi:368]:   Hostname: 'pool-chemistry'
[15:46:37][C][wifi:370]:   Signal strength: -59 dB ▂▄▆█
[15:46:37][C][wifi:374]:   Channel: 6
[15:46:37][C][wifi:375]:   Subnet: 255.255.255.0
[15:46:37][C][wifi:376]:   Gateway: 192.168.2.1
[15:46:37][C][wifi:377]:   DNS1: 94.140.14.49
[15:46:37][C][wifi:378]:   DNS2: 94.140.14.59
[15:46:37][C][logger:301]: Logger:
[15:46:37][C][logger:302]:   Level: DEBUG
[15:46:37][C][logger:303]:   Log Baud Rate: 115200
[15:46:37][C][logger:305]:   Hardware UART: UART0
[15:46:37][C][i2c.arduino:053]: I2C Bus:
[15:46:37][C][i2c.arduino:054]:   SDA Pin: GPIO21
[15:46:37][C][i2c.arduino:055]:   SCL Pin: GPIO22
[15:46:37][C][i2c.arduino:056]:   Frequency: 50000 Hz
[15:46:37][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[15:46:37][I][i2c.arduino:069]: Results from i2c bus scan:
[15:46:37][I][i2c.arduino:071]: Found no i2c devices!
[15:46:37][C][i2c.arduino:053]: I2C Bus:
[15:46:37][C][i2c.arduino:054]:   SDA Pin: GPIO21
[15:46:37][C][i2c.arduino:055]:   SCL Pin: GPIO22
[15:46:37][C][i2c.arduino:056]:   Frequency: 50000 Hz
[15:46:37][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[15:46:37][I][i2c.arduino:069]: Results from i2c bus scan:
[15:46:37][I][i2c.arduino:071]: Found no i2c devices!
[15:46:37][C][ezo.sensor:015]: EZO 'ph_ezo'
[15:46:37][C][ezo.sensor:015]:   State Class: ''
[15:46:37][C][ezo.sensor:015]:   Unit of Measurement: 'pH'
[15:46:37][C][ezo.sensor:015]:   Accuracy Decimals: 0
[15:46:37][C][ezo.sensor:016]:   Address: 0x63
[15:46:37][C][ezo.sensor:020]:   Update Interval: 10.0s
[15:46:37][C][ezo.sensor:015]: EZO 'Chlorine'
[15:46:37][C][ezo.sensor:015]:   State Class: ''
[15:46:37][C][ezo.sensor:015]:   Unit of Measurement: 'ppm'
[15:46:37][C][ezo.sensor:015]:   Accuracy Decimals: 0
[15:46:37][C][ezo.sensor:016]:   Address: 0x62
[15:46:37][C][ezo.sensor:020]:   Update Interval: 10.0s
[15:46:37][C][ezo.sensor:015]: EZO 'Temperature'
[15:46:37][C][ezo.sensor:015]:   State Class: ''
[15:46:37][C][ezo.sensor:015]:   Unit of Measurement: '°C'
[15:46:37][C][ezo.sensor:015]:   Accuracy Decimals: 2
[15:46:37][C][ezo.sensor:016]:   Address: 0x66
[15:46:37][C][ezo.sensor:020]:   Update Interval: 10.0s
[15:46:37][C][captive_portal:088]: Captive Portal:
[15:46:37][C][mdns:108]: mDNS:
[15:46:37][C][mdns:109]:   Hostname: pool-chemistry
[15:46:37][C][ota:093]: Over-The-Air Updates:
[15:46:37][C][ota:094]:   Address: pool-chemistry.local:3232
[15:46:37][C][ota:097]:   Using Password.
[15:46:37][C][api:138]: API Server:
[15:46:37][C][api:139]:   Address: pool-chemistry.local:6053
[15:46:37][C][api:141]:   Using noise encryption: YES
[15:46:39][E][ezo.sensor:088]: read error
[15:46:40][E][ezo.sensor:088]: read error
[15:46:41][E][ezo.sensor:088]: read error

@HG901 here’s mine. Note, my config is set to publish values via MQTT so change/rip that out as needed as well as changing other credentials in the top sections as appropriate.

esphome:
  name: poolmonitortest
  friendly_name: poolmonitortest

esp32:
  board: featheresp32
#  framework:
#    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
   key: "1234567890"
    
ota:
  password: "1234567890"
  
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

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

captive_portal:

mqtt:
  broker: 111.111.111.111
  port: 1883
  username: mqttuser
  password: mqttpass
#  discovery_prefix: homeassistant

i2c:
    sda: GPIO23 #D4 23
    scl: GPIO22 #D5 22
    scan: True

sensor:
  - platform: ezo
    name: "Pool Monitor pH"
    id: ph_ezo
    address: 99
    unit_of_measurement: "pH"
    update_interval: 30s
    accuracy_decimals: 2
    on_value:
      - mqtt.publish:
          topic: "poolmonitor/ph"
          payload: !lambda |-
            return to_string(id(ph_ezo).state);

  - platform: ezo
    id: orp_ezo
    name: "Pool Monitor ORP"
    address: 98
    unit_of_measurement: "mv"
    accuracy_decimals: 2
    update_interval: 30s
    on_value:
      - mqtt.publish:
          topic: "poolmonitor/orp"
          payload: !lambda |-
            return to_string(id(orp_ezo).state);
#            return to_string(id(orp_ezo).state);
#            states('sensor.usd_to_gbp')|float)|round(2) }

  - platform: ezo
    id: pump_acid  #Currently only reads pumped volume from the pump
    name: "Poll Monitor Pump Acid"
    address: 103
    unit_of_measurement: "ml"

  - platform: ezo
    name: "Pool Monitor Temp"
    filters:
      - lambda: return x * (9.0/5.0) + 32.0;
    id: rtd_ezo
    address: 102 # aka 0x66, see page 5 on https://atlas-scientific.com/files/Wi-Fi-Pool-kit-setup-guide.pdf
    accuracy_decimals: 2
    unit_of_measurement: "°F"
    update_interval: 30s
    on_value:
      - mqtt.publish:
          topic: "poolmonitor/temp"
          payload: !lambda |-
            return to_string(id(rtd_ezo).state);

  - platform: ezo
    id: pump_cl  #Currently only reads pumped volume from the pump
    name: Pool Monitor Pump Cl
    address: 104
    unit_of_measurement: "ml"

switch:
  - platform: gpio
    pin: 12 #14
    name: "pH On"
    inverted: yes  #Makes the ON status turn the pin LOW
    internal: true  #Hides the switch from Home Assistant so as not to clutter the interface
    restore_mode: ALWAYS_ON  #Sets the switch status ON at boot
    
  - platform: gpio
    pin: 15
    name: "Temp On"
    inverted: no  #This pin needs to be HIGH, so not inverted
    internal: true #Hides the switch from Home Assistant so as not to clutter the interface
    restore_mode: ALWAYS_ON  #Sets the switch status ON at boot
    
  - platform: gpio
    pin: 27 #12
    name: "ORP On"
    inverted: yes   #Makes the ON status turn the pin LOW
    internal: true #Hides the switch from Home Assistant so as not to clutter the interface
    restore_mode: ALWAYS_ON  #Sets the switch status ON at boot

  - platform: gpio
    pin: 33 #13
    name: "AUX On"
    inverted: yes   #Makes the ON status turn the pin LOW
    internal: true #Hides the switch from Home Assistant so as not to clutter the interface
    restore_mode: ALWAYS_ON  #Sets the switch status ON at boot
    
2 Likes

According to this Overview | Adafruit HUZZAH32 - ESP32 Feather | Adafruit Learning System the huzzah32 sda/scl pins are 22 & 23. Not 21 & 22 as you have it.

2 Likes

Hi, can you provide some feedback? Did it work with localtuya? Can you maybe post the config?

HI, i must wait for the Device to deliver :slight_smile:

1 Like

IT WORKED! Thank you! Thank you! Thank you!!!

This forum is the best!

2 Likes

@HG901 let us know how it works and dashboard. I might go for it

So far it is working, and all three sensors (pH, ORP, and temp) show up in home assistant so I added them to the dashboard as a gauge. I haven’t figured out yet how to calibrate the sensors, but it homeassistant showed my pH as being high and my chlorine (ORP) being low, and a test strip confirmed it so at least it’s not too far off. ORP is reported in mV, and converting to PPM seems difficult. My immediate goals will be to figure out how to calibrate and use some of the statistics functions to give me trending numbers that I can use in my next automations (i.e. turn on my chlorine generator and pH reducer).

1 Like

@HG901 you should have gotten calibration solutions with your kit. There are ways to calibrate (again, with the solutions) via esphome but I reflashed the original firmware from atlas, did the calibrate and then reflashed again w my esphome config. Ultimately I just bought a second huzzah esp and keep one with the original firmware and one with esphome.

yes, I have the calibration solutions. I did update my yaml to include the lamda buttons I found here for easy calibration. I also used their code to change my temperature readings to Fahrenheit which is nice.

So you’re good to go then? Sounded like you were having problems still.

I think I am good!

Did you calibrate ORP probe as well?

Yes the calibration “kit” has 4 pouches, 3 for the ph calibration and one of the orp.