Hi guys,
I have a solar system installed at my home with an infinisolar V 5KW hybrid inverter. The inverter has two communication ports on it, 1 - USB and 2 - -RS 232 (RJ - 45) style connector. An RS 232 cable is provided which has an RJ 45 connector on one end and an RS 232 female connector on the other.
My problem is that i have written a small program in python which can communicate with the inverter without problem using the above said RS 232 cable coupled with a prolific USB to Serial Converter cable and responds to the command as it should.
I want to monitor the inverter using a NodeMCU or an Arduino Nano, UNO or MEGA 2560 coupled with a wifi module. I have tried using softwareserial library as well has hardware serials on MEGA but the inverter would not respond to any form of arudino. I have used TTL to Serial Converter module but to no avail.
I have also had success when sending commands through a terminal like RealTerm etc.
The only difference i can see in above two schemes is the Prolific USB to Serial Converter which is not being used in case of arduino or NodeMCU, OR
May be python and arduino transmit serial data in different ways (i have not clue about this).
I have tested the arduino circuit by hooking up the TTL to Serial Converter to the USB to Serial Converter and reading the data in the RealTerm software. The data is received correctly and the response is sent to the arudino correctly. but the inverter does not respond not even with NAKss.
I have invested almost two months now in sniffing the right protocol for my inverter and need your help in solving this issue. so
Please help, I'll be very very thankful. I am including my python code and the arduino code for your consideration.
Arduino Code Running on UNO
#include<SoftwareSerial.h>
#include<string.h>
SoftwareSerial mySerial(4, 5);
String response = "";
String commandstring = "\x5E\x50\x30\x30\x35\x47\x53\x58\x14\x0D";
String P005PI = "\x5E\x50\x30\x30\x35\x50\x49\x69\x0A\x0D";
void setup()
{
Serial.begin(9600);
mySerial.begin(2400);
establishcontact();
}
void loop()
{
Serial.print("\n sending the command to inverter: ");
Serial.println(commandstring);
delay(5000);
mySerial.print(commandstring);
while(mySerial.available()>0)
{
int data = mySerial.read();
response += (char)data;
if (data == '\r')
{
Serial.print ("\n\nThe reponse received from the inverter is: ");
Serial.println(response);
response = "";
}
}
}
void establishcontact()
{
while(mySerial.available()<=0)
{
Serial.println ("establishing contact");
mySerial.print("\x5E\x50\x30\x30\x35\x49\x44\x0D");
delay(300);
}
}
Python Code:
import serial
ser = serial.Serial("COM8", 2400)
ser.close()
ser.open()
command3 = b'\x5E\x50\x30\x30\x35\x47\x53\x58\x14\x0D'
ser.write(command3)
s = ser.read(111) #The response is 111 charachters long string
print(s)
Monitor.ino (1.51 KB)
Python Code.txt (246 Bytes)



