I have seen that it’s possible to use an UART RX/TX pair to communicate with 1-wire devices using a combination of 9600 and 115200. Considering the current Dallas component in ESPHome, would it be beneficial to instead use UART0 for this. I guess the question could also be if eg ESP8266 is on its edge for handling the 1-wire protocol
What’s wrong with it?
I have seven DS18B20 sensors on the one bus and it has been faultless for 18 months.
On it’s edge? I’d say hardly… An old ancient 8-bit avr MCU (mega8 on 10MHz) quite easily communicates with 8 dallas sensors for quite a number of years now at my friend’s house; and it drives (monocolor) graphic lcd at the same time. Since 8266 is way newer, faster…
I don’t know if there’s anything wrong with it.
I have seen some forum noise at some esphome upgrades and for me that indicates potential issues.
From my own experiences I have had some stochastic issues in my 17 sensors setup but I know it could be due to lack of wiring strategy, bad connections, and cheep sensors.
Measuring the bus I have also seen that there are an approximate 0.6 second delay between the reset command sequence until the esp reads each individual device. I don’t understand the reason for this since the devices will hold the data line low while doing the temperature conversion (and now I’m guessing the the temperature conversion command is sent out in parallel right after the reset pulse).
Due to this delay, the minimum sample rate will be about 0.7 seconds and not down to what’s theoretically possible. Not a big issue, just something I noticed that maybe should be noticed in the documentation
I think that this delay is due to the fact that DS need around 0.5s to measure and convert temperature. I remember that i’ve had to insert that delay on AVR before i’ve read temperature - if not i’ve got 75 degrees. Back in those days of bascom i just programmed it this way: first i read temp, say, every second and after i’ve read it i sent reset, so it was enough time to convert for next reading.
Digging into this I discovered something that is probably very easy to fix.
For the log below I have used one hub and addressed 4 devices (test10 to test13) with the index although I have only one device connected. The result is not consistent as I get a correct response from test10 (index 0) none from test11 and test 12, but a “nan” response from test13, see log below:
[23:54:11][I][app:102]: ESPHome version 2023.9.3 compiled on Oct 15 2023, 23:45:47
[23:54:11][C][logger:357]: Logger:
[23:54:11][C][logger:358]: Level: VERY_VERBOSE
[23:54:11][C][logger:359]: Log Baud Rate: 115200
[23:54:11][C][logger:361]: Hardware UART: UART0
[23:54:12][C][dallas.sensor:075]: DallasComponent:
[23:54:12][C][dallas.sensor:076]: Pin: GPIO1
[23:54:12][C][dallas.sensor:077]: Update Interval: 60.0s
[23:54:12][D][dallas.sensor:082]: Found sensors:
[23:54:12][D][dallas.sensor:084]: 0x583c01d0751f7f28
[23:54:12][C][dallas.sensor:089]: Device 'test10'
[23:54:12][C][dallas.sensor:089]: Device Class: 'temperature'
[23:54:12][C][dallas.sensor:089]: State Class: 'measurement'
[23:54:12][C][dallas.sensor:089]: Unit of Measurement: '°C'
[23:54:12][C][dallas.sensor:089]: Accuracy Decimals: 1
[23:54:12][V][dallas.sensor:089]: Unique ID: 'dallas-583c01d0751f7f28'
[23:54:12][C][dallas.sensor:091]: Index 0
[23:54:12][C][dallas.sensor:097]: Address: 0x583c01d0751f7f28
[23:54:12][C][dallas.sensor:098]: Resolution: 12
[23:54:12][C][dallas.sensor:089]: Device 'test11'
[23:54:12][C][dallas.sensor:089]: Device Class: 'temperature'
[23:54:12][C][dallas.sensor:089]: State Class: 'measurement'
[23:54:12][C][dallas.sensor:089]: Unit of Measurement: '°C'
[23:54:12][C][dallas.sensor:089]: Accuracy Decimals: 1
[23:54:12][V][dallas.sensor:089]: Unique ID: 'dallas-0000000000000000'
[23:54:12][C][dallas.sensor:091]: Index 1
[23:54:12][E][dallas.sensor:093]: Couldn't find sensor by index - not connected. Proceeding without it.
[23:54:12][C][dallas.sensor:089]: Device 'test12'
[23:54:12][C][dallas.sensor:089]: Device Class: 'temperature'
[23:54:12][C][dallas.sensor:089]: State Class: 'measurement'
[23:54:12][C][dallas.sensor:089]: Unit of Measurement: '°C'
[23:54:12][C][dallas.sensor:089]: Accuracy Decimals: 1
[23:54:12][V][dallas.sensor:089]: Unique ID: 'dallas-0000000000000000'
[23:54:12][C][dallas.sensor:091]: Index 2
[23:54:12][E][dallas.sensor:093]: Couldn't find sensor by index - not connected. Proceeding without it.
[23:54:12][C][dallas.sensor:089]: Device 'test13'
[23:54:12][C][dallas.sensor:089]: Device Class: 'temperature'
[23:54:12][C][dallas.sensor:089]: State Class: 'measurement'
[23:54:12][C][dallas.sensor:089]: Unit of Measurement: '°C'
[23:54:12][C][dallas.sensor:089]: Accuracy Decimals: 1
[23:54:12][V][dallas.sensor:089]: Unique ID: 'dallas-0000000000000000'
[23:54:12][C][dallas.sensor:091]: Index 3
[23:54:12][E][dallas.sensor:093]: Couldn't find sensor by index - not connected. Proceeding without it.
[23:54:12][VV][api.service:540]: on_ping_request: PingRequest {}
[23:54:12][VV][api.service:043]: send_ping_response: PingResponse {}
[23:54:12][C][captive_portal:088]: Captive Portal:
[23:54:12][C][mdns:115]: mDNS:
[23:54:12][C][mdns:116]: Hostname: tt
[23:54:12][V][mdns:117]: Services:
[23:54:12][V][mdns:119]: - _esphomelib, _tcp, 6053
[23:54:12][V][mdns:121]: TXT: version = 2023.9.3
[23:54:12][V][mdns:121]: TXT: mac = 4cebd6afe953
[23:54:12][V][mdns:121]: TXT: platform = ESP8266
[23:54:12][V][mdns:121]: TXT: board = esp8285
[23:54:12][V][mdns:121]: TXT: network = wifi
[23:54:12][V][mdns:121]: TXT: api_encryption = Noise_NNpsk0_25519_ChaChaPoly_SHA256
[23:54:12][C][ota:097]: Over-The-Air Updates:
[23:54:12][C][ota:098]: Address: tt.local:8266
[23:54:12][C][ota:101]: Using Password.
[23:54:12][C][api:138]: API Server:
[23:54:12][C][api:139]: Address: tt.local:6053
[23:54:12][C][api:141]: Using noise encryption: YES
[23:54:31][VV][scheduler:225]: Running interval 'update' with interval=60000 last_execution=338272 (now=398280)
[23:54:31][VV][scheduler:032]: set_timeout(name='0x583c01d0751f7f28', timeout=750)
[23:54:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:54:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:54:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:54:31][VV][api.service:540]: on_ping_request: PingRequest {}
[23:54:31][VV][api.service:043]: send_ping_response: PingResponse {}
[23:54:32][VV][scheduler:225]: Running timeout '0x583c01d0751f7f28' with interval=750 last_execution=398286 (now=399036)
[23:54:32][VV][dallas.sensor:255]: Scratch pad: 23.01.55.05.7F.A5.81.66.E5 (E5)
[23:54:32][D][dallas.sensor:143]: 'test10': Got Temperature=18.2°C
[23:54:32][V][sensor:043]: 'test10': Received new state 18.187500
[23:54:32][D][sensor:093]: 'test10': Sending state 18.18750 °C with 1 decimals of accuracy
[23:54:32][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 143668926
state: 18.1875
missing_state: NO
}
[23:54:32][VV][scheduler:225]: Running timeout '0x0000000000000000' with interval=750 last_execution=398303 (now=399091)
[23:54:32][VV][dallas.sensor:255]: Scratch pad: FF.FF.FF.FF.FF.FF.FF.FF.FF (C9)
[23:54:32][W][dallas.sensor:261]: 'test13' - Scratch pad checksum invalid!
[23:54:32][V][sensor:043]: 'test13': Received new state nan
[23:54:32][D][sensor:093]: 'test13': Sending state nan °C with 1 decimals of accuracy
[23:54:32][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 143668925
state: nan
missing_state: NO
}
[23:54:49][VV][scheduler:225]: Running interval '' with interval=60000 last_execution=355528 (now=415528)
[23:54:51][VV][api.service:540]: on_ping_request: PingRequest {}
[23:54:51][VV][api.service:043]: send_ping_response: PingResponse {}
[23:55:11][VV][api.service:540]: on_ping_request: PingRequest {}
[23:55:11][VV][api.service:043]: send_ping_response: PingResponse {}
[23:55:12][VV][api.service:540]: on_ping_request: PingRequest {}
[23:55:12][VV][api.service:043]: send_ping_response: PingResponse {}
[23:55:31][VV][scheduler:225]: Running interval 'update' with interval=60000 last_execution=398272 (now=458273)
[23:55:31][VV][scheduler:032]: set_timeout(name='0x583c01d0751f7f28', timeout=750)
[23:55:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:55:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:55:31][VV][scheduler:032]: set_timeout(name='0x0000000000000000', timeout=750)
[23:55:31][VV][api.service:540]: on_ping_request: PingRequest {}
[23:55:31][VV][api.service:043]: send_ping_response: PingResponse {}
[23:55:32][VV][scheduler:225]: Running timeout '0x583c01d0751f7f28' with interval=750 last_execution=458279 (now=459036)
[23:55:32][VV][dallas.sensor:255]: Scratch pad: 24.01.55.05.7F.A5.81.66.35 (35)
[23:55:32][D][dallas.sensor:143]: 'test10': Got Temperature=18.2°C
[23:55:32][V][sensor:043]: 'test10': Received new state 18.250000
[23:55:32][D][sensor:093]: 'test10': Sending state 18.25000 °C with 1 decimals of accuracy
[23:55:32][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 143668926
state: 18.25
missing_state: NO
}
[23:55:32][VV][scheduler:225]: Running timeout '0x0000000000000000' with interval=750 last_execution=458297 (now=459091)
[23:55:32][VV][dallas.sensor:255]: Scratch pad: FF.FF.FF.FF.FF.FF.FF.FF.FF (C9)
[23:55:32][W][dallas.sensor:261]: 'test13' - Scratch pad checksum invalid!
[23:55:32][V][sensor:043]: 'test13': Received new state nan
[23:55:32][D][sensor:093]: 'test13': Sending state nan °C with 1 decimals of accuracy
[23:55:32][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 143668925
state: nan
missing_state: NO
}
This might be seen as just a small thing but I have sometimes also seen temperature responses from the none existing device and that is not good.
Sorry I can’t contribute with code on this but it was to long since I did this kind of coding