diy solar

diy solar

Felicity Solar Lithium Batteries BMS Protocol Definition using python

irmajavi

New Member
Joined
Jan 22, 2023
Messages
3
Location
Puert Rico
Hello everyone, I would like to access to BMS of a Felicity Solar battery using python. Attached is the protocol definition.
If anyone can help me with the code. This is what I got so far:

import serial
import time

serial_port = "/dev/ttyUSB0"
serial_baud = 9600
full_command = bytes.fromhex("01 03 f8 0b 00 01 c4 a8")
response_line = None

print(full_command)
print(f"port {serial_port}, baudrate {serial_baud}")
try:
with serial.serial_for_url(serial_port, serial_baud) as s:
print("Executing command via serialio...")
s.timeout = 1
s.write_timeout = 1
s.flushInput()
s.flushOutput()
s.write(full_command)
#s.write(full_command+'\r')
time.sleep(0.1) # give serial port time to receive the data
response_line = s.read_until(b"\r")
print("serial response was: %s", response_line)
return response_line
except Exception as e:
print(f"Serial read error: {e}")
print("Command execution failed")

The only response I get is b' '.

Any suggestions?
 

Attachments

  • BMS Communication Protocol RS485 20210608.pdf
    545.4 KB · Views: 164
I think you could Try to use serial monitor software to debug the communication between edms (felicity software) and battery. Maybe it will help you
 
Where did you get this protocol definition from? Does it apply the all felicity battery types?
 
I actually tried it myself on my felicity 12,5 kWh and it works. You need to check for the "slave id", the examples in the PDF are all assuming slave id = 1 and this must match with the dip switch setting of the battery, otherwise you wont get a response.
 
Back
Top