I want to send data of Zeigler Energy meter to Arduino nano using Modbus RS485. I am using Modbus Poll to scan the values, But it is showing Error.
Technically, the master first asks for data, and then the slave (the energy meter) replies. Modbus slaves can not initiate a transaction - cannot send on their own.
The problem could be almost anything
- Devices must be Modbus enabled. Just because a device has a serial port does not mean that it is Modbus enabled. Sometimes Modbus is an option and must be purchased. If the documentation for a slave does not have Modbus register/address map describing where data resides, chances are the slave is not Modbus capable.
- make sure the devices are live and powered.
- serial settings:
a) must be 8 bit data word for Modbus RTU.
b) Baud rate and parity MUST be identical on both ends.
c) Many devices do not recognize a change to serial settings until power is cycled to the device.
- Message from Master to slave uses the wrong slave ID. Slaves only answer when addressed by their exact address/node ID.
- a broadcast query message to slave 0 gets no reply/response from any slave, per the Modbus standard
- RS-485 driver lines A/B or (+)/(-) are not consistently labeled from vendor to vendor. Connections should (+) to (+), (-) to (-). If labeling is backwards, the drivers are not damaged but comm won't work. Try swapping the driver lines on one end.
- only one master is allowed on an RS-485 network. Adding 2nd master will ensure communications failure.
- termination resistors are typically not required for bench testing with short cable runs and low baud rates.
- "2 wire" RS-485 is a misnomer. RS-485 needs a wire/conductor for signal ground in addition to the 2 driver lines.
- On a multipoint network, minimize the length of 'stub' wiring for a node from a junction "drop" point to the node. Connect the node as close a possible to the junction drop point.
- if using a Windows box for the master, confirm in Device Manager > Ports which virtual COM port the USB/485 or USB /232 adapter installs on and use that COM port. Using the wrong COM port guarantees comm failure. USB/485 adapters with 4 terminals for "4 wire" full duplex that are used for "2 wire" half duplex connections usually need the Tx(+) jumpered to Rx(+) and Tx(-) jumpered to Rx(-).
Use a generic Windows Modbus master to read a value from the slave and prove the communications link. These types of apps format the Modbus message and calculate the CRC value so the message from the master can be assumed to be 'good'. Then work with the other master. (not sure whether you're reference to Modbus Poll refers to the Windows master or to code for an Arduino.
Try reading a non-zero value from a register with a known value. (getting a zero value might come from a different register, because unused registers are frequently initialized to a zero value.)
Try read operations before write operations.