Skip to content
Daniel Öster edited this page Sep 26, 2024 · 152 revisions

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.

Welcome to the Battery-Emulator wiki!

Where do I get the hardware needed?

The Battery-Emulator software can be run on either of the following devices:

Product Product Link
LilyGo T-CAN485 AliExpress
Stark CMR Module Wiki page

Note

There is no way to purchase a pre-programmed device. This is a hobbyist open source project. You will be responsible for loading the software and setting it up correctly for your components.

Supported inverters list

The following solar inverters have support:

  • Fronius Primo Gen24 Plus ✅
  • Fronius Symo Gen24 Plus ✅
  • Fronius Symo Hybrid 3.0/4.0/5.0-3-S ✅
  • Ferroamp EnergyHub ✅
  • Sungrow SH5.0/6.0/8.0/10RT ✅ (some AU models not supported)
  • Sungrow SH3.0/3.6/4.0/5.0/6.0RS ✅ (some AU models not supported)
  • GoodWe ET/BT & EH/BH & EHB ✅
  • SolaX X1 Hybrid ✅ ⁉️ Not compatible with single CAN board. Needs double CAN to avoid having EV pack on same CAN channel.
  • SolaX X3 Hybrid ✅ ⁉️ Not compatible with single CAN board. Needs double CAN to avoid having EV pack on same CAN channel.
  • Ingeteam STORAGE 1Play TL M (3-6 kW) ✅
  • Deye SUN-(5-20)K-SG01HP3-EU-AM2 ✅
  • Deye SUN-(29.9-50)K-SG01HP3-EU-BM3 ✅ (Tested with BYD-CAN emulation and dual CAN/double Lilygo. May also work with RS485 by emulating BYD-Modbus)
  • FoxESS H1/H3⁉️ Not compatible with single CAN board. Needs double CAN to avoid having EV pack on same CAN channel.
  • Solis RHI-3P(5-10)K-HVES-5G ✅ / S6-EH1P10K-H-US-APST ✅ / S6-EH3P-(5-10.0K)-H-EU ✅
  • Sofar 5K...20KTL-3PH ✅
  • SMA Sunny Boy Storage 2.5 / 3.7 / 5.0 / 6.0 ✅
  • Growatt ⚠️ ⚡ (Testing ongoing!)
  • Kostal Plenticore ⚠️ ⚡ (Testing ongoing!)
  • SMA Sunny Tripower Smart 5.0-10.0 SE ⚠️ (Protocol added "SMA Tripower", testers welcome!)
  • VIESSMANN Hybrid Inverter 5.0/6.5/8.0/10.0 A-3 ⚠️ (Untested, works with HVS / HVM)
  • KACO Blueplanet hybrid 6.0- 10.0 TL3 ⚠️ (Untested, works with HVS / HVM)
  • GE GEH5.0/8.6/10-1U-10 ⚠️ (Untested, works with HVS / HVM)
  • Canadian Solar CSI-TE & CSI-HE & CSI-BHE Series ⚠️ (Untested, works with HVS / HVM)
  • Afore Afore AF17K-THA 230V ⚠️ (Untested, works with BYD CAN, good option for Norway)
  • Huawei Sun2000 ❌ Requires DC/DC converter, NOT supported

Supported batteries list

The following EV batteries have support:

Other batteries

Supported chargers list (optional)

Emergency charging batteries via a generator, supported via the following standalone chargers:

How do I configure the software for my inverter?

All the changes to the software are done in the USER_SETTINGS.h file, located in the Software folder. At the top of this file, you can select which battery and which inverter protocol should be in use. If you are unsure which protocol you need, check the specific page for the inverter you are using linked here in the Wiki.

How do I make changes to CAN configuration?

For advanced setups where you add CAN channels, you will need to change which channel a component is connected to. This is done in the USER_SETTINGS.cpp file

Example, you want to change which CAN channel the inverter is connected to, since you added an MCP2515 chip. We then change the line .inverter = CAN_NATIVE, into the correct interface, .inverter = CAN_ADDON_MCP2515,

Example 2, you want to change which interface the battery connects to, since it needs CAN-FD add-on. We then change the line .battery = CAN_NATIVE, into the correct interface, .battery = CANFD_NATIVE,

Status LED

The board has a built in LED that is used to signal current status. With this feature, it is easy to at a glance catch what info the board is getting. It will show the current colors:

  • Pulses 🟢 if all is well and BMS is active
  • Pulses 🔵 if CAN wires are disconnected, wrong polarity, or incorrect terminating resistor setup. Check wiring!
  • Pulses 🟡 if battery has entered a warning state
  • Solid 🔴 if battery goes into a fault state

CAN wiring troubleshooting

CAN networks are vulnerable to lightning strikes. See the dedicated wiki page for this for more info 🌩️

Caution

Grounding everything is especially important for certain inverters. If you fail to ground inverter or battery casing to protective earth (PE), there might be a voltage difference between the two components, which can fry the CAN communication chips on the Battery-Emulator. Always connect every component, and the communication shield wire to protective earth before turning the system on!

See this image for grounding:

image

Caution

Never connect the signal wire shields in both sides. This creates a ground loop. One side of the shield should be freefloating, like shown in the above picture.

Every CAN bus must be terminated with a 120 Ohm resistor at each end of the bus. For quick testing, the exact value of the termination resistors is not always critical. Sometimes a single terminator is sufficient. For final installs, proper termination is essential. If you see strange errors, you should check the termination.

Important

To save yourself a lot of trouble, always terminate the CAN bus properly.

If you get a 🔵 blue LED on the board (or 🔴 red for BMS missing), you need to check the CAN wiring. Here are some basic tips:

  • Make sure all CAN devices are turned ON
  • Make sure the polarity of High/Low is correct. High goes to High, Low to Low
  • Make sure the terminating resistors are correct. CAN networks should have two 120 Ohm resistors in each end of the network. With everything OFF, you can measure resistance between CAN-H and CAN-L. The result should be 60 Ohm. If it shows 120 Ohm, one resistor is missing at an end. If it shows 40 Ohm, you have too many terminating resistors, and might need to remove the built in resistor on the LilyGo. RemoveThisWhenUsingCANinverter
  • Make sure the cable you are using is a twisted pair cable. This is important for signal quality.
  • Make sure the cable you are using is shielded. One side of the shield should be connected to a pin labelled SHIELD (or PE if no dedicated shield exists). This improves signal quality
  • Try a different powersupply for the board. Powering it via USB from a computer can cause noise on the signal output. Powerbank or phone charger might have cleaner voltage output. If you see CAN_TX_FAILURE occasionally your powersupply might be noisy

What about safety? ⚠️ ℹ️

Reusing old often crashed EV packs always comes with risks. The system performs a few safety functions for safer charging and discharging. Apart from this, the data sent to the Inverter is also processed on the inverter side, and depending on which inverter is used a few additional safety checks are performed there. Here is a list of all safety functionalities that are in the system. Note that almost all safety features rely on communication data, so a physical error (damaged cell casings, ruptured/leaking cells, corrosion etc.) wont be detectable via software. For this you need fuses, and periodic visual inspections.

Caution

At the end of the day, you alone are responsible for the system.

Safety features run on inverter side:

  • Battery sends max total voltage allowed for charging. Incase this value is reached, inverter stops charging. (For instance 404V)
  • Battery sends min total voltage allowed for discharging. Incase this value is reached, inverter stops discharge (For instance 300V)
  • Battery sends max cell temperature. Incase this value goes too high, inverter stops charge/discharge (For instance 40*C)
  • Battery sends min cell temperature. Incase this value goes too low, inverter stops charge/discharge (For instance -15*C)
  • Battery sends max allowed charge in Watts. Incase this goes to 0W, no further charging is possible. (This can happen when battery is full)
  • Battery sends max allowed discharge in Watts. Incase this goes to 0W, no further discharge is possible. (This can happen when battery is completely empty)
  • Battery sends state of health %. Incase this value drops too low, the inverter will alert the user that it is time to recycle the battery.
  • Inverter analyzes insulation resistance of the battery connection. Incase a leakage to ground is detected, the system stops.

Safety features run on Battery-Emulator side:

  • If the code enters FAULT state, inverter gets notified, all charging/discharging stops, and contactors are opened (if they are controlled via GPIO pins).
  • If CAN communication is lost between emulator and battery for more than 60s, the code enters FAULT state.
  • Minimum cell voltage is sampled, and if one cell goes too low the code enters FAULT state. (For instance <2900mV)
  • Maximum cell voltage is sampled, and if one cell goes too high the code enters FAULT state. (For instance >4250mV)
  • Battery state of health % is sampled, if it is below 25% the code stops and informs the user that it is time to recycle the battery.
  • BMS fault codes are sampled, if any serious code is set, the code enters FAULT state (For instance LB_Failsafe_Status on Nissan LEAF packs)
  • High voltage wiring is unhooked during operation. This will trigger interlock messages, and the code enters FAULT state
  • Incase of a high voltage leak to battery casing (Protective earth), the code enters FAULT state (For instance LB_Failsafe_Status on Nissan LEAF packs)

Important

Do note that all actual limits are battery/inverter specific, the values here are only used for example purposes. The amount of safeties will vary depending on your choice of battery.

Connectivity

The board has wifi, and supports running a Webserver that you can connect to for real time values, Over The Air updates (OTA), cellmonitoring, changing settings and more. See the Webserver page for more info on how to use the system

For those into home automation, the code also supports MQTT

Alternative hardware

There is also an excellent Raspberry Pi integration available here: https://gitlab.com/pelle8/gen24 This version focuses more on power users that want to experiment more than the LilyGo "Set and forget" solution does. Say you want to integrate charging only during certain hours, spotpricing etc., then the Raspberry Pi solution made by Per Carlen is the way to go! You can also use both hardware at the same time, use LilyGo for the control, and use Raspberry for additional statistic-gathering!

Clone this wiki locally