Skip to content
Torsten Oltmanns edited this page Oct 24, 2023 · 7 revisions

BMS to Solar Inverter communication

(Use, monitor and control any battery brand with any inverter)

  1. Introduction
  2. Supported protocols
  3. Supported BMSes and Inverters

How to use

The reference project bms-to-inverter-main shows how to communicate with Daly BMS to a Sunny Island inverter. Please make sure you have the right ports/devices configured in config.properties.

1. Choose your BMS and inverter with the appropriate protocol

In the pom.xml file of the bms-to-inverter-main project you'll find the dependencies which BMS and which inverter to use. If you're not using Daly BMS to SMA Sunny Island both communicating via CAN protocol you'll have to change the following dependencies according to your BMS, inverter and optional services.


		<!--		choose BMS 		-->
		<dependency>
			<groupId>com.ai-republic.bms-to-inverter</groupId>
			<artifactId>bms-daly-can</artifactId>
			<version>${project.version}</version>
		</dependency>
		
<!--		<dependency>-->
<!--			<groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!--			<artifactId>bms-daly-rs485</artifactId>-->
<!--			<version>${project.version}</version>-->
<!--		</dependency>-->



		<!--		choose inverter			-->
		<dependency>
			<groupId>com.ai-republic.bms-to-inverter</groupId>
			<artifactId>inverter-sma-can</artifactId>
			<version>${project.version}</version>
		</dependency>
		
<!--		<dependency>-->
<!--			<groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!--			<artifactId>inverter-growatt-can</artifactId>-->
<!--			<version>${project.version}</version>-->
<!--		</dependency>-->



		<!-- optionally add MQTT and/or email services -->
		<dependency>
			<groupId>com.ai-republic.bms-to-inverter</groupId>
			<artifactId>service-mqtt-broker</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.ai-republic.bms-to-inverter</groupId>
			<artifactId>service-mqtt-client</artifactId>
			<version>${project.version}</version>
		</dependency>
		
		<!-- optionally add Email service -->
		<dependency>
			<groupId>com.ai-republic.email</groupId>
			<artifactId>email-javamail</artifactId>
			<version>1.0.0</version>
		</dependency>


So if you like to use RS485 protocol to communicate with the Daly BMS you can just change the bms-daly-can to bms-daly-rs485.

2. Choose your target architecture (!!! only if using CAN protocol !!!)

In the native folder of the protocol-can project you have sub-folders for all the supported architectures. Choose your target architecture and copy the libjavacan-core.so file from the appropriate architecture folder to the native folder.

3. Configuration

Once you have your right dependencies and target architecture defined check the config.properties to define the number of battery packs, port assignments and MQTT properties.

numBatteryPacks=8

# RS485 properties
RS485.baudrate=9600
RS485.startFlag=165
RS485.frameLength=13

# CAN properties
#bms.portname=com3				# RS485 on Windows for testing
#bms.portname=/dev/ttyS0		# RS485 on Raspberry
bms.portname=can0
inverter.portname=can1		# can1 for Waveshare 2CH-CAN-HAT-FD, otherwise can0 for e.g. Waveshare RS485/CAN hat


#MQTT properties
mqtt.locator=tcp://127.0.0.1:61616
mqtt.topic=energystorage

If you intend to use the webserver project to monitor your BMSes you might want to review the application.properties to define the server port and make sure that the MQTT properties match those in your config.properties.

# Webserver properties
server.port=8080

# MQTT properties
mqtt.locator=tcp://localhost:61616
mqtt.topic=energystorage

4. Building the project

Once your project is configured you can simply build it with mvn clean package to produce a zip file found under the target directory. The zip file contains the main jar plus all dependencies in a lib folder. Copy this to your target machine, e.g. a Raspberry, unpack it and start it with java -jar bms-to-inverter-main-0.0.1-SNAPSHOT.jar.

If you're using the webserver then you'll have to copy the webserver-0.0.1-SNAPSHOT.jar found in the webserver/target folder to your target machine and start it with java -jar webserver-0.0.1-SNAPSHOT.


Notes

I will be doing a lot of updates to the documentation and current code and structure but if you have questions or need support feel free to contact me or raise an issue.

I do not take any responsiblity for any damages that might occur by using this software!

Clone this wiki locally