Try using command_throttle in the modbus_controller section to give time to the device to answer.
Also try force_new_range on the sensor def to force separate queries via modbus
here is the new data back. i commented some out and will add more in
[09:19:41][D][sensor:127]: 'soil_meter_ec': Sending state 206.00000 us/cm with 0 decimals of accuracy
[09:19:41][D][uart_debug:158]: <<< "\x01\x04\x02\x00\xCE8\xA4"
[09:19:41][D][uart_debug:158]: >>> "\x01\x04\x00\x04\x00\x01p\v"
[09:19:41][D][modbus_controller.sensor:025]: Sensor new state: 103.00
[09:19:41][D][sensor:127]: 'soil_meter_tds': Sending state 103.00000 mg/L with 0 decimals of accuracy
[09:19:42][D][uart_debug:158]: <<< "\x01\x04\x02\x00g\xF8\xDA"
[09:19:44][D][uart_debug:158]: >>> "\x01\x04\x00\x00\x00\x011\xCA"
[09:19:44][D][modbus_controller.sensor:025]: Sensor new state: 2153.00
[09:19:44][D][sensor:127]: 'soil_meter_temp': Sending state 21.53000 °C with 0 decimals of accuracy
[09:19:44][D][uart_debug:158]: <<< "\x01\x04\x02\bi~\xDE"
[09:19:44][D][uart_debug:158]: >>> "\x01\x04\x00\x01\x00\x01`\n"
[09:19:44][D][modbus_controller.sensor:025]: Sensor new state: 3490.00
[09:19:44][D][sensor:127]: 'soil_meter_moisture': Sending state 3490.00000 VWC with 0 decimals of accuracy
[09:19:44][D][uart_debug:158]: <<< "\x01\x04\x02\r\xA2<\x19"
[09:19:44][D][uart_debug:158]: >>> "\x01\x04\x00\x02\x00\x01\x90\n"
[09:19:44][D][modbus_controller.sensor:025]: Sensor new state: 206.00
[09:19:44][D][sensor:127]: 'soil_meter_ec': Sending state 206.00000 us/cm with 0 decimals of accuracy
[09:19:44][D][uart_debug:158]: <<< "\x01\x04\x02\x00\xCE8\xA4"
[09:19:44][D][uart_debug:158]: >>> "\x01\x04\x00\x04\x00\x01p\v"
[09:19:44][D][modbus_controller.sensor:025]: Sensor new state: 103.00
[09:19:44][D][sensor:127]: 'soil_meter_tds': Sending state 103.00000 mg/L with 0 decimals of accuracy
[09:19:44][D][uart_debug:158]: <<< "\x01\x04\x02\x00g\xF8\xDA"
[09:19:45][D][uart_debug:158]: >>> "\x01\x04\x00\x00\x00\x011\xCA"
[09:19:45][D][modbus_controller.sensor:025]: Sensor new state: 2150.00
[09:19:45][D][sensor:127]: 'soil_meter_temp': Sending state 21.50000 °C with 0 decimals of accuracy
[09:19:45][D][uart_debug:158]: <<< "\x01\x04\x02\bf>\xDA"
Now i need to understand how to change the Soil type register. to change the type of soil ONLY bc i want to confirm that my VWC really is
[09:19:44][D][sensor:127]: 'soil_meter_moisture': Sending state 3490.00000 VWC with 0 decimals of accuracy
bc its 100% soaked in water with Rockwool type soil (it should be considered mineral which is default. but shouldnt it read 100000 = 100%? I am still learning how to read the following to calculate its correct.
cant see how ex: from data that came back on a 100% saturated soil media,
VWC is reading 3407, * 256 + 2 / 100? 872192.02 ?? lol i must still be doing something wrong
Ok, I may be jumping to an answer here but I would:
Check if a bigger command_throttle: helps. I have mine at 50ms with an SDM230M power meter
Regarding your VWC, reading the PDF you sent I believe 3490 stands for 34.90% VWC. You say it should be 100% but I believe that´s what is reading. You mentioned something about soil type? This sensor seems to have a few config registers that may need to be configured for your specific use.
The unit_of_measurement: config DOES NOT convert units (as you know because of the config you use to change to Faranheit), so you need to do some math to get this value (simple from what I can see on the PDF), just divide by 100 and set units to %
Rest of the values sound right to you? Check on the PDF that your sensor can use one of two modes defined by the MEASUREMETHOD register, and default is to only measure when requested. Perhaps set this to continuous reading to give internal values time to stabilize?
Try using different pins for UART, either hardware UART or software UART. I had to go with software UART because of issues with logging on UART0 on my ESP8266 (set logging to 0 baud rate but didn´t work either).
Can´t figure out your debug values, but addresses seem to be right according to your PDF section 7.4.2, query and answer from address 0x01, function code 0x04 (read).
Just got back to this, i will try the throttle command setting (forgot to test different settings). and report back
Not sure what you meant regarding software / hardware uart but i will google that. im pretty sure i am using software bc the same i had to set logging to 0 due to error when i start with this.
Nothing has changed yet on my end but when i plugged it in and made sure the media was 100% wet and got the following
[14:49:41][D][modbus_controller.sensor:025]: Sensor new state: 5950.00
[14:49:41][D][sensor:127]: 'soil_meter_moisture': Sending state 5950.00000 VWC with 0 decimals of accuracy
[14:49:42][D][uart_debug:158]: <<< "\x01\x04\x04\x17>\x01\x05^o"
[14:49:44][D][modbus_controller.sensor:025]: Sensor new state: 5950.00
So not sure how all of a sudden its 59%?
So judging by some settings I might have to change - MEASUREMETHOD and Soil Type, how would i go about doing that?
OH! forgot to mention so from doing research on this ESP32 Wrover-E , it only have 1 UART tx/rx pins. so i tested another ESP32 and that one has 3. 0/1/2 and I was able to configure - same result as before which was around the 39% reading previously
So bc i switched back and fourth from some boards, i went back to the orig ESP32-WROvER board i was using and i have the MAX485 and the sensor on 3.3V vs 5v. on 3.3 i get 5665 vwc reading and 5v i get 4200 or so - specifically putting sensor VCC on 3.3 vs 5v makes a difference
3.3V is not a valid power voltage for your sensor according to the PDF you linked, so I wouldn´t trust values measured with that input voltage.
Also, if you are using 3.3V on your ESP board (I believe most of them are 3.3V, if not all of them) and 5V on your sensor, try using a TTL logic level converter (I would use it between your ESP and your MAX485 board) so communication to/from the sensor uses 5V differential and communication between ESP and MAX485 board uses 3.3V. I had to use one on my deployment:
I set logger level to VERBOSE and see way more data as well. can confirm incoming data is good, just cant seem to get the switch or number blocks to change the register from 0 → 1 for temp C->F or the MediaType. i tried offset to see if writer_single_register would go through but all i see if 04 not 06
[17:52:00][C][modbus_controller:275]: ModbusController:
[17:52:00][C][modbus_controller:276]: Address: 0x01
[17:52:00][C][modbus_controller:278]: sensormap
[17:52:00][C][modbus_controller:282]: Sensor type=4 start=0x21 offset=0x2 count=1 size=2
[17:52:00][C][modbus_controller:284]: ranges
[17:52:00][C][modbus_controller:287]: Range type=4 start=0x21 count=1 skip_updates=0
[17:52:04][V][modbus_controller:158]: Updating modbus component
[17:52:04][V][modbus_controller:125]: Range : 21 Size: 1 (4) skip: 0
[17:52:04][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x21 count 1
[17:52:04][V][modbus:199]: Modbus write: 01.04.00.21.00.01.61.C0 (8)
[17:52:04][V][modbus_controller:486]: Command sent 4 0x21 1
[17:52:04][D][uart_debug:158]: >>> "\x01\x04\x00!\x00\x01a\xC0"
[17:52:04][V][modbus:042]: Modbus received Byte 1 (0X1)
[17:52:04][V][modbus:042]: Modbus received Byte 4 (0X4)
[17:52:04][V][modbus:042]: Modbus received Byte 2 (0X2)
[17:52:04][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:04][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:04][V][modbus:042]: Modbus received Byte 185 (0Xb9)
[17:52:04][V][modbus:042]: Modbus received Byte 48 (0X30)
[17:52:04][V][modbus_controller:055]: Modbus response queued
[17:52:04][V][component:200]: Component modbus took a long time for an operation (0.06 s).
[17:52:04][V][component:201]: Components should block for at most 20-30ms.
[17:52:04][V][modbus_controller:063]: Process modbus response for address 0x21 size: 2
[17:52:04][V][modbus_controller:098]: data for register address : 0x21 :
[17:52:04][V][modbus_controller.switch:047]: Publish 'Temp C or F': new value = OFF type = 4 address = 21 offset = 2
[17:52:04][D][uart_debug:158]: <<< "\x01\x04\x02\x00\x00\xB90"
[17:52:09][V][modbus_controller:158]: Updating modbus component
[17:52:09][V][modbus_controller:125]: Range : 21 Size: 1 (4) skip: 0
[17:52:09][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x21 count 1
[17:52:09][V][modbus:199]: Modbus write: 01.04.00.21.00.01.61.C0 (8)
[17:52:09][V][modbus_controller:486]: Command sent 4 0x21 1
[17:52:09][D][uart_debug:158]: >>> "\x01\x04\x00!\x00\x01a\xC0"
[17:52:09][V][modbus:042]: Modbus received Byte 1 (0X1)
[17:52:09][V][modbus:042]: Modbus received Byte 4 (0X4)
[17:52:09][V][modbus:042]: Modbus received Byte 2 (0X2)
[17:52:09][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:09][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:09][V][modbus:042]: Modbus received Byte 185 (0Xb9)
[17:52:09][V][modbus:042]: Modbus received Byte 48 (0X30)
[17:52:09][V][modbus_controller:055]: Modbus response queued
[17:52:09][V][component:200]: Component modbus took a long time for an operation (0.06 s).
[17:52:09][V][component:201]: Components should block for at most 20-30ms.
[17:52:10][V][modbus_controller:063]: Process modbus response for address 0x21 size: 2
[17:52:14][V][modbus_controller:158]: Updating modbus component
[17:52:14][V][modbus_controller:125]: Range : 21 Size: 1 (4) skip: 0
[17:52:14][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x21 count 1
[17:52:14][V][modbus:199]: Modbus write: 01.04.00.21.00.01.61.C0 (8)
[17:52:14][V][modbus_controller:486]: Command sent 4 0x21 1
[17:52:14][D][uart_debug:158]: >>> "\x01\x04\x00!\x00\x01a\xC0"
[17:52:14][V][modbus:042]: Modbus received Byte 1 (0X1)
[17:52:14][V][modbus:042]: Modbus received Byte 4 (0X4)
[17:52:14][V][modbus:042]: Modbus received Byte 2 (0X2)
[17:52:14][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:14][V][modbus:042]: Modbus received Byte 0 (0X0)
[17:52:14][V][modbus:042]: Modbus received Byte 185 (0Xb9)
[17:52:14][V][modbus:042]: Modbus received Byte 48 (0X30)
[17:52:14][V][modbus_controller:055]: Modbus response queued
[17:52:14][V][component:200]: Component modbus took a long time for an operation (0.05 s).
[17:52:14][V][component:201]: Components should block for at most 20-30ms.
[17:52:14][V][modbus_controller:063]: Process modbus response for address 0x21 size: 2
[17:52:14][V][modbus_controller:098]: data for register address : 0x21 :
[17:52:14][V][modbus_controller.switch:047]: Publish 'Temp C or F': new value = OFF type = 4 address = 21 offset = 2
[17:52:14][D][uart_debug:158]: <<< "\x01\x04\x02\x00\x00\xB90"
It should be OK.
Just to be clear:
ESP <— 3.3V —> TTL Level converter <— 5V —> MAX485 <— 5V differential —> Sensor
TTL Level converter needs to be powered by both 3.3V and 5V (check the datasheet for the converter you purchased)
MAX 485 and Sensor powered by 5V
ESP uses 3.3V (internally, you may be feeding it 5V and it converts it to 3.3V)
Also confirmed with a new Logic Analyzer i got and the data coming from the sensor before hitting the MAX485 board is correct. I am trying some new settings to change the soil type, no success yet
I was able to successfully write to the register and change temp C to F.
I also changed soil type BUT even changing that did not change the reading on all except for Organic. Which at fill 100% saturated with water - it only read 6932 which technically is 65%.
I will continue to try and get this at 100% but im also worried that my 5V is really 4.15V - is that normal? my 3.3V reads 3.3v on the Vmeter.
It should be 5V or a little higher with no load connected, perhaps your power supply does not have enough output Amps hence the voltage drops to 4.15V when you try to pull too many Amps.
Try a different power supply for the 5V rail, one with higher output amps/power.
Yeah with no load i get 4.3 on all the USB connected esp32’s that i have. Wonder why its so low? Even when i connect it via USB and an outlet charger that pushes out 5v 1a it still reads 4.3v. am i doing something incorrect? When u say diff PS for the 5V rail, can you give me some details?
Are you measuring the power supply directly or the 5V output pin on the ESP board?
I mean a different power supply for the parts of your deployment that need 5V. One with higher output power (or higher output current which is basically saying the same thing).