Modbus RTU slave not working #18233
Replies: 6 comments 3 replies
-
I think you forgot to actually link to the library. |
Beta Was this translation helpful? Give feedback.
-
Also which line is called A and B is often confusing. |
Beta Was this translation helpful? Give feedback.
-
I recently built a Modbus to MQTT converter using the same library and a Pi Pico W. Good luck and greetings from Cologne, Mathias Edit: Corrected the 484 to 485 (Once wrong all copies will be wrong ... ;-)) |
Beta Was this translation helpful? Give feedback.
-
Thank you @Lobo-T and @mathiasflick for your help. Following @mathiasflick advice, I first tried ESP to ESP communication without RS485 drivers, and it works like a charm. However, when I connect RS485 drivers, communication stops working and I got an My wiring is the following: ESP32_1 TX -> MAX485_1 DI MAX485_1 A -> MAX485_2 A ESP32_2 TX -> MAX485_2 DI ESP32_1 GND -> ESP32_2 GND (I also tried without this connection) I also tried three RS485 drivers, in case one was faulty. |
Beta Was this translation helpful? Give feedback.
-
Now that we know which type of RS485 converter you are using @Lobo-T is absolutely right (I myself use very straightforward modules without the control pin, i.e. RX, TX, GND only ...). Excerpt from client example: client = ModbusRTU( |
Beta Was this translation helpful? Give feedback.
-
It finally worked! I have already tested this configuration but I think it was an issue with using GPIO12 as control pin, which was causing problems at boot. Thank you so much @Lobo-T and @mathiasflick |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I am using an esp32 with Micropython "ESP32_GENERIC-20250415-v1.25.0.bin" and a MAX485 converter to communicate via Modbus using this library: https://github.com/brainelectronics/micropython-modbus
When the esp32 acts as master, it works flawless (tested using an USB-to-RS485 converter and my computer acting as slave).
However, when the esp32 acts as slave, the master (tested both on computer and on other esp32) raises
"No data received from slave"
error.I tried exactly the same examples as in https://github.com/brainelectronics/micropython-modbus/blob/develop/examples/rtu_client_example.py and https://github.com/brainelectronics/micropython-modbus/blob/develop/examples/rtu_host_example.py, but it didn't work.
I also tried to add some resistors between A and B, and pullup and pulldown resistors as well. Furthermore, I add a delay before initializing the UART interface in the slave esp32.
Is this problem familiar to anyone? I don’t know what more to try.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions