Hi,
I'm working on a project to read data from Bonfiglioli Solar inverter through modbus communication. I have used and arduino UNO with MAX485 IC for modbus. The code developed was from smarmengol's modbus library.
I have attached the code, communication guide and parameters.
After many trials I ended with just some boxes in Serial Monitor.
MAX485 provides a half-duplex communication. You define a full-duplex communication in your sketch:
/**
* Modbus object declaration
* u8id : node id = 0 for master, = 1..247 for slave
* u8serno : serial port (use 0 for Serial)
* u8txenpin : 0 for RS-232 and USB-FTDI
* or any pin number > 1 for RS-485
*/
Modbus master(0,0,0); // this is master and RS-232 or USB-FTDI
Post a complete wiring diagram of your setup!
After many trials I ended with just some boxes in Serial Monitor.
What do you expect? Modbus RTU is a binary protocol you won't see any message you can read.
Thanks for the reply. I have attached the wiring of the inverter. Then the RS485 board is connected with the A & B of the inveter. To the Arduino, I have connected the R0 and DI to Rx and Tx pins of arduino.
What do you expect? Modbus RTU is a binary protocol you won't see any message you can read.
I'm completely newbie to the Modbus communication. Yeah, modbus is binary. What should I do to process the data? I just need to send the data to thingspeak. So please guide me through.
Do you have a drawing you can post showing how you wired the 4-wires from the inverter to the RS-485 board that is connected to the Arduino?
I dont have a drawing. The RS485 A was directly wired to the A of the module. Similarly B was wired to B pin of the module. This was instructed by the inverter company's technician.
There are a lot of RS-485 Arduino modules out there. Without the specific one and how you connected it, we can only tell you that you may have a hardware or a software problem. You will need to draw and post a sketch of your wiring to prove the hardware is connected properly. Then know what hardware you are using, we can determine if you have configured the software correctly. So far it looks as though you may have a problem with both.
There are 4 wires in the inverter, A/B and A'/B'. What is the difference?
Which enable pin? Pin 0? The same pin 0 that is used for the serial communications and as defined to NOT be for RS-485 per the comment in the code that says
adwsystems:
Which enable pin? Pin 0? The same pin 0 that is used for the serial communications and as defined to NOT be for RS-485 per the comment in the code that says
What are the A'/B' RS-485 lines for on the inverter?
I asked the same to the Inverter technician. He said its not needed to be connected for the communication and just A & B are enough. A' and B' are inverting output & input. Whereas A and B are non inverting output and input.
You are using an UNO which has only one serial port. How are you switching between communicating with the PC and with Modbus?
I'm not switching the serial yet. How should I switch them?
Prasannaa:
I asked the same to the Inverter technician. He said its not needed to be connected for the communication and just A & B are enough. A' and B' are inverting output & input. Whereas A and B are non inverting output and input.
I'm not confident in that answer. There is no concept of "inverting" in RS-485.
Prasannaa:
I'm not switching the serial yet. How should I switch them?
You can only plug in the PC or the modbus. You will have to disconnect one to use the other.
@pylon, it could be that the inverter has two modbus rtu interfaces. one where it is master (for BMS and/or Smart Meter) and one where it is slave. on my Fronius Symo I can't use Modbus RTU to request data because the inverter is master for BMS and Smart Meters. only Modbus TCP is available to request data.