Help with Modbus Master not communicating with ModBus RTU flow meter [SOLVED]

Hi I am trying to use a sketch based on SimpleModbusMasterExample to interrogate the registers of a flow meter (TUF-2000M) via modbus RTU. the sketch is running on an arduino uno clone (3.3V) with a MAX3485 RS485 driver (3.3v). For debugging I have been using modbus simulation software (trial programs from: http://www.modbustools.com/ running on a PC with a prolific usb to RS485 converter) So the RS485 bus has the pc, arduino & the flow meter connected to it.

The flow meter talks flawlessly to the pc running Modbus poll - all registers can be interrogated!

The arduino talks flawlessly to the pc running Modbus slave - registers can be read!

BUT the arduino will not communicate with the flow meter!

If the flow meter is set to slave 1 & the pc Modbus slave to slave 2 the arduino is clearly sending the correct codes (as seen by the pc) but for some reason the flow meter is not recognising them, even though it recognises identical codes sent from the pc!

The setup is on the bench so I don't think termination is an issue (I have tried various resistors anyway) The ground of the arduino is connected to the flow meter ground I have tried different RS485 drivers on the arduino to no effect

I am not at all sure where the problem is or even if it is hardware or software?

I would be grateful for suggestions as to where to look next?

I don't have a scope at the moment but I will have in a day or two!

Richard

Just to say this problem is now solved!

At first I thought it was a hardware problem with the MAX3485 chip running at 3.3v I even changed the chip to a MAX485 at 5v with a level shift chip but this made no difference! I used all the termination & line pull up/ pull down resistors but still no luck!

As I thought, 3.3v rs485 drivers are fully compatible with 5v rs485 drivers this is fully explored here: http://e2e.ti.com/support/interface/industrial_interface/f/142/p/93260/610632 So I turned to the software!

Originally I used the SimpleModbusMaster library from:

https://github.com/angeloc/simplemodbusng I thought this was meant to be an updated version of the original written by Bester Juan but BJ has continually updated his libraries and this thread explains all! http://forum.arduino.cc/index.php?topic=176142.0

His site has all the libraries and a full explanation for hardware & software use: https://drive.google.com/folderview?id=0B0B286tJkafVSENVcU1RQVBfSzg&usp=drive_web

So I changed the code to be compliant his SimpleModbusMaster library (although the libraries have the same name & are similar, they use different function calls & a different sketch structure)

Bingo! Everything works fine! The arduino talks to the pc and, more importantly, to the flow meter! The arduino is using a MAX3485 driver at 3.3v

I am not a proficient enough programmer to work out why one library works with the TUF-2000M and the other doesn't!

Many thanks to Bester Juan for his libraries & documentation!

Richard

Richard,

Thanks for the update and for the describing your solution. I started to write this morning with thoughts of the MAX3485 somehow not working correctly with the interface in the flowmeter, but as you went on to find, the hardware was ok, and I couldn't offer a good explanation.

After thinking about it more, I couldn't think of a valid reason for it not to work with the flowmeter. Finding it to be the library you were using to give the problem could be the only explanation


Paul