I’m doing a project where I’m building a control panel for a VFD (inverter/variable frequency drive). I’m connecting the two over half duplex RS485 and use Modbus RTU. As a master I use a Arduino Mega 2560 with a TTL to RS485 module. Yes the VFD and the Mega are correct baud rates (9600) and pairity (8N1), it works if the master and VFD are the only devices on the bus. But when I add another slave (Arduino nano) with this TTL to RS485 module (even without a microcontroller nad no code) the communications seems to be broken.
I’m using a shielded twisted pair wire of about 3 metres to a circuit board daisy-chaining the module for the nano (10cm) and the VFD (1 meter).
What did I try?
I started with the mega as master, nano as slave, and the VFD as slave. Because I did not know the extra module on the bus was causing the problem at this point I was wondering if it was my code or hardware setup. I’ve read multiple topics of people having trouble with the Mega and the RS485 module but never got to the exact problem or a solution. I need the mega for the scale of my control panel so I kept digging.
I use modbusmaster (see example of halfduplex on the github) and then just 2 lines of code writing to single register (0x2000, 0x0006 for example) just as a simple test to start/stop the VFD. Worked before when testing the VFD and an UNO as the only two devices on the bus, why not now? The nano slave does not have any code at this point to rule out any software issues interfering. I tried flushing as well, did not solve the problem.
Back to hardware troubleshooting
So I tried the same setup with another nano as a master instead of the mega (leaving the other nano as slave connected). It works! But I need the Mega… So I started looking into things. I tried hardware serial, altserial and softwareserial. None worked. Then I started questioning the lines, nothing that was having short-circuits or big interference (doing this in my living room, not on an industrial site). When I pulled out the module for the nano slave and it started to work with mega as master and the VFD as only slave connected.But hell why, I need the nano slave to be on the bus as well!
Trying termination resistors
So I desoldered R5 to R7 (termination resistors) of the extra module, which helps for some people. Leaving the module of the mega as is. Same situation, communication is fine until I drop in the module for my nano slave.
Making the nano slave repeat works??!
I also experimented with the communication between the mega master and the nano slave, that works! But the VFD will not listen to the master. When I programmed the nano slave to repeat what it hears (yes, like a parrot) then the VFD is responding correct with the setup I want (master, VFD slave, nano slave). But the nano slave should not be the one acting as a master, let alone repeat a message on the bus. The weird thing here is, the VFD is not responding to the message of the master, but the nano picks it up and is able to repeat it so the communication IS correct somehow, but not good enough for the VFD?? I'm really freaking out now.. I can't sleep anymore! please help.
I do admit, I have grounded the shield of the 3 meter cable on both ends, but this should not be the problem, it works with just a master and the VFD as slave setup so why not when adding another module for the nano as slave.
The line is now measuring 120 ohm resistance (comes from the TTL to RS485 module on the Arduino Mega side). The VFD has a jumper, on position is 18,2 kOhm and off position is 500 ohm. Due to the parallel connection no matter what position the line resistance between A and B stays on or around 120 ohm. The problem just occurs when attaching the extra module for the nano slave, even when I leave out the slave itself.
Anyone out there who might be able to help me troubleshooting this? Anything I don’t know of? (Yes my first RS485/Modbus application, but doing good so far I guess).
Should I desolder the termination resistors of the other module as well? Any other ideas on why the communication would be broken when I throw in another module?
If anything is unclear, please tell me. I tried my best to clarify the setup and what I tried. Again, code does not seem to be an issue here.
schematic of the converter
Hope this helps