I have two Optas and have tried to replicate this setup; https://docs.arduino.cc/tutorials/opta/getting-started-with-modbus-rtu from the Arduino docs.
I am using a twisted cable with insulation as in the instructions. The code is copy-pasted as-is from the tutorial for the server and the client.
Both Optas have 24v power supplied.
However, The serial monitor on the client only gives me the following:
Writing Coil values ... failed! Connection timed out
Reading Coil values ... failed! Connection timed out
Reading Discrete Input values ... failed! Connection timed out
Writing Holding Registers values ... failed! Connection timed out
Reading Holding Register values ... failed! Connection timed out
Reading input register values ... failed! Connection timed out
I have tried to reverse the polarity of the cable, but same result.
Additional info: I have also tried to setup the Opta to read from a modbus simulator on my PC, using a USB-to-RS485 adapter. Didn't work on the Opta, but it did work on my Arduino Mega (using a cheap TTL-to-RS-485 module), but that might be outside of the scope of this problem. Also tried to setup an Opta as a slave, using a modbus master simulator on my PC. No luck, but again the Mega could do it.
It just seems like the RS485 connector on the Optas doesn't work at all.
Hello @molleby
Please check that you have the libraries (ArduinoModBus
and ArduinoRS485
) and the core up to date.
I was getting the same issue until I updated those.
@PMarquinez I will try that as soon as possible.
In the mean time I managed to get an Opta communicating with a Mega using a MAX13487 board, so that's at least something.
1 Like
i'm seeing a very similar issue - no action from the rs485 connector - all libraries and cores are up to date - oscilloscope on the outputs shows a flat line, nothing. I can do everything need to do with other kit (UNO with a RS485 adapter, modbus simulators with a usb-Rs485 converter).
was going to get another OPTA to do what you are trying but cant see the point if it is a waste of time. Is there a total reboot or have i damaged the OPTA somehow?
regarding my previous post:
I have received a new OPTA and that one has the RS485 working straight out of the box. The Arduino Support team has suggested it was a hardware problem.
My advice:
put an oscilloscope across you A and B terminals on the RS485 and load the ArduinoRS485 library example called 'Sender'. You should see a response on your scope (you can also use a usb-rs485 converter to monitor the OPTA output) - if you get nothing it would be worth getting in touch with Arduino Support and/or the reseller you got it from (if you didn't buy it from Arduino direct).
do be careful with damaging the casing when using the screw terminals - i used the wrong size of screwdriver and damaged the case while trying to diagnose the problem.... i'm guessing the reseller will just say 'no' to a return but i will keep the OPTA for other things - not RS485 though.