Need to use Iono Arduino + Arduino Yun rev2 as a Modbus master
Closed this issue · 1 comments
@giampiero7 Hello, I have an application where I need to display data on rs485 modbus rtu LCD, with lcd as the slave & Iono Arduino + Arduino Yun rev2 as the modbus master.
Currently, I have been using the following modbus library for Arduino Mega (atmega256):
https://drive.google.com/file/d/1N-ayhVh7FExnI8cfgZFSBeuq5UBHlm7-/view?usp=sharing
Now since the library was initially used only for atmega256, it is not readily compatible with other boards like Yun so the configuration registers need to be changed in the library as seen in the attached image below:
But im really not sure which serial port and pins of Arduino Yun rev2 does rs485 connector of iono arduino map to...
The main problem I'm seeing here is that Yun has only two hardware serial ports of which one is for USB debugging(Serial) and other is for communication between the 32u4 and AR9331 processor(Serial1). That implies to use an additional Serial port, it has to be done using Softwareserial as no hardware ports are available.
The modbus master library can handle software serial but i need to know which pins and ports the rs485 connector is attached to, so that i can make the necessary changes in the part of the library whose image i have attached above
Please correct me if I am wrong somewhere. Thanks for your time!
Hi @Ebrahim1604 ,
You are correct, the RS485 interface is connected to the RX/TX lines, the same used by Serial1. So the limitation is that you cannot use the Bridge library while using TX/RX for external communication.
For Modbus RTU master functionalities from the 32u4 you can refer to this example:
https://github.com/sfera-labs/arduino-modbus-rtu-master/blob/master/examples/ModbusMaster/ModbusMaster.ino
For using the TX/RX lines from the AR9331, this post may give you some hints:
https://forum.arduino.cc/index.php?topic=248693.msg1787065#msg1787065