I am at my first project with ESP8266 ESP-01S and esphome. To my understanding I set up everything right, checked all the wiring with a voltmeter but I can’t get the ESP to find the I2C current sensor.
- The LED symbolizes a water level sensor which has an output range of 4 to 20 mA.
- The switch is for reset. The ESP8266 ESP-01S and the INA219 (it’s datasheet) should talk over I2C.
- The INA219 seems to have pull up resistors, as I have around 3.3V on the SCL and SDA pins.
- The batteries symbolize a 24V DC supply which is needed is input by the sensor.
- The step down buck converter is adjusted to deliver 3.3V for the ESP8266 and the INA219.
Fritzing:
Corresponding wiring:
My esphome configuration:
esphome:
name: sensor-well-water-level
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "..."
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 10.116.0.120
gateway: 10.116.0.1
subnet: 255.255.255.0
dns1: 10.116.0.25
dns2: 10.116.0.26
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sensor-Well-Water-Level"
password: "..."
captive_portal:
i2c:
scl: 5 # GPIO - 0
sda: 3 # GPIO - 2
scan: true
frequency: 50kHz
sensor:
- platform: ina219
address: 0x40
shunt_resistance: 0.1 ohm
current:
name: "INA219 Current - Well Level Sensor"
power:
name: "INA219 Power - Well Level Sensor"
bus_voltage:
name: "INA219 Bus Voltage - Well Level Sensor"
shunt_voltage:
name: "INA219 Shunt Voltage - Well Level Sensor"
max_voltage: 32.0V
max_current: 3.2A
update_interval: 60s
The log:
INFO Reading configuration /config/esphome/sensor-well-water-level.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing sensor-well-water-level (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
| |-- <ESPAsyncTCP-esphome> 1.2.3
| |-- <Hash> 1.0
| |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <Wire> 1.0
RAM: [==== ] 44.9% (used 36820 bytes from 81920 bytes)
Flash: [==== ] 42.2% (used 431833 bytes from 1023984 bytes)
========================= [SUCCESS] Took 6.23 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 10.116.0.120
INFO Uploading /data/sensor-well-water-level/.pioenvs/sensor-well-water-level/firmware.bin (435984 bytes)
INFO Compressed to 301329 bytes
Uploading: [============================================================] 100% Done...
INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 10.116.0.120 using esphome API
WARNING Can't connect to ESPHome API for 10.116.0.120: Timeout while connecting to ('10.116.0.120', 6053)
INFO Trying to reconnect to 10.116.0.120 in the background
INFO Successfully connected to 10.116.0.120
[09:59:34][I][app:102]: ESPHome version 2022.4.0 compiled on Apr 24 2022, 09:28:57
[09:59:34][C][wifi:491]: WiFi:
[09:59:34][C][wifi:353]: Local MAC: 58:BF:25:DC:31:9C
[09:59:34][C][wifi:354]: SSID: [redacted]
[09:59:34][C][wifi:355]: IP Address: 10.116.0.120
[09:59:34][C][wifi:356]: BSSID: [redacted]
[09:59:34][C][wifi:358]: Hostname: 'sensor-well-water-level'
[09:59:34][C][wifi:360]: Signal strength: -66 dB ▂▄▆█
[09:59:34][V][wifi:362]: Priority: 0.0
[09:59:34][C][wifi:364]: Channel: 11
[09:59:34][C][wifi:365]: Subnet: 255.255.255.0
[09:59:34][C][wifi:366]: Gateway: 10.116.0.1
[09:59:34][C][wifi:367]: DNS1: 10.116.0.25
[09:59:34][C][wifi:368]: DNS2: 10.116.0.26
[09:59:34][C][logger:233]: Logger:
[09:59:34][C][logger:234]: Level: VERY_VERBOSE
[09:59:34][C][logger:235]: Log Baud Rate: 115200
[09:59:34][C][logger:236]: Hardware UART: UART0
[09:59:34][C][i2c.arduino:038]: I2C Bus:
[09:59:34][C][i2c.arduino:039]: SDA Pin: GPIO3
[09:59:34][C][i2c.arduino:040]: SCL Pin: GPIO5
[09:59:34][C][i2c.arduino:041]: Frequency: 50000 Hz
[09:59:34][C][i2c.arduino:044]: Recovery: bus successfully recovered
[09:59:34][I][i2c.arduino:054]: Results from i2c bus scan:
[09:59:34][I][i2c.arduino:056]: Found no i2c devices!
[09:59:34][C][ina219:133]: INA219:
[09:59:34][C][ina219:134]: Address: 0x40
[09:59:34][E][ina219:137]: Communication with INA219 failed!
[09:59:34][C][captive_portal:088]: Captive Portal:
[09:59:34][C][mdns:084]: mDNS:
[09:59:34][C][mdns:085]: Hostname: sensor-well-water-level
[09:59:34][V][mdns:086]: Services:
[09:59:34][V][mdns:088]: - _esphomelib, _tcp, 6053
[09:59:34][V][mdns:090]: TXT: version = 2022.4.0
[09:59:34][V][mdns:090]: TXT: mac = 58bf25dc319c
[09:59:34][V][mdns:090]: TXT: platform = ESP8266
[09:59:34][V][mdns:090]: TXT: board = esp01_1m
[09:59:34][C][ota:085]: Over-The-Air Updates:
[09:59:34][C][ota:086]: Address: 10.116.0.120:8266
[09:59:34][C][ota:089]: Using Password.
[09:59:34][C][api:138]: API Server:
[09:59:34][C][api:139]: Address: 10.116.0.120:6053
[09:59:34][C][api:143]: Using noise encryption: NO
[09:59:45][VV][api.service:355]: on_ping_request: PingRequest {}
[09:59:45][VV][api.service:043]: send_ping_response: PingResponse {}
[09:59:49][VV][api.service:355]: on_ping_request: PingRequest {}
[09:59:49][VV][api.service:043]: send_ping_response: PingResponse {}
[10:00:00][VV][api.service:355]: on_ping_request: PingRequest {}
[10:00:00][VV][api.service:043]: send_ping_response: PingResponse {}
I have tried to use different pins, different frequencies.I also tried another INA219 and a different ESP8266 ESP-01S.
I am really running out of ideas what to try else…
Has anybody a suggestion?
Edit:
- fixed not up to date i2c pin config
- replaced the fritzing with the current one. SCL & SDA changed.
- logger to very_verbose
hoped to see some more information, how the i2c scanning works. but nope.