ISO RS485 on M5dial
-
Hi, So i have a ISO RS485 and i need to get modbus working on it. The primary problem im facing is that the module is UART based and by my understanding M5Dial has I2C and GPIO ports. Is it as simple as hardware serial and setting 1 and 2 pins to UART or is there something else to it
Also it would be great help if there are any modbus library that can be used.
Thank You -
@mukul_100_ what software you planning to use?
see uiflow2 init example
-
i am using platformio right now. thanks
-
Hello @mukul_100_
please find an example here with M5Dial and RS485 unit controlling an ACSSR relay via Modbus protocol.
Thanks
Felix -
@felmue hi felix sorry for the late reply, finally got a chance to get back to this
i studied the example but not sure if i understood how to implement the master slave concept through this and also there is a error thrown in
RS485Class RS485(Serial2, GPIO_NUM_1, GPIO_NUM_2, -1, -1);as there are only 4 arguments accepted by the class
also serial2 needs some tweaking for esp32 right?
thanks -
Hello @mukul_100_
I linked the incorrect variants for RS485 and Modbus libraries. Sorry about that. I fixed the example. The libraries I used are the ones from M5Stack.
https://github.com/m5stack/ArduinoModbus
https://github.com/m5stack/ArduinoRS485Thanks
Felix -
@felmue Hi felix
the changes you mentioned are in the same example code that is linked above? -
-
@felmue ,did you make any changes in the RS485.h file
along these line 46
#else
#ifndef RS485_DEFAULT_DE_PIN
#define RS485_DEFAULT_DE_PIN A6
#define RS485_DEFAULT_RE_PIN A5
#endifthanks,
Mukul -
Hello @mukul_100_
No.
I think you are still on the library I incorrectly linked to in my example before.
Incorrect library: https://github.com/arduino-libraries/ArduinoRS485
Library I used: https://github.com/m5stack/ArduinoRS485
Thanks
Felix