Inverter: SMA Sunny Boy Smart Energy - 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
- SMA Sunny Boy Smart Energy 3.6 / 4.0 / 5.0 / 6.0-50 Hybrid Inverter :heavy_check_mark:
All these options use the SMA compatible BYD Battery-Box HVS protocol
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 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 which has more CAN channels (Recommended option)
- You can use a CAN filter between inverter and the rest of the system
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. Due to this, the Stark CMR is highly recommended for first timers!
[!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.
NOTE: in some cases the GPIO 5 is already occupied by the battery (for example with a BMW i3 battery). An error will be thrown while compiling the battery emulator. The GPIO5 pin has to be assigned to e.g. GPIO 33
A small PCB with resistors and JST Connectors is a great way to stop down from 12v to ~3.3V. Parts list:
- 2x 2.2K Ω resistor
- 1x 1K Ω resistor
- 1x 3K Ω resistor
- 2x JST Connector 2 pins (1 for SMA Inverter enable line cables, 1 for Battery emulator cables)
The 1k resistor isn't technically needed but just in case there's a short it would limit the current into the LilyGo pin
[!TIP]
If you have the Stark CMR, you can wire the 12V enable line directly to SIGNAL IN (GPIO 2). The Stark CMR hardware does not require any resistors, it can take the full input voltage of the enable line
Pin layout Custom PCB in the example below:
- 12V Enable line SMA Tripower
- Ground SMA Tripower
- Ground Lillygo
- GPIO 05 or 33 (or a different pin that you configure) (Default is GPIO 05)
This is how the connection for the SMA Hybrid Tripower would look like.
SMA Hybrid Communication pin layout
- CAN-H
- 12V enable line
- CAN-L
- Ground
- Fast-Stop
- Fast-Stop
Fast-Stop is not required, but optional. This should turn off the inverter (and open battery contacts?) in a safe way.
Fast-Stop
Fast-Stop or emergency stop is a normally open connection. Closing the circuit (pin 13 to pin 14) will disable the inverter completely. PV input, battery and battery backup.
You can enable Fast-Stop in the settings of the inverter (Device parameters -> Device -> Inputs/outputs -> Digital input -> Fast shutdown via the digital input)
When activated the following event will be triggered
10513 -NSS quick stop: Stop through Digital inputs is executed
when deactivated the following event will be triggered
10513 - NSS quick stop: Start through Digital inputs is executed (maybe it will start-up from itself... )
I was too impatient to wait for the inverter to startup (after 2 minutes I disconnected the inverter completely) I'm not sure if the inverter will start up to 'normal' if you wait longer (feel free to edit the wiki)
A known working solution to restart the inverter is:
- Black switch on the side of the SMA Hybrid turned off
- Turn off 230v SMA hybrid
- Wait until all LEDS are off
- Enable your emergency stop to be open again
- turn on 230v
- turn on black switch
- wait for SMA Hybrid
- it should start within 5 minutes.
Which protocol to use
For this inverter type, use the option called "SMA compatible BYD Battery-Box HVS" under the "Inverter Protocol" setting
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 for the inverter allow signal, 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 T-CAN485 board, and on the Stark CMR it is GPIO 2
Inverter setup
The SMA Hybrid inverter is sensitive when you try to install the battery to the inverter. Pairing the battery in the installation assistant is sometimes tricky
- Power off the lillygo battery emulator
- Disconnect SMA CAN-bus connection
- Login to the SMA portal (your SMA inverter ip address )
- Start installation assistant (https://192.168.X.XXX/#/formwizard)
- Configure your SMA Portal till step 6 in the installation assistant. (do not go to battery config yet)
- Power on the lillygo. Wait for the battery emulator to be fully booted
- Reconnect the SMA CAN-bus connection
- Go to step 7 in the installation assistant. It should be recognised.
- Battery functional test: charge/distcharge the battery, and proceed the installation assistance.
The battery should be recognised as a BYD Battery-Box Premium HVS battery.
Updating the battery emulator software requires (at least in 1 case) to disconnect the SMA CAN-bus to reboot.
- Disconnect SMA CAN-bus
- Update battery emulator
- Wait for reboot
- Connect SMA CAN-bus
- Enjoy
Communicate with the inverter to charge/discharge
For communication you need an energy meter. This can be the SMA Energy meter (expensive) or a simulated SMA energy meter.
To simulate the SMA energy meter you can use Home Assistant and an energy meter (like HomeWizard) https://github.com/Roeland54/SMA-Energy-Meter-emulator
Installation examples
Please feel free to add!