Hello. I have an automation system with ESP32 devices. I use MQTT to communicate between each node and the server ( Raspberry PI). On our custom ESP32 PCB, we have also designed an MODBUS in case MQTT fails and we still want to transfer data between the nodes.
I have never used MODBUS before and just trying to understand it for now.
Our circuit looks like :
We use this ADM2582 chip and connect USART2 TX and RX to the pins of the IC as well as additional GPIO for direction.
We use ethernet cable (POE) which also has MODBUS pins wired to it (pin 1, 2 on J3). We daisy chain connect all the ESP32 nodes together using this cable. One cable comes in, the 2nd cable comes out.
I have come across this MODBUS RTU library for ESP32:
https://github.com/bertmelis/esp32ModbusRTU
I am reading the usage step by step and trying to understand it:
Since I am using USART2, I would need to create serial object:
and use this object :
But I cannot understand this function:
How do I know my server ID, and what address?? If I understand properly,this function is supposed to transmit some data through MODBUS right?
Just some additional question:
Can I transfer JSON format data using modbus?
I have never used MODBUS before and just trying to understand it for now.
Our circuit looks like :
We use this ADM2582 chip and connect USART2 TX and RX to the pins of the IC as well as additional GPIO for direction.
We use ethernet cable (POE) which also has MODBUS pins wired to it (pin 1, 2 on J3). We daisy chain connect all the ESP32 nodes together using this cable. One cable comes in, the 2nd cable comes out.
I have come across this MODBUS RTU library for ESP32:
https://github.com/bertmelis/esp32ModbusRTU
I am reading the usage step by step and trying to understand it:
Since I am using USART2, I would need to create serial object:
Code:
HardwareSerial modbus(2);
Code:
esp32ModbusRTU myModbus(&modbus, DE_PIN);
How do I know my server ID, and what address?? If I understand properly,this function is supposed to transmit some data through MODBUS right?
Just some additional question:
Can I transfer JSON format data using modbus?
Last edited: