dalathegreat/Battery-Emulator
Fork: 144 Star: 1021 (更新于 2024-10-27 16:05:35)
license: GPL-3.0
Language: C++ .
This software enables EV battery packs to be used for stationary storage in combination with solar inverters.
最后发布版本: v7.4.0 ( 2024-10-01 15:57:32)
Battery-Emulator ⚡🔋
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.
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 🪛
- Connect one end of the LilyGo RS485 to the Gen24 Modbus
- Connect the other end of the LilyGo to the CAN side of the battery
- Wire up high voltage cable between the Gen24 and the battery
- Add a 5-12V power source to power the LilyGo and 12V to the battery (uninterruptible PSU or 12V lead acid recommended in parallel)
- Some batteries need manual pre-charge circuit and positive/negative contactor control. Others are automatic. See the wiki for more info.
- Enjoy a big cheap grid connected battery!
Wiring example, LEAF battery 💡
Here's how to wire up the communication between the components.
Here's how to connect the high voltage lines
For more examples showing wiring, see each battery types own Wiki page. For instance the Nissan LEAF page
How to compile the software 💻
- Download the Arduino IDE: https://www.arduino.cc/en/software
- Open the Arduino IDE.
- 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. - Click
Tools
menu ->Board: "...."
->Boards Manager...
, install theesp32
package byEspressif Systems
(notArduino ESP32 Boards
), then pressClose
.
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)
- The Arduino board should be set to
ESP32 Dev Module
(underTools
->Board
->ESP32 Arduino
) with the following settings: - Select which battery type you will use, along with other optional settings. This is done in the
USER_SETTINGS.h
file. - Press
Verify
andUpload
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:
- adafruit/Adafruit_NeoPixel LGPL-3.0 license
- ayushsharma82/ElegantOTA AGPL-3.0 license
- bblanchon/ArduinoJson MIT-License
- eModbus/eModbus MIT-License
- knolleary/pubsubclient MIT-License
- mackelec/SerialDataLink
- me-no-dev/AsyncTCP LGPL-3.0 license
- me-no-dev/ESPAsyncWebServer
- miwagner/ESP32-Arduino-CAN MIT-License
- pierremolinaro/acan2515 MIT-License
- pierremolinaro/acan2517FD MIT-License
- YiannisBourkelis/Uptime-Library GPL-3.0 license
It is also based on the information found in the following excellent repositories/websites:
- https://gitlab.com/pelle8/inverter_resources //new url
- https://github.com/burra/byd_battery
- https://github.com/flodorn/TeslaBMSV2
- https://github.com/SunshadeCorp/can-service
- https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3
- https://github.com/dalathegreat/leaf_can_bus_messages
- https://github.com/rand12345/solax_can_bus
- https://github.com/Tom-evnut/BMWI3BMS/ SMA-CAN
- https://github.com/FozzieUK/FoxESS-Canbus-Protocol FoxESS-CAN
- https://github.com/maciek16c/hyundai-santa-fe-phev-battery
- https://github.com/ljames28/Renault-Zoe-PH2-ZE50-Canbus-LBC-Information
- Renault Zoe CAN Matrix https://docs.google.com/spreadsheets/u/0/d/1Qnk-yzzcPiMArO-QDzO4a8ptAS2Sa4HhVu441zBzlpM/edit?pli=1#gid=0
- Pylon hacking https://www.eevblog.com/forum/programming/pylontech-sc0500-protocol-hacking/
Like this project? 💖
Leave a ⭐ If you think this project is useful. Consider hopping onto my Patreon to encourage more open-source projects!
最近版本更新:(数据更新于 2024-10-03 15:44:10)
2024-10-01 15:57:32 v7.4.0
2024-09-22 23:01:41 v7.3.0
2024-09-16 04:21:57 v7.2.0
2024-09-05 03:13:12 v7.1.1
2024-08-31 21:54:49 v7.1.0
2024-08-15 18:10:25 v7.0.0
2024-08-01 04:49:39 v6.5.0
2024-07-25 04:33:32 v6.4.0
2024-07-09 03:07:43 v6.3.0
2024-06-17 04:49:28 v6.2.1
dalathegreat/Battery-Emulator同语言 C++最近更新仓库
2024-11-05 23:57:44 PCSX2/pcsx2
2024-11-05 22:06:04 LizardByte/Sunshine
2024-11-05 00:42:13 ClickHouse/ClickHouse
2024-11-04 21:49:30 notepad-plus-plus/notepad-plus-plus
2024-11-03 22:31:09 MaaAssistantArknights/MaaAssistantArknights
2024-11-02 20:28:28 AaronFeng753/Waifu2x-Extension-GUI