Inverter: SMA Sunny Boy Storage - dalathegreat/Battery-Emulator GitHub Wiki
[!CAUTION] Working with high voltage is dangerous. Always follow local laws and regulations regarding high voltage work. If you are unsure about the rules in your country, consult a licensed electrician for more information.
Compatible SMA inverters
- Sunny Boy Storage 2.5 (SBS-2.5) :heavy_check_mark:
- Sunny Boy Storage 3.7 (SBS-3.7) :heavy_check_mark:
- Sunny Boy Storage 5.0 (SBS-5.0) :heavy_check_mark:
- Sunny Boy Storage 6.0 (SBS-6.0) :heavy_check_mark:
All these use the SMA_BYD_HVS_CAN
setting!
Word of caution, isolated CAN ⚠️
This inverter does not handle a CAN connected EV battery on the same channel. If the inverter, which likes to see only BYD CAN frames, sees standard automotive CAN frames, the inverter will enter a fault state.
This can be solved in several ways:
- You can use Double Lilygo's
- You can add an isolated MCP2515 CAN channel
- You can add an isolated MCP2518 CANFD channel, and run it in classic CAN mode
- You can use the Stark CMR hardware
Keep in mind that you will also need automated contactor control via GPIO, or a battery that has CAN controllable on/off contactors. This is due to a complicated pairing process when taking the battery in to use, when the inverter will command on/off the battery in order to succeed with pairing.
[!NOTE]
The inverter contains a 120 Ohm terminating resistor on CAN-H/L pins
[!IMPORTANT]
Grounding is extremely important for all inverters. Make sure the battery case is connected to protective earth, and the shield part of the twisted pair CAN is connected to PE also! Failing to do this will result in CAN errors.
Connecting the Enable pin from Inverter to Battery-Emulator
The inverter needs to be able to control the closing of the contactors. This is done via a signal, called the enable line. This Enable line is connected to GPIO 5 on the LilyGo board. Due to the signal being 12V, we need to step it down to 3.3V that the Battery-Emulator uses on its GPIO pins.
This stepdown can be achieved with a resistor divider
The 1k resistor isn't technically needed but just in case there's a short it would limit the current into the LilyGo pin
This is how the SBS should be connected to the lily/stark hardware
[!TIP]
If you have the Stark CMR, you can wire the 11V enable line (B) directly to SIGNAL IN (GPIO 2) and SMA GND (C) directly to SIGNAL GND. The Stark CMR hardware does not require any resistors, it can take the full input voltage of the enable line as is.
Compiling the software for SMA Sunny Boy Storage inverters
Make sure that the settings in the "USER_SETTINGS.h" file are correct. The line:
#define SMA_BYD_HVS_CAN //Enable this line to emulate a "BYD Battery-Box HVS 10.2KW battery" (SMA compatible) over CAN bus
needs to be uncommented for the software to emulate the SMA specific BYD H protocol over CAN. Next step is then to select the battery that you intend to use, for instance if you use LEAF battery, make sure the following line is uncommented:
#define BATTERY_TYPE_LEAF // See NISSAN-LEAF-BATTERY.h for more LEAF battery settings
Also, Contactor control is required to let the Battery-Emulator decide when to turn on/off the battery using automated contactor control via GPIO
#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
The inverter needs to allow when to turn on the contactors for the pairing to work. Apart from contactor control needed via GPIO, one of the pins will need to be used as an input, and "Allow contactors to close" signal from the inverter, also called the Enable line. This Enable line is connected to GPIO 5 on the LilyGo board.
After setting this up, flash the board!
Inverter setup
For the SMA battery configuration process (pairing) to succeed, the following conditions must be fulfilled:
- The battery emulator state (as seen on the webserver) is OK. This means that the battery must be sending CAN messages.
- The enable line is connected, and able to close the contactors.
- The HV DC lines of the battery are connected to the SMA, such that the SMA measures voltage when the enable line goes high.
- The SMA is connected via CAN to the battery emulator, such that the SMA can send a pairing request, and the battery emulator can respond to this.
To perform the battery configuration process you'll need the installer password (or buy PUK from SMA) for the web interface of the inverter.
Power on the SMA, and wait for the blue light to stay on continuously. Connect to the SMA web interface. The IP address of webserver is 192.168.12.3
, when connecting directly to the SMA WiFi network (access point). This web interface will list the IP address of the SMA on your local network on the bottom of the page. On your local network, you can also reach the webpage via its hostname smaxxxxxxxxxx.home
(where xxxxxxxxxx
shall be replaced with the serial number of your device).
Log in to the web interface as installer.
Start the configuration wizard. Proceed to the battery tab.
Set battery type to "BYD Battery Box HVS" (if setting the battery type is an option). Wait for the pairing to start.
When starting the system and during pairing, make sure the Inverter allows contactor closing
checkbox on the battery emulator webserver goes :heavy_check_mark:
Let the pairing run until it completes. It can take up to 30 minutes for the pairing to complete. Once done, BYD Battery-Box (4-8)
and a serial number are seen in the configuration wizard, like in the image below. The capacity is always 10200 Wh, as that is the capacity of the battery type being emulated.
Proceed with the next pages of the installation wizard to finalize the SMA configuration process.
Installation examples
Please feel free to add!