Battery-Emulator
This software enables EV battery packs to be used for stationary storage in combination with solar inverters.
https://github.com/dalathegreat/battery-emulator
Category: Energy Storage
Sub Category: Battery
Keywords from Contributors
transforms observability archiving profiles measurements optimizers mesh general projections mock
Last synced: 42 minutes ago
JSON representation
Repository metadata
This revolutionary software enables EV battery packs to be easily reused for stationary storage in combination with solar inverters
- Host: GitHub
- URL: https://github.com/dalathegreat/battery-emulator
- Owner: dalathegreat
- License: gpl-3.0
- Created: 2023-02-19T19:21:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-31T10:57:54.000Z (8 days ago)
- Last Synced: 2025-05-31T18:01:13.911Z (8 days ago)
- Language: C++
- Homepage:
- Size: 29.6 MB
- Stars: 1,545
- Watchers: 83
- Forks: 213
- Open Issues: 99
- Releases: 68
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
README.md
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 compatibility 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 π»
Start by watching this quickstart guide
- 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 ESP32 version depends on which release of Battery-Emulator you are running! See the Release Notes for more info on which version to use with the current version (Suggested ESP32 version X.Y.Z)
- The Arduino board should be set to
ESP32 Dev Module
andPartition Scheme
toMinimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
(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. - Copy the
USER_SECRETS.TEMPLATE.h
file toUSER_SECRETS.h
and update connectivity settings inside this 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.
NOTE: If you see the error Sketch too big
then check you set the Partition Scheme above correctly.
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
Also you might need to install FUSE to run appimages
sudo apt install libfuse2
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
- ESP32Async/AsyncTCP LGPL-3.0 license
- ESP32Async/ESPAsyncWebServer LGPL-3.0 license
- 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!
Owner metadata
- Name: Daniel Γster
- Login: dalathegreat
- Email:
- Kind: user
- Description: π Automation Engineer (Bsc), π± Plant based βοΈ Reverse engineering specialist ππ Extending Electric vehicle lifecycles
- Website: dalasevrepair.fi
- Location: Vaasa, Finland
- Twitter:
- Company: Dala's EV Repair
- Icon url: https://avatars.githubusercontent.com/u/26695010?u=20d9d4c07ad56cdf0c89dd436a301bd997794d99&v=4
- Repositories: 10
- Last ynced at: 2023-03-03T15:41:38.871Z
- Profile URL: https://github.com/dalathegreat
GitHub Events
Total
- Fork event: 79
- Create event: 249
- Release event: 22
- Issues event: 404
- Watch event: 523
- Delete event: 212
- Member event: 6
- Issue comment event: 1068
- Push event: 1008
- Pull request review comment event: 281
- Pull request review event: 498
- Gollum event: 930
- Pull request event: 639
Last Year
- Fork event: 79
- Create event: 249
- Release event: 22
- Issues event: 404
- Watch event: 523
- Delete event: 212
- Member event: 6
- Issue comment event: 1068
- Push event: 1008
- Pull request review comment event: 281
- Pull request review event: 498
- Gollum event: 930
- Pull request event: 639
Committers metadata
Last synced: 12 days ago
Total Commits: 2,260
Total Committers: 52
Avg Commits per committer: 43.462
Development Distribution Score (DDS): 0.395
Commits in past year: 1,400
Committers in past year: 41
Avg Commits per committer in past year: 34.146
Development Distribution Score (DDS) in past year: 0.452
Name | Commits | |
---|---|---|
Daniel Γster | d****t@g****m | 1367 |
Cabooman | 8****n | 101 |
amarofarinha | 1****a | 89 |
lenvm | l****m | 88 |
mvgalen | m****n@g****m | 74 |
Jaakko Haakana | j****o@h****t | 70 |
josiahhiggs | 7****s | 55 |
rha | r****o@o****g | 48 |
wjcloudy | 5****y | 34 |
Brett Christensen | b****n@r****m | 33 |
Jakob LΓΆw | j****b@m****e | 30 |
laughingguffly | e****m@g****m | 27 |
No-Signal | m****t@h****d | 26 |
Steven Maresca | s****a@g****m | 23 |
LevinSwe | l****m@h****m | 21 |
nmainil | 1****l | 20 |
Ole | o****d@l****k | 18 |
Christopher Obbard | o****c@g****m | 15 |
Bernhard Urban-Forster | l****m@g****m | 13 |
rjsc | r****t@g****m | 13 |
itpr-gwis2 | b****2@i****e | 9 |
pre-commit-ci[bot] | 6****] | 9 |
Paul Brand | p****d@g****m | 8 |
JΓ³zsef Nagy | 1****o | 7 |
James Brookes | jb@j****m | 5 |
Jamie Jones | j****e@j****k | 5 |
mathl79 | m****l@g****t | 4 |
JorgenSeemann | 8****n | 4 |
Brian McKenna | b****n@b****g | 3 |
Bryant Eadon | b****n@g****m | 3 |
and 22 more... |
Committer domains:
- ukr.net: 1
- jeito.nl: 1
- stamp.se: 1
- coinerella.com: 1
- svane.se: 1
- river-soft.net: 1
- mail.bg: 1
- snutt.net: 1
- ging.nz: 1
- brianmckenna.org: 1
- gmx.net: 1
- jamie-jones.co.uk: 1
- jamesbrookespartnership.com: 1
- itprojekt.ee: 1
- lgaard.dk: 1
- holmes.world: 1
- m4gnus.de: 1
- rea-group.com: 1
- oh1gwk.org: 1
- haakana.net: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 464
Total pull requests: 778
Average time to close issues: about 2 months
Average time to close pull requests: 4 days
Total issue authors: 195
Total pull request authors: 46
Average comments per issue: 3.87
Average comments per pull request: 0.8
Merged pull request: 684
Bot issues: 0
Bot pull requests: 3
Past year issues: 372
Past year pull requests: 558
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 5 days
Past year issue authors: 162
Past year pull request authors: 41
Past year average comments per issue: 2.95
Past year average comments per pull request: 0.94
Past year merged pull request: 474
Past year bot issues: 0
Past year bot pull requests: 3
Top Issue Authors
- dalathegreat (39)
- havrla (12)
- GoSmartEV (11)
- malcolmputer (9)
- StarkJohan (9)
- pazdzierzz (9)
- Jaywatts (8)
- lenvm (7)
- dvbhannes (6)
- EnergibatteriMax (6)
- pmajor021 (6)
- jakub8109 (6)
- obbardc (6)
- DeadmaroZ-TLOTL (6)
- bubble07 (5)
Top Pull Request Authors
- dalathegreat (433)
- lenvm (70)
- amarofarinha (41)
- mvgalen (28)
- kyberias (25)
- StarkJohan (21)
- No-Signal (16)
- wjcloudy (13)
- LevinSwe (11)
- kukumagi (10)
- rjsc (10)
- obbardc (10)
- M4GNV5 (7)
- josiahhiggs (7)
- beadon (6)
Top Issue Labels
- Feature request (114)
- bug (105)
- question (49)
- Troubleshooting install (47)
- enhancement (37)
- help wanted (16)
- Connectivity (13)
- crash (11)
- hardware (8)
- Triage (8)
- wontfix (6)
- invalid (3)
- good first issue (2)
- dependencies (2)
- documentation (1)
Top Pull Request Labels
- enhancement (6)
- help wanted (2)
- hardware (2)
- bug (2)
Package metadata
- Total packages: 2
- Total downloads: unknown
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 0 (may contain duplicates)
- Total versions: 136
proxy.golang.org: github.com/dalathegreat/Battery-Emulator
- Homepage:
- Documentation: https://pkg.go.dev/github.com/dalathegreat/Battery-Emulator#section-documentation
- Licenses: gpl-3.0
- Latest release: v8.13.0+incompatible (published 16 days ago)
- Last Synced: 2025-06-07T21:07:01.227Z (about 15 hours ago)
- Versions: 68
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.401%
- Average: 5.583%
- Dependent repos count: 5.764%
proxy.golang.org: github.com/dalathegreat/battery-emulator
- Homepage:
- Documentation: https://pkg.go.dev/github.com/dalathegreat/battery-emulator#section-documentation
- Licenses: gpl-3.0
- Latest release: v8.13.0+incompatible (published 16 days ago)
- Last Synced: 2025-06-07T21:07:01.299Z (about 15 hours ago)
- Versions: 68
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.401%
- Average: 5.583%
- Dependent repos count: 5.764%
Dependencies
- actions/checkout v4 composite
- arduino/compile-sketches v1 composite
Score: -Infinity