Making bms's VESC compatible

A-DamW

1 kW
Joined
Dec 19, 2019
Messages
436
Location
Idaho county Idaho
Ok, so I said to myself; "Self, what the heck, you've been slacking way too much, it's time to actually contribute something of value"

That, and this post kinda gave me a kick in the mental rear.

There are a few native vesc based bms's out there in the wild:
Trampa
ENNOID
Chineese ENNOID rip-off

But holy mother, good luck getting out the door for less than ~$250!

The meat:
This thread is about taking inexpensive(like $10-$20), off-the-shelf 'smart' BMS's and getting the battery
data into vesc(controller) so we can do all kinds of fun things with it!
like "Shut that motor down!! cell group 5 is at 2.5 volts!!"

A few months ago I became aware of some reletively new jiabaida (JBD) bms models, specifically the SP17S005:
17s_898d5839-8cf2-44c2-8b80-d073bde0fb39_1024x1024.jpg


these are small form factor, lowish current(~<60A continuous), with built in bluetooth,
and tons of github code for the protocol.
Best of all, they can be had for ~$20 shipped!

UPDATE: github link
GitHub - A-damW/JBD_BMS_BLE_VESC_EXPRESS_BRIDGE: JBD_BMS_BLE_VESC_EXPRESS_BRIDGE: An ESP32 firmware and companion LispBM script to connect multiple JBD BLE BMSs to VESC-EXPRESS via ESPNOW

Also can confirm the model SP14S004, which is a smaller(like tiny) 14s version works as well. Cost about $10 ea.
iu
 
Last edited:
So far, the architecture looks like this:

JBD-BMS<-----bluetooth----->ESP32-BRIDGE<-----esp-now----->VESC-EXPRESS<-----CAN-bus----->VESC-controller(LispBM console)

It looks a little complicated, but I'll be mostly talking about the code on the ESP32 in red above, and lisp.

And a screenshot of lisp(very basic at this point) with a single cell voltage on the far right of the console

JBD-VESC.jpg


More to come...
 
Last edited:
Does this mean that it would work with any bluetooth bms?
Hopefully, I'm starting with a JBD bms because I have several, and the protocol is well documented with code.
My ultimate goal is to port the C/C++ code into a vesc package/native firmware library/lisp/whatever makes sense
so the controller can talk directly to the bms over bluetooth or vesc-express(bluetooth)

Is it necessary to have a vesc express, cant it talk to the vesc directly over bluetooth?
For now, a vesc-express and intermediary esp-bridge is necessary.

Someday it may be able to work without the intermediary esp-bridge, this will
require someone to add core vesc LispBM functions to create a bluetooth client.

Another option is wired UART, if the vesc firmware has the protocol library compiled in, it should be able to talk to the
bms over any available interface.

For now, I am just taking one step at a time, getting each piece working to prove concept.
This has been a massive learning curve for me(a good one!).
The other purpose of starting this thread, is to take what I have started with, and present it to
many other minds out in the world.
I am working on getting the code cleaned up so I can present it on github.
I don't have a license figured out yet, most likely GPLv3 to be compatible w/VESC,
whatever it is, rest assured it will be open source!

I also have the ESP32 "bridge" with a 0.96" oled screen, that can work standalone over BT, and display
Min/Max cell voltages, and horizontal bar graph of all the cells(13s)

1000000020.jpg
 
Last edited:
Interesting stuff, following!
 
Any update?
Yes! I have been on some Discord servers talking with several other developers working incidentally on almost exactly the same thing as outlined above.

At this point, I am going to deliver what I currently have working, and try to create something like a goals timeline to give folks a better idea of where we are at and where we are headed.
 
Alright, I had some downtime to work on the code base,
Turns out, implementing simultaneous multiple bluetooth BMS connections and espnow relay was not as hard as I expected.
This is a screenshot of the Android mobile app and two 13s jbd BMS simultaneously connected to an ESP32 over bluetooth, and the ESP32 relaying the cells data wirelessly via ESP now to the VESC express:
Screenshot_20240904-135904.png

And I got the working code in a repository on GitHub (I know, I know, it is the Arduino environment, this was just to get started, eventually I will move to vs code and/or platform IO, or similar)
GitHub - A-damW/JBD_BMS_BLE_VESC_EXPRESS_BRIDGE: JBD_BMS_BLE_VESC_EXPRESS_BRIDGE: An ESP32 firmware and companion LispBM script to connect multiple JBD BLE BMSs to VESC-EXPRESS via ESPNOW
 
Are you just connecting the bms:es in series to charge the battery? Maybe a question for later :)
Please ask all the questions you want!

I am not connecting the bms's in series, they are completely bypassed for charge and discharge.
The only thing connected is the balance wires on the BMS to the individual cells.
The mosfets on the BMS cannot handle the combined series voltage of two or more packs.

I wish JBD would make an ultra tiny, ultra cheap, monitor only BMS with perhaps one or two 200v mosfets to cut battery off for charging, or control a contactor/relay.

Battery discharge and regen is handled by the vesc controller, that is the whole point of this project, to get individual cell data to the motor controller so the motor controller can do the shutdown on LV and HV limits.

For standalone charger use I can think of a couple ways to control the charger;
One way would be to have an ESP32 GPIO pin connected to a relay to shut down your charger if any voltage/temperature conditions are met.
Another way would be to have one of the bms's control a relay via the mosfets, and have the ESP32 command the mosfets off when any voltage condition is encountered
 
Last edited:
Please ask all the questions you want!

I am not connecting the bms's in series, they are completely bypassed for charge and discharge.
The only thing connected is the balance wires on the BMS to the individual cells.
The mosfets on the BMS cannot handle the combined series voltage of two or more packs.

I wish JBD would make an ultra tiny, ultra cheap, monitor only BMS with perhaps one or two 200v mosfets to cut battery off for charging, or control a contactor/relay.

Battery discharge and regen is handled by the vesc controller, that is the whole point of this project, to get individual cell data to the motor controller so the motor controller can do the shutdown on LV and HV limits.

For standalone charger use I can think of a couple ways to control the charger;
One way would be to have an ESP32 GPIO pin connected to a relay to shut down your charger if any voltage/temperature conditions are met.
Another way would be to have one of the bms's control a relay via the mosfets, and have the ESP32 command the mosfets off when any voltage condition is encountered

Sorry for the off topic question but could save me taking apart my bms's.
What voltage are the jbd 10-17s mosfets capable of? I've got 2 spare, one 50a and one 60a off the top of my head.
I've switched to jk for my main 20s battery but have a spare 13s battery I'm going to fit one of the jbd bms's and was considering building a 7s battery to run in series.
 
Sorry for the off topic question but could save me taking apart my bms's.
What voltage are the jbd 10-17s mosfets capable of? I've got 2 spare, one 50a and one 60a off the top of my head.
I've switched to jk for my main 20s battery but have a spare 13s battery I'm going to fit one of the jbd bms's and was considering building a 7s battery to run in series.
Looks like the mosfets are PES016N08R, made by Semione for the SP17S005 model.
Datasheet says 90V. datasheet attached below for posterity.
And source link: http://semi-one.com/Uploads/pdf/pes016n08r-v1.0.pdf

1000000203.jpg
 

Attachments

  • pes016n08r-v1.0.pdf
    2.6 MB · Views: 8
Last edited:
And while I'm at it, the SP17S005 model utilizes the O2 micro OZ3717 digital front end for measuring cell voltage, temps, coulomb counting etc.
Page 38 of the doc:
 

Attachments

  • O2 807&G807C Product Catalog 2023-6-26(final).pdf
    1.1 MB · Views: 6
Looks like the mosfets are PES016N08R, made by Semione for the SP17S005 model.
Datasheet says 90V. datasheet attached below for posterity.
And source link: http://semi-one.com/Uploads/pdf/pes016n08r-v1.0.pdf

View attachment 360373
Thank you I appreciate that, I don't use regen so it might be worth a shot.

Good luck on your project looks like it's coming along well. Theirs some decent budget vesc controller offerings but not bms's so this could be a great alternative.
 
This is awesome, I would love to see if you could get ANT bms's to also work with VESC
 
I have pushed (pulled?) code in github, that softcodes total battery cell count.

So now the esp32-bridge tracks the cell count, and sends via esp-now to the vesc-express in a colon delimited cellnum:voltage format:
1:3.604
2:3.685
3:3.691
4:3.690
5:3.668
6:3.689
7:3.691
8:3.679
9:3.690
etc.,

where it is split and applied to the appropriate values in the vesc-express lisp script.
 
Last edited:
your working is amazing. i have JK bms and found eps-home-jk-bms topic on Github. But i don't know where to start. can you make more clear guide for noobs like me. Thank a lot.
maybe i should switch to jbd bms.
 
This is outstanding work! My last bike with my homemade raspi ASI display died August 2023 (and that SUV nearly took me with it). Life has repeatedly gotten in the way, but since then I have planned to develop an open source ESP32 based display for VESC that can handle lisp scripts for on-demand retuning, JBD BMS integration, control LED lighting, provide both onboard bluetooth audio and engine noise simulation, and an RFID/LoRa fob based ignition for my replacement build. I have a 30W surface transducer kit for the audio which is a very slick solution especially for a rigid frame with large flat panels like Qulbix. There's been talk of various VESC displays and some simpler completed ones out in the wild on Github and some Discord groups, but none quite as ambitious as I'd like. Most important to me is the ability to retune on the fly, and set a charge cutoff voltage from the display. This would require a contactor or similar if bypassing the BMS, as I think it's most reasonable to do.

My intent was to bypass tthe VESC-Express entirely and just connect to the VESC CAN, but given your existing work, I may rethink that approach. I started with an ESP32-S3-WROOM-2-N32R16V but it's more troublesome than I expected. I chose this board because I wanted headroom for the many proposed features, and I had to write a partition table myself just to flash my first test sketch. I've spent literal days trying to get the JTAG debugger to work properly, so all I've done so far is get my hardware inputs (rotary encoder, 5-way joystick) working properly. I plan to use an Adafruit SHARP memory display. It's sort of a hybrid between an LCD and epaper. I'm not in a position currently to invest a lot of time into this, but I already have an STR-500 controller and am committed to finishing it eventually. Suffice to say, I'm on board for this. The VESC has by far the best features of any controller out there, it needs a really good open source display to go with it.
 
i have JK bms and found eps-home-jk-bms topic on Github. But i don't know where to start. can you make more clear guide for noobs like me. Thank a lot.
Just so you know, I am quite a n00b myself.
If anyone wants to send me a JK, ANT, whatever brand BMS, I can work on the protocol in my spare time.
The main reason I use JBD, I can buy them for $10-20 shipped.

This is outstanding work!
Thank you! I am just standing on the shoulders of giants.

The VESC has by far the best features of any controller out there, it needs a really good open source display to go with it.
I totally agree on both points.
I have been watching the vesc display development space explode with projects, so I am kind of waiting for the dust to settle to see which one will work best with off the shelf cheap hardware.

In other news, someone out in the wild using this project discovered a bug related to VESC firmware 6.02-6.05 differences.
The code has been updated and released, read about it on github.
 
Last edited:
Following. Also, while shopping, found something that may be of interest... This BMS series from JBD is getting close to a drop-in solution looking at the discharge currents. Not quite as inexpensive as the SP14S004, but something I'm considering.
 
Back
Top