luisn
(luis n)
March 2, 2023, 8:09pm
1
Ive been at this for over a week with no way of getting data back. I have this little RS485 modbus
and using a ESP32-WROVER board with the following below. maybe i dont have the right register or doc for it? the manufacturer did not send any details so i had to googles it. hopefully its the right one
uart:
id: mod_bus
tx_pin: GPIO01
rx_pin: GPIO03
baud_rate: 9600
stop_bits: 1
modbus:
id: modbus1
flow_control_pin: 4
modbus_controller:
- id: reader1
address: 0x01
modbus_id: modbus1
setup_priority: -10
update_interval: 3s
sensor:
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter"
# id: flow
register_type: holding
address: 0x01
# register_count: 1
# response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "VWC"
trying to read from this device
[15:06:54][C][logger:293]: Logger:
[15:06:54][C][logger:294]: Level: DEBUG
[15:06:54][C][logger:295]: Log Baud Rate: 0
[15:06:54][C][logger:296]: Hardware UART: UART0
[15:06:54][C][uart.arduino_esp32:108]: UART Bus 0:
[15:06:54][C][uart.arduino_esp32:109]: TX Pin: GPIO1
[15:06:54][C][uart.arduino_esp32:110]: RX Pin: GPIO3
[15:06:54][C][uart.arduino_esp32:112]: RX Buffer Size: 256
[15:06:54][C][uart.arduino_esp32:114]: Baud Rate: 9600 baud
[15:06:54][C][uart.arduino_esp32:115]: Data Bits: 8
[15:06:54][C][uart.arduino_esp32:116]: Parity: NONE
[15:06:54][C][uart.arduino_esp32:117]: Stop bits: 1
[15:06:54][C][modbus:143]: Modbus:
[15:06:54][C][modbus:144]: Flow Control Pin: GPIO4
[15:06:54][C][modbus:145]: Send Wait Time: 250 ms
[15:06:54][C][modbus:146]: CRC Disabled: NO
[15:06:54][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'soil_meter'
[15:06:54][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[15:06:54][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'VWC'
[15:06:54][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[15:06:54][C][captive_portal:088]: Captive Portal:
[15:06:54][C][mdns:108]: mDNS:
[15:06:54][C][mdns:109]: Hostname: monitor01
[15:06:54][C][ota:093]: Over-The-Air Updates:
[15:06:54][C][ota:094]: Address: monitor01.local:3232
[15:06:54][C][ota:097]: Using Password.
[15:06:54][C][api:138]: API Server:
[15:06:54][C][api:139]: Address: monitor01.local:6053
[15:06:54][C][api:141]: Using noise encryption: YES
[15:06:54][C][modbus_controller:275]: ModbusController:
[15:06:54][C][modbus_controller:276]: Address: 0x01
[15:06:56][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:06:59][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:07:03][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:07:05][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
Dujith
(Charles Evers)
March 2, 2023, 8:15pm
2
I’m not seeing register 0x01
in that list? Isnt it supposed to be 0x0001
And is the device at address 0x01
on the bus? Should be a dipswitch for that.
luisn
(luis n)
March 2, 2023, 8:24pm
3
I tried 1, 0x0001 and nothing. i will output the details in a sec. HA is updating atm
Dujith
(Charles Evers)
March 2, 2023, 8:32pm
4
Looked at the device image and it says its slave address is 0x0200
?
luisn
(luis n)
March 2, 2023, 8:45pm
5
Sorry, not sure what slave means ( still learning this)
I changed sensor address back to 0x0001
but same output
[15:42:54][C][logger:293]: Logger:
[15:42:54][C][logger:294]: Level: DEBUG
[15:42:54][C][logger:295]: Log Baud Rate: 0
[15:42:54][C][logger:296]: Hardware UART: UART0
[15:42:54][C][uart.arduino_esp32:108]: UART Bus 0:
[15:42:54][C][uart.arduino_esp32:109]: TX Pin: GPIO1
[15:42:54][C][uart.arduino_esp32:110]: RX Pin: GPIO3
[15:42:54][C][uart.arduino_esp32:112]: RX Buffer Size: 256
[15:42:54][C][uart.arduino_esp32:114]: Baud Rate: 9600 baud
[15:42:54][C][uart.arduino_esp32:115]: Data Bits: 8
[15:42:54][C][uart.arduino_esp32:116]: Parity: NONE
[15:42:54][C][uart.arduino_esp32:117]: Stop bits: 1
[15:42:55][C][modbus:143]: Modbus:
[15:42:55][C][modbus:144]: Flow Control Pin: GPIO4
[15:42:55][C][modbus:145]: Send Wait Time: 250 ms
[15:42:55][C][modbus:146]: CRC Disabled: NO
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'soil_meter'
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'VWC'
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[15:42:55][C][captive_portal:088]: Captive Portal:
[15:42:55][C][mdns:108]: mDNS:
[15:42:55][C][mdns:109]: Hostname: monitor01
[15:42:55][C][ota:093]: Over-The-Air Updates:
[15:42:55][C][ota:094]: Address: monitor01.local:3232
[15:42:55][C][ota:097]: Using Password.
[15:42:55][C][api:138]: API Server:
[15:42:55][C][api:139]: Address: monitor01.local:6053
[15:42:55][C][api:141]: Using noise encryption: YES
[15:42:55][C][modbus_controller:275]: ModbusController:
[15:42:55][C][modbus_controller:276]: Address: 0x01
[15:42:56][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:42:57][D][api:102]: Accepted ::FFFF:192.168.1.55
[15:42:57][D][api:102]: Accepted ::FFFF:192.168.1.55
[15:42:58][D][api.connection:918]: Home Assistant 2023.3.0 (::FFFF:192.168.1.55): Connected successfully
[15:42:58][D][api.connection:918]: Home Assistant 2023.3.0 (::FFFF:192.168.1.55): Connected successfully
[15:42:59][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:02][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:06][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:08][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:11][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
Dujith
(Charles Evers)
March 2, 2023, 9:00pm
7
Still trying to talk to register 0x01
instead of 0x0001
luisn
(luis n)
March 2, 2023, 9:02pm
8
yes thats what i kept noticing, not sure how to fix that
Dujith
(Charles Evers)
March 2, 2023, 9:02pm
9
Some devices have those. Yours might not.
Dujith
(Charles Evers)
March 2, 2023, 9:04pm
10
Did you change that or the device address?
luisn
(luis n)
March 2, 2023, 9:06pm
11
found the pdf online
i downloaded it awhile back and couldnt find it
luisn
(luis n)
March 2, 2023, 9:09pm
12
yea
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter"
# id: flow
register_type: holding
address: 0x0001
# register_count: 1
# response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "VWC"
Dujith
(Charles Evers)
March 2, 2023, 9:22pm
13
So, taking back a few steps, lets look at the hardware.
Is everything connected correctly? A connected to A? ect?
luisn
(luis n)
March 2, 2023, 9:30pm
14
From sensor:
Yellow to A and White to B, then Red to + Black to - (Not connected to the MAX485 but directly to ESP32 5V and GND)
Green says its “SET” but can be added to + as well so i tried both connected and disconnected from +.
DE+RE on the modbus controller and RE-> GPIO4 (flow control pin), on ESP32
DI modbus to → GPIO01 TX ESP32
RO modbus to → GPIO03 RX ESP32
To TEST i added 5V + GND to the MAX485 board and i see RX lite Yellow and TX random green on the ESP32 board.
But reseting board still no data back from device
luisn
(luis n)
March 2, 2023, 9:43pm
15
i used this to guide me for wiring
luisn
(luis n)
March 2, 2023, 10:49pm
16
I just dont understand why when i change the address HEX to 0x0001 its not taking it. even when i add a diff address of ex: 0x0007 it shows it as 0x07 in the logs. i tried to do a debug but the about is gibberish to me.
luisn
(luis n)
March 3, 2023, 2:54pm
17
Progress! i think i just needed to step away.
[09:52:45][D][modbus_controller.sensor:025]: Sensor new state: 4945.00
[09:52:45][D][sensor:127]: 'soil_meter_moisture': Sending state 49.45000 VWC with 0 decimals of accuracy
[09:52:45][D][uart_debug:158]: <<< "\x01\x04\x02\x13Qu\xFC"
[09:52:47][D][modbus_controller.sensor:025]: Sensor new state: 4945.00
[09:52:47][D][sensor:127]: 'soil_meter_moisture': Sending state 49.45000 VWC with 0 decimals of accuracy
but now i have to figure out what i need to do with the incoming data bc its suppose to be from 0-10000
Data Range 0-10000 For 0-100% Default: N/A
But i am not sure what filter or lambda i need to fill out to get there. right now i have the sensor 100% submerged into water and it SHOULD read 10000 no?
luisn
(luis n)
March 3, 2023, 3:00pm
18
The change i made to make it work was the
update_interval: 2s
on the controller
Dujith
(Charles Evers)
March 4, 2023, 3:58pm
20
Isnt that dependant on the Soiltype?