Hello everyone
i have a digital PH sensor which measures PH, Temperature, Resistance, ORP. i want to communicate to over modbus-RTU with a esp8266 but i cant understand the manual. could you please help me to how send registery to sensor for each parameter?
Some manuals give examples of the command message and the expected response message. This can be useful if you are handling the raw comms yourself.
There are Modbus libraries for various Arduino boards. There's one called ModbusMaster which may work with an ESP8266 but I've no experience with Modbus on an ESP8266 so can't guide you much.
The image you provided shows that the sensor has a default address of 1 and a baudrate of 9600 baud.
Your sensor understands function code 3 (ReadHoldingRegisters) and function code 6 (WriteSingleRegister).
The ModbusMaster library I mentioned comes with some examples to get the user started.
I would suggest trying to read register 0 or register 3 as these would hold values that you are likely to know beforehand.
01 = the device address
03 = is the function code
00 }
03 } = these 2 bytes are the register address
00 }
01 } = these 2 bytes are the number of registers to read
07 }
0A } = these 2 bytes are the CRC-16 checksum of the message (low byte first)
I use the CRCCalc website to calcuate the checksums.
You need to select hex as the input - like you have.
Add the values as:
01 03 00 02 00 01
So no 0x or commas, but spaces between each of the values Then click the CRC16 button. Scroll down the list to find the CRC-16/MODBUS line and look at the value in the Result column.
That's your CRC16 checksum you need for your message. It goes in the message low byte first.