DIY E-Bike Bafang Build

After getting tired of riding the bus and paying the exorbitant fares I decided I wanted a better, more fun way of commuting to work and back. Keep reading to find out how I built my ebike with a bafang mid-drive motor.

The Bike

Firstly, I didn’t have a bike so my first step was to go to the bike shop and figure out which lucky bike gets to become a DIY electric speed demon. Without sounding too cheap, I looked for the cheapest (yet still nice) hard tail mountain bike they had. I came across the Giant 2020 ATX 3 Disc which I got for a steal at $450 NZD (~$300 USD).

Upon getting it home I set about ripping off the front derailleur, front gears, crank arms, bottom bracket bearings, and both the front and rear combined break and gear shift handles. All of these bits must go to make way for the… (all will be revealed below!)


The Parts

The next big thing to buy was the motor, which I ended up settling on the Bafang BBS02 750W because it’s got heaps of power and was relatively affordable. I went for the SW102 LCD display for the Bafang especially because it’s small, non-intrusive and doesn’t draw attention. To power that big motor I decided to build my own 18650 battery pack just as I had done for my electric skateboard. Similar to my electric skateboard pack I used Samsung 25R lithium-ion 18650 cells; it’s hard to beat these cells on price and performance. I went for a 13S3P (39 cells) battery pack which is quite small, only offering 7.5Ah’s of juice but I figured it’d be a good and once again cheap starting place.

For my wee little battery pack I went for this very cheap 13S BMS to keep my battery safe while charging. Speaking of charging I purchased this very, very cheap 54.6V (13S) 2A charger. Also for the battery pack I got XT90S connectors, a battery voltage indicator LCD, a nice DC barrel jack for charging and some big heatshrink to cover the cells up.

Some extra bits for the Bafang motor were wanted/needed;

  • A gear shift sensor that lets the motor know when you’re changing gears so it can briefly stop spinning to allow the gear change to happen smoothly.
  • A programming cable to allow the configuration of how big the bikes wheels are (for accurate speedo) and some other little tweaks for desired performance.
  • A front light which isn’t needed but is nice to have as it plugs into the motor and can be handily controlled from the Bafang’s LCD display.
  • A new 7 speed shifter was needed because the Bafang motor comes with new brake handles that have an electric switch inside which stops the motor when you brake. That meant the original integrated shifter and brake lever were no longer needed.

Installing the Bafang BBS02

As I eluded to before I ripped the bike apart to install the Bafang motor, the motor slips right through the bottom bracket and tightens up around it. Important to note here that the BBS02 comes in different bottom bracket lengths to suit your particular frame so be sure to measure the length of your bottom bracket before ordering a Bafang BBS02!

Once the motor was in and secured nice and tight with a good lathering of loctite (If you want to see the installation in more detail I recommend this video) I put an XT30 connector on the 6V light output so I could easily connect/disconnect it to the yet to arrive front LED light. I also trimmed the gear shift cable sheath to fit in the gear shift sensor, this sensor stops the motor when changing gears so the motor doesn’t end up accidentally throwing the chain off during gear changes.


Spot Welding The Battery Pack

My friend also wanted to get on board the e-bike train so I built two 13S3P packs. Starting with all the cells I separated them into groups of 3 (the 3 parallel cells) and hot glued them together to make spot welding easier. The same friend was able to lend me his very fancy spot welder which can easily be adjusted to do the perfect welds for the thickness nickel strip that you’re using.

I went through each set of three cells and welded a strip top (connecting all the anodes) and a strip bottom (connecting all the cathodes). After a couple sweaty hours of doing 26 sets of those (probably about 300 welds) the real sweaty work was about to begin; connecting each in series until we reach the final voltage desired.

This was extra scary work because the pack goes over the 50V threshold where skin’s resistance can no longer protect you from a nasty shock. I took this process slow and careful, covering up each previous series weld with a piece of plastic sheet as I moved onto the next to make sure if I dropped a piece of nickel or a tool it wouldn’t short out the battery and cause my early demise!


3D Printing The Battery Enclosure and Mount

I was going to purchase a nice injection molded battery enclosure but where’s the fun in that!? Particularly I had just finished building my 2 year long 3D printer project so I decided it would be a good chance to run it through it’s paces. The prints came out a little average looking as the 3D printer had some issues to due some parts that were shipped to me bent, however they were perfectly functional so I went ahead and used them.

You can download my designs to 3D print yourself from thingiverse. You’ll need a 3D printer with a 300mm cubed build space or get creative on how to split the model up to print it on a smaller printer. Keep in mind this enclosure is made specifically for a 13S3P 18650 pack spot welded in a configuration of three rows of thirteen cells stacked one on top of the other.


Battery Install and Wiring

The battery mount bolts into the bottle holder threads on the bike frame and for extra peace of mind also zip ties on to the frame. The battery handily slides on in until the XT90S connectors mate and consequently hold it in place very firmly. I threw the rats nest of wiring on the frame and did my best job to keep it clean with zip ties and electrical tape.

Following that I did my best rush job to tidy up all the wiring with electrical tape and zip ties. The motor has one large cable that goes to the front of the bike which has connectors for the LCD screen, the throttle, and two for each left and right brake (just like the gear shift sensor these stop the motor if you squeeze the brakes).


The Finished E-Bike

Throughout the whole build I was worried; Had I cheaped out on too many parts? Was the battery going to blow up? Will it look like a madman built it? Well all things considered (mainly how cheap everything was) I think it looks quite neat and wow it’s got some power! I can easily cruise around 50km/h (~30mph). As for the range, when I stay strictly on the throttle at full power I get about 15km’s (~9 miles). I know however this figure would be significantly more if I wasn’t treating it like a motorbike and relying largely on the throttle.

I had set out to replace my boring and expensive bus trips with a fun and speedy bike run to work and back and I certainly achieved that. During this current COVID-19 crisis it’s particularly great to avoid the bus so I couldn’t have put this bike together at a better time!


Finally in total, bike, motor, batteries, bits and bobs it came to $‭1,703.44 NZD (~$1100 USD). Which in my rough calculations I’ll pay off by biking to work for just one year, after that it’s sweet, sweet savings! Here’s a breakdown of that cost:

Giant 2020 ATX 3 Bike$449.99 NZD (~$295 USD)
Bafang BBS02B 48V 750W$783.73 NZD (~$513 USD)
39x Samsung 25R 18650 cells$256.67 NZD (~$168 USD)
Nickel strip 0.15*10mm 5 meters$‭21.65 NZD (~$14 USD)
13S BMS$27.39 NZD (~$18 USD)
Bafang gear shift sensor$30.50 NZD (~$20 USD)
Shimano M310 thumb shifter$20.85 NZD (~$14 USD)
Headlight LED 6V$17.31 NZD (~$11 USD)
54.6V 2A charger$‭19.39 NZD (~$13 USD)
DC barrel jack$3.16 NZD (~$2 USD)
LCD battery voltage meter$7.76 NZD (~$5 USD)
Silicon wire$8.55 NZD (~$6 USD)
XT90S connectors$6.49‬ NZD (~$4 USD)
1 meter heatshrink tube$5.73 NZD (~$4 USD)
Bafang USB programmer$18.11 NZD (~$12 USD)

If You Liked This

You might also want to check out my electric skateboard build.