Bafang Battery Charge Port: Battery Reset Tool

A lithium battery management system can (and should!) disable the battery output to prevent damage from overcurrent or undervoltage, after which it must be reset. The inadvertent charge port short may have damaged the BMS PCB, but did not shut down the battery’s motor output, which means the BMS will not should not require resetting. However, because all this will happen remotely, it pays to be prepared.

A description of how to reset the BMS in a similar battery involves poking bare hot wires into the battery terminals, which IMO is akin to Tickling The Dragon’s Tail. The alert reader will note that the “Shark” battery shown on that page has its terminal polarity exactly opposite of the “Ultra Slim Shark” battery on our bikes. Given the energies involved, eliminating any possible errors makes plenty of sense.

The battery connector looks like this:

Bafang battery - Ultra-Slim Shark connector
Bafang battery – Ultra-Slim Shark connector

For this battery, the positive terminal is on the right, as shown by the molded legend and verified by measurement.

A doodle with various dimensions, most of which are pretty close:

Bafang battery - connector dimension doodle
Bafang battery – connector dimension doodle

Further doodling produced a BMS reset adapter keyed to fit the battery connector in only one way:

Bafang battery - adapter doodle
Bafang battery – adapter doodle

Which turned into the rectangular lump at the top of the tool kit, along with the various shell drills and suchlike discussed earlier:

Bafang battery tools
Bafang battery tools

Looking into the solid model from the battery connector shows the notches and projections that prevent it from making incorrect contact:

Battery Reset Adapter - show front
Battery Reset Adapter – show front

The pin dimensions on the right, along with a mysterious doodle that must have meant something at the time :

Bafang battery - adapter pin doodle
Bafang battery – adapter pin doodle

The pins emerged from 3/16 inch brass rod, with pockets for the soldered wires:

Bafang battery - reset tool - pins
Bafang battery – reset tool – pins

The wires go into a coaxial breakout connector that’s hot-melt glued into the recess. The coaxial connectors are rated for 12 V and intended for CCTV cameras, LED strings, and suchlike, but I think they’re good for momentary use at 48 V with minimal current.

I printed the block with the battery connector end on top for the best dimensional accuracy and the other end of the pin holes held in place by a single layer of filament bridging the rectangular opening:

Bafang battery - reset tool - hole support layer
Bafang battery – reset tool – hole support layer

I made a hollow punch to cut the bridge filaments:

Bafang battery - reset tool - pin hole punch
Bafang battery – reset tool – pin hole punch

The holes extend along the rectangular cutout for the coaxial connector, so pressing the punch against the notch lines it up neatly with the hole:

Bafang battery - reset tool - hole punching
Bafang battery – reset tool – hole punching

Whereupon a sharp rap with a hammer clears the hole:

Bafang battery - reset tool - hole cleared
Bafang battery – reset tool – hole cleared

A dollop of urethane adhesive followed the pins into their holes to lock them in place. I plugged the block and pins into the battery to align the pins as the adhesive cured, with the wire ends carefully taped apart.

After curing: unplug the adapter, screw wires into coaxial connector, slobber hot melt glue into the recess, squish into place, align, dribble more glue into all the gaps and over the screw terminals, then declare victory.

It may never be needed, but that’s fine with me.

[Update: A few more doodles with better dimensions and fewer malfeatures appeared from the back of the bench.]

Bafang battery - adapter better doodle
Bafang battery – adapter better doodle
Bafang battery - adapter dimension doodle
Bafang battery – adapter dimension doodle
Bafang battery - connector key doodle
Bafang battery – connector key doodle

The OpenSCAD source code as a GitHub Gist:

// Adapter to reset Bafang battery management system
// Ed Nisley KE4ZNU Dec 2021
Layout = "Block"; // [Show, Build, Pins, Block, CoaxAdapter, Key]
Gap = 4.0;
/* [Hidden] */
ThreadThick = 0.25;
ThreadWidth = 0.40;
HoleWindage = 0.2;
Protrusion = 0.1; // make holes end cleanly
inch = 25.4;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(d=(FixDia + HoleWindage),h=Height,$fn=Sides);
ID = 0;
OD = 1;
// Dimensions
WallThick = 3.0;
PinSize = [3.5,4.75,9.0 + WallThick]; // LENGTH = exposed + wall
PinFerrule = [3.5,4.75,10.0]; // larger section for soldering
PinOC = 18.0;
PinOffset = [-9.0,0,9.0];
Keybase = 4.0; // key bottom plate thickness
KeyBlockSize = [15.0,50.0,15.0];
CoaxSize = [35.0,15.0,11.0];
CoaxGlue = [0,2*2,1];
// without key X section
BlockSize = [CoaxSize.x + WallThick + PinFerrule[LENGTH],KeyBlockSize.y,KeyBlockSize.z + WallThick];
// Battery connection pin
// Used to carve out space for real brass pin
// Long enough to slide ferrule through block
module Pins() {
for (j=[-1,1])
translate(PinOffset + [0,j*PinOC/2,0])
rotate(180/6) {
// Coaxial socket adapter nest
// X=0 at left end of block, Z=0 at bottom
// includes glue, extends rightward to ensure clearance
module CoaxAdapter() {
cube(CoaxSize + CoaxGlue + [CoaxSize.x,0,CoaxSize.z],center=true);
// Block without key
// X=0 at connector face, Z=0 at bottom of block
module BareBlock() {
difference() {
translate([BlockSize.x - CoaxSize.x,0,BlockSize.z/2]) // bridging layer
// Complete block
module Block() {
// Battery connector key shape
// Chock full of magic sizes
// Polygons start at upper left corner
module BatteryKey() {
// base outline
kb = [[-15,KeyBlockSize.y/2],[0,KeyBlockSize.y/2],[0,-KeyBlockSize.y/2],[-15,-KeyBlockSize.y/2]];
// flange cutout
kf = [[kb[0].x,20],[-3,20],[-3,15],[-8,15],[-8,-15],[-3,-15],[-3,-20],[kb[0].x,-20]];
// sidewalls
kw = [[-15,KeyBlockSize.y/2],[0,KeyBlockSize.y/2],[0,20],kf[0]];
difference() {
linear_extrude(height=BlockSize.z - KeyBlockSize.z)
// Build it
if (Layout == "Block") {
if (Layout == "Pins") {
if (Layout == "Key") {
if (Layout == "CoaxAdapter") {
if (Layout == "Show") {
if (Layout == "Build") {