March 26th, 2013, 04:54 AM
Join Date: Mar 2013
Time spent in forums: 13 m 32 sec
Reputation Power: 0
Sending hex over seriel
Got a solarcell inverter (Danfoss ULX 3600i) which I will try to connect to my linux machine, to see if I can grab the data from it, how much energy created eg for stats. There is an input for RJ45 connection on it, but with RS485.
I got the cables to connect it through my usb port in the pc with an RS485 converter in between the pc and the inverter.
I am then writing a small python code to make request. However I cant figure out how to send the data correctly.
ser = serial.Serial(
thestring = "7E FF 03 00 01 00 02 0A 01 C8 04 D0 01 02 80 00 00 00 00 8E E7 7E"
data = struct.pack(hex(thestring))
#data = struct.pack(hex, 0x7E, 0xFF, 0x03, 0x00, 0x01, 0x00, 0x02, 0x0A, 0x01, 0xC8, 0x04, 0xD0, 0x01, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x8E, 0xE7, 0x7E)
s = ser.read(1)
The inverter is using the Danfoss ComLynx protocol (on page 26 is the data i am trying to send): http://www.danfoss.com/NR/rdonlyres/18FA1022-2FF1-484A-8460-B6A51BE202BF/0/ComLynx_User_Guide_16_20120817_A7.pdf