Hello, my partner and I are attempting to use Modbus RTU to get a master (an UNO) and a slave (a Nano) to communicate data back and forth.
We are using fabricated Modbus RTU modules on both master and slave that use MAX 485 chips.
We used this site to wire the boards together, minus the LCD screen.
Currently we are using the SimpleModbusMaster and SimpleModbusSlave to communicate as they seem to be well flushed out and have example programs.
The example programs use a potentiometer on one to alter the brightness of an LED on the other. (Ex. Changing the potentiometer on the master will change the brightness of the LED on the slave and vice versa)
Using the given example programs, we can get the master’s potentiometer to alter the slave’s LED, but not the other way around.
Using SoftwareSerial and another nano, we have been able to prove that the Slave is both receiving the request and storing the potentiometer data in the correct holding register
We have not been able to see if the Master is even seeing the data or if it is just timing out. We aren’t even sure where exactly it is supposed to be storing the value read from the Slave.
We have been reading MANY forum posts that are similar, but none of the proposed solutions have worked.
What we have tried so far:
• Pull up resistor on RX on the Master side
• Made sure both master and slave were sending and receiving using an LED
• Checked the all values stored within the master for the entire array of regs on the Master
• Changed pin numbers on inputs and outputs
• Raised timeout value – helped a little with what is currently working
• Added a delay –made everything worse (unsurprising)
Other, older, forum posts (and the manual) talk about being able to see failed requests and number of retries, but do not give examples of how to use or access these functions within the library. (My partner and I are very new at this)
Any advice would be appreciated
/*Edit: on the attachments the names are switched for the SerialMonitor and the Slave.
SlaveCode.ino (655 Bytes)
MasterCode.ino (1.93 KB)