Regarding Modbus RTU with solar Inverters

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.

Kindly anyone do help me with this.

RPS communication quick guide_VEC101R1 (1).pdf (413 KB)

Inverter_Code.ino (1.82 KB)

Scada Parameters updated 7.2.1.4.pdf (232 KB)

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.

Hi Pylon,

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?

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?

ok, I'll post the drawing.

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.

Your RS-485 board probably also have RE and DE pins. Why do you think you don't have to wire these pins?

pylon:
Your RS-485 board probably also have RE and DE pins. Why do you think you don't have to wire these pins?

Yeah. I connected those pins to the enable pin declared in the code.

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

  • u8txenpin : 0 for RS-232 and USB-FTDI
  • or any pin number > 1 for RS-485

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

Modbus master(0,0,2);
I have used this one.

Prasannaa:
Modbus master(0,0,2);
I have used this one.

Cool you changed it from pin 0. We will wait for the sketch of you hardware connections. Thanks.

Hi,

Sorry!! I couldn't make out a digital design. I have made a hand drawn one. its attached below. Thanks.

That look OK, expect there are two unconnected/undefined wires in the picture.

What are the A'/B' RS-485 lines for on the inverter?

You are using an UNO which has only one serial port. How are you switching between communicating with the PC and with Modbus?

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.

adwsystems:
You can only plug in the PC or the modbus. You will have to disconnect one to use the other.

Is it possible to use it with Mega? Because it has extra UARTs right.

Prasannaa:
Is it possible to use it with Mega? Because it has extra UARTs right.

BINGO! Then configure your constructor to use Serial1 and the corresponding pins.

adwsystems:
BINGO! Then configure your constructor to use Serial1 and the corresponding pins.

Thanks so much. I'll make the changes and update you with the result.

I have another doubt. Is it possible to use this library with Particle series of IoT baords?

@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.