Skip to content

This software enables EV battery packs to be used for stationary storage in combination with solar inverters.

License

Notifications You must be signed in to change notification settings

kukumagi/Battery-Emulator

 
 

Repository files navigation

Battery-Emulator ⚡🔋

GitHub release (with filter) GitHub Repo stars GitHub forks GitHub actions Static Badge

This software enables EV battery packs to be used for stationary storage. It achieves this by converting the EV battery CAN data into a brand battery format that solar inverters can understand. This makes it extremely cheap and easy to use large EV batteries in a true plug'n'play fashion!

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.

Fronius

Hardware requirements 📜

This code fits on the LilyGo ESP32 T-CAN485 devboard , see https://github.com/Xinyuan-LilyGO/T-CAN485

You will also need a complete EV battery. See the battery compability list on which are supported.

Finally, you will need a compatible hybrid solar inverter, for example the "Fronius Gen24" or "GoodWe ET"

Installation basics 🪛

  1. Connect one end of the LilyGo RS485 to the Gen24 Modbus
  2. Connect the other end of the LilyGo to the CAN side of the battery
  3. Wire up high voltage cable between the Gen24 and the battery
  4. Add a 5-12V power source to power the LilyGo and 12V to the battery (uninterruptible PSU or 12V lead acid recommended in parallel)
  5. Some batteries need manual pre-charge circuit and positive/negative contactor control. Others are automatic. See the wiki for more info.
  6. Enjoy a big cheap grid connected battery!

Wiring example, LEAF battery 💡

Here's how to wire up the communication between the components. Wiring

Here's how to connect the high voltage lines HighVoltageWiring

For more examples showing wiring, see each battery types own Wiki page. For instance the Nissan LEAF page

How to compile the software 💻

  1. Download the Arduino IDE: https://www.arduino.cc/en/software
  2. Open the Arduino IDE.
  3. Click File menu -> Preferences -> Additional Development -> Additional Board Manager URLs -> Enter the URL in the input box: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json and click OK.
  4. Click Tools menu -> Board: "...." -> Boards Manager..., install the esp32 package by Espressif Systems (not Arduino ESP32 Boards), then press Close.

NOTE: The version depends on which release of Battery-Emulator you are running!

  • ⚠️ Make sure to use a 2.x.x version if you are on a release older than 6.0.0 (For instance ESP32 v2.0.11 when using Battery-Emulator v5.4.0)
  • ⚠️ Make sure to use a 3.x.x version if you are on a release newer than 6.0.0 (For instance ESP32 v3.0.0 when using Battery-Emulator v6.0.0)

bild

  1. The Arduino board should be set to ESP32 Dev Module (under Tools -> Board -> ESP32 Arduino) with the following settings: alt text
  2. Select which battery type you will use, along with other optional settings. This is done in the USER_SETTINGS.h file.
  3. Press Verify and Upload to send the sketch to the board. NOTE: In some cases, the LilyGo must be powered through the main power connector instead of USB-C when performing the initial firmware upload. NOTE: On Mac, the following USB driver may need to be installed: https://github.com/WCHSoftGroup/ch34xser_macos

NOTE: If you see garbled messages on the serial console, change the serial console to match the baud rate to the code, currently 115200.

This video explains all the above mentioned steps: https://youtu.be/_mH2AjnAjDk

Linux Development Environment Setup

In addition to the steps above, ESP32 requires a dependency for a Python module, pyserial install using the cli.
python3 -m pip install pyserial

If you're using Ubuntu , use apt to manage the dependencies of arduino:
pyserial install: sudo apt install python3-serial

Arduino AppImage must be set as executable after downloading to run correctly
example: chmod 775 arduino-ide_2.3.3_Linux_64bit.AppImage

Dependencies 📖

This code uses the following excellent libraries:

It is also based on the information found in the following excellent repositories/websites:

Like this project? 💖

Leave a ⭐ If you think this project is useful. Consider hopping onto my Patreon to encourage more open-source projects!

About

This software enables EV battery packs to be used for stationary storage in combination with solar inverters.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.4%
  • C 4.5%
  • HTML 0.8%
  • Python 0.2%
  • CMake 0.1%
  • Batchfile 0.0%