Inverter: SMA Sunny Tripower 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

  • Sunny Tripower Smart Energy 5.0 / 6.0 / 8.0 / 10.0 :heavy_check_mark:

All these inverters use the SMA_TRIPOWER_CAN option!

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:

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.

[!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:

  1. 12V Enable line SMA Tripower
  2. Ground SMA Tripower
  3. Ground Lillygo
  4. 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

  1. CAN-H
  2. 12V enable line
  3. CAN-L
  4. Ground
  5. Fast-Stop
  6. 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:

  1. Black switch on the side of the SMA Hybrid turned off
  2. Turn off 230v SMA hybrid
  3. Wait until all LEDS are off
  4. Enable your emergency stop to be open again
  5. turn on 230v
  6. turn on black switch
  7. wait for SMA Hybrid
  8. it should start within 5 minutes.

Compiling the software for SMA Sunny Tripower inverters

Make sure that the settings in the "USER_SETTINGS.h" file are correct. The line:

#define SMA_TRIPOWER_CAN //Enable this line to emulate a "SMA Home Storage battery" over CAN bus

Needs to be uncommented for the software to emulate the correct 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

Some batteries require Contactor control, if your battery requires this, enable Contactor control to let the Battery-Emulator decide when to turn on/off the battery #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

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

  1. Power off the lillygo battery emulator
  2. Disconnect SMA CAN-bus connection
  3. Login to the SMA portal (your SMA inverter ip address )
  4. Start installation assistant (https://192.168.X.XXX/#/formwizard)
  5. Configure your SMA Portal till step 6 in the installation assistant. (do not go to battery config yet)
  6. Power on the lillygo. Wait for the battery emulator to be fully booted
  7. Reconnect the SMA CAN-bus connection
  8. Go to step 7 in the installation assistant. It should be recognised.
  9. 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.

  1. Disconnect SMA CAN-bus
  2. Update battery emulator
  3. Wait for reboot
  4. Connect SMA CAN-bus
  5. 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!

image