Introduction: How to Make a Lithium Battery for an Electric Bicycle

Electric bicycles use batteries made from lithium ion cells. One of the most common types is a cylindrical cell called an 18650 cell, named so because it is 18 mm in diameter and 65 mm long. I'll show you how you can create your own DIY electric bicycle battery from these cells for much less than the cost of a retail ebike battery.

It's actually quite easy, and because the prices for these cells get even better when you buy more of them, I often buy an extra large pile of cells and just make extra batteries to sell locally. That way the batteries I make for myself end up being free!

To make your own electric bicycle lithium battery you'll need the following, and more details about each are included below:

Lithium 18650 cells

All lithium-ion cells are 3.7V, and you'll need to wire them in series to get the correct total voltage for your ebike battery, and in parallel to increase the capacity. There are a bunch of different cells on the market, each with their own advantages and disadvantages. I used Panasonic 18650pf cells in this battery, which are 2.9AH each and can deliver a maximum of 10A continuously. If you want a little more capacity, you can go with Sanyo 18650GA cells that are 3.5AH each and also provide 10A continuously. If you don't need as much power though, the most economical cell is the Samsung 26F cell, which is 2.6AH and can provide about 5A continuous. The Samsung cell is better for ebikes that don't need as much of a high power battery. Most of my ebikes use Samsung 26F cells because I like to build packs with larger capacities and use them on medium power ebikes. Just remember that because they can only provide 5A continuous per cell, you might need to use more of them in parallel. For example, in a 30A continuous pack, you'd need at least 6 cells in parallel.

I get my cells from Aliexpress, where payment to a vendor is held in escrow until you receive your goods and confirm that the goods match the description. I prefer it better than ebay, because this way I know my money is safe and I can get it back if I have an issue with a seller. But I only use reputable sellers of battery cells, like those linked above, so I haven't had an issue with cells yet.

Battery Management System (BMS)
You'll need a BMS to monitor your cells during charging and discharging. Basically it protects the cells from getting drained too far or getting overcharged. When choosing a BMS you need to match two main factors: voltage and current rate (more important for discharge than charge current). If you are building a 36V battery, you'll need a 36V BMS (or usually called 10s, meaning 10 cells in series) to match your battery. A 48V battery uses a 13s BMS and a 52V battery uses a 14s BMS. Just make sure you choose a BMS configured for the same amount of cells as the battery you are building. Also remember to check the discharge current. If you want your battery to be able to handle 20A continuously, choose a BMS that is rated at least 20A, and higher is better to give you a safety buffer.

Spot Welder

You really need to use a spot welder to make a lithium battery out of 18650 cells. It is technically possible to solder the cells together, but it creates a lot of heat on the end of the cells that can damage them and prevent them giving their full capacity. I have a few different inexpensive spot welders. Even with the price of the spot welder, your DIY lithium battery is likely to end up costing less than a retail ebike battery. Plus you can make a few more batteries and sell them! I got all of my spot welders from Aliexpress for the same reason as my cells - because I know I'll get a good product or my money back! I like to use a fairly simple spot welder without hand probes which I got on sale for about $150, but I've also had good experiences with the 709 series welders and others that have extra hand probes, though they cost a bit more.

A friend of mine wanted to build his own battery but didn't want to invest in a spot welder. He ended up buying one, building his battery and then selling the spot welder for more than he paid for it on ebay, since they are pretty rare in the US. Whatever works for you!

Nickel strip

You'll use nickel strip to join your cells together. Make sure you get 100% nickel strip and not nickel plated steel, which is cheaper but has much higher resistance. Be careful, some vendors try to sell nickel plated steel strip as real 100% nickel strip since it is nearly impossible to tell. To ensure you received genuine 100% nickel strip you can either use the spark test or the salt water test as described here.

Heat shrink tube

You'll need some large diameter heat shrink tube to seal your battery. I picked up some 10 meter rolls of many different sizes of heat shrink tubing from 110mm all the way up to 300mm. You can get it by the 1 meter length though if you aren't building as many batteries as I am.

The rest of the parts and tools you need are smaller and I've covered them in the following steps.

Step 1: Determine the Size and Shape of Your Battery

I wanted to make my battery fit inside this under-seat bag. I also wanted the battery to be 36V, meaning I'd need 10 cells in series. This limits me to multiples of 10 cells.

To see how many cells I could fit in that bag, I laid it on a piece of paper and traced the outline. Then I just started putting cells on the paper within the drawing until I couldn't fit anymore.

It turned out that I could get 30 in there, but 40 was going to be too much. So I settled on a 30 cell battery, meaning 10 cells in series and 3 in parallel for a 36V 8.7AH pack (2.9AH per cell x 3 cells = 8.7AH). This was going to be a nice small pack for a lightweight folding bicycle and should be good for about 20 mph and a little under 20 miles of range.

To mark approximately where the cells would go in the battery, I removed each cell from the paper one at a time and drew a circle in its place. This would help me with the wiring diagram in the next step.

Step 2: Plan Out the Order and Wiring of Your Cells

Next I colored every other group of 3 cells darker to differentiate the parallel groups. The dark circles represented positive ends of the cells and the white circles represented negative ends of the cells. Each group would have 3 cells wired in parallel (positive ends together and negative ends together).

To decide the order of the cells, I simply started at the small end of the bag and named the first set of 3 cells "group 1". Then I drew a line connecting the top (positive) of those cells to the negative of the cell group sitting next to them. That's why half the cells are upside down, so that the positives and negatives of adjacent groups can be connected in series.

I then continued, making sure each successive group of parallel cells was connected to the next, positive to negative and negative to positive.

It is important to keep track of your connections as you draw them. On the opposite side of the paper I traced the circles and colored them opposite to front side of the paper - that way it was like a real-life model with positive ends of cells on one side of the paper and negative ends on the other. If the positive and negative of two parallel groups was connected on one side of the paper, I made sure not to connect them on the other. Otherwise that would have resulted in a short. You really want to avoid that. Shorted battery cells will heat up quickly and can catch fire or explode.

The final connection went like this:

1- connected only to itself

1+ to 2-

2+ to 3-

3+ to 4-

4+ to 5-

5+ to 6-

6+ to 7-

7+ to 8-

8+ to 9-

9+ to 10-

10+ connected only to itself

Step 3: Check That All Cells Are Equal Voltage

This step is very important! You'll need to ensure that all the cells you plan to use are the same voltage. They can be +/- a couple hundredths of a volt, but more than that and you'll have a pretty good amount of current flowing through them trying to equalize them when you connect them in parallel.

If you have brand new cells straight from the factory, they should all be basically identical. All of my cells read 3.63V except for one cell which read 3.59V. That's probably still a decent cell, but the fact that it has self discharged somewhat meant that it wasn't quite up to the standards as the others, so I replaced it with another cell that was identical to the rest. I can still use that cell in other projects in the future, especially lower power ones - I just don't want to risk putting a cell that might have an issue into a larger pack with a bunch of perfect cells.

Step 4: Start Hot Gluing and Spot Welding Your Cells

Now you are ready to start putting your pack together. Depending on the size and shape of your pack, you'll either start by welding or hot gluing. The first parallel group in my pack was arranged in a triangle, so I started by gluing the cells together, then spot welded them.

I put about 6 or 8 spot weld points on each cell for each layer of nickel strip. The nickel strip I used is 7mm wide and 0.15mm thick. I had at least 5 pieces of nickel strip connecting each group in series so that there was a lot of material for the current to flow through. Some people connect all of their cells in parallel and then just use a single strip of nickel to make the series connection but this is a bad idea. It results in all of the current trying to cram its way through a single, thin piece of nickel. It's better to put many strips of nickel stacked on top of each other for the series connections. Think of it like a road. A single strip of nickel is like a one lane street, and 5 pieces of nickel stacked on top of each other are like a 5 lane highway - the highway can handle a lot more traffic zipping along it!

The welding arms on my spot welder can only reach about 2-3 cells deep in a pack, so I only glue a couple parallel groups onto the pack at a time, do the welds, then glue more on. If you have a welder with handheld probes then you can actually glue the whole pack together from the beginning and then weld it all at once.

Step 5: Continue Welding Your Cells

Continue gluing and welding your cells until you reach the final group. In my case, I would put the entire pack onto my paper template after each parallel group was added just to confirm that I was maintaining the shape that I needed.

If you use a square shape, this will be much easier as the cells will line up naturally and you won't have to keep checking to make sure your pack stays within its planned shape.

After I finished all of my welding, I found that my cells did fit in the bag, but it was really tight, and I still had to add some foam and heat shrink before it would be finished. To account for this, I decided to rearrange my pack just slightly. I removed two of the cells from group 9, which was the battery's widest part near the rear of the battery, and I moved them to the absolute rear of the pack where I had more room left. On one side of the pack I could still weld these directly to last group (group 10), but on the other side I didn't have a straight shot, so I used a short length of thick wire soldered to the nickel already welded to the cells.

Step 6: Prepare Your Connectors for Charging and Discharging

I like to prepare my connectors before I add them to the battery. This way I have less chance of shorting the pack on accident. For the charging connector I chose RCA connectors. I use a female on the battery and a male on the charger.

For making the female end on the battery I've developed this neat trick of actually using mono to RCA adapters because it gives me a female RCA connector with a lot of soldering surface and makes a rigid, strong connector.

I used 16 awg silicone wire for the charger connectors and held the wire and connector in a helping hands device, which just makes the soldering easier. I started by soldering the positive wire to the end of the mono adapter, then covered it with heat shrink. Next I soldered the negative wire to the long barrel of the mono adapter and covered the whole connector with heat shrink.

I apologize that I forgot to take pictures of adding the discharge connector, but I just used Anderson PowerPole connectors crimped onto the end of 12 awg wires.

Step 7: Connect Wires to the BMS

I like to add my wires to the BMS before I connect the BMS. There are 3 wires that need to be soldered onto the board: the C- (charging negative), P- (the pack's negative, i.e. the negative wire that will exit the pack and plug into your controller) and B- (the battery's negative, i.e. the negative end of the first parallel group of cells).

I soldered all three of these wires to the board after checking to make sure that I had cut the wires long enough. I used 14 awg silicone wire for the B- and P- connections.

Lastly, I wrapped the entire BMS in polyimide high temperature, non conductive tape and then hot glued it to the pack with a thin piece of foam underneath. The foam gives a small amount of shock protection and the tape and foam together ensure there won't be a short between the bottom of the board and cells if the heat shrink were to ever break on the cells.

Step 8: Add BMS Connections

Next I soldered all the little cell wires (10 in all) for the BMS. Each one is marked 1+ through 10+ so you know where to solder each one. Note that I soldered them to the nickel plate in between cells and not right over a cell. This helped keep as much heat out of the cells as possible - you don't want to heat the cells themselves if you can avoid it.

Anywhere I had wires running over cells, especially the ends of the cells with exposed nickel strip, I used the non conductive tape to create a barrier, just in case.

After the cell connections were complete, I then added the main charge and discharge wires. The P- from the BMS goes out to the discharge connector for the pack while the B- gets wired to the negative end of the first cell group. The thick red wire is soldered to the positive end of the 10th cell group and exits the pack along with the P- wire to the discharge connector.

Again, I tried to do all of my soldering in between cells on the nickel strip to avoid heating the cells themselves.

Step 9: Wrap Your Pack in Foam

Some battery builders skip this step but I think it is important. I use a thin foam layer to surround my cells and give them a bit more padding and protection. I usually use a 2mm thin sheet of foam but on this pack I decided to use an even thinner 1mm sheet of foam because it was already going to be a tight fit. I cut the foam to the approximate shape of the pack, leaving the foam a bit long on all sides so that it will end up being two layers thick on the corners - the areas most likely to receive jostling and impacts.

I used my same heat resistant tape to seal the foam - it doesn't have to be pretty.

Step 10: Add Heat Shrink

Now it's time to finish off your battery with some professional looking heat shrink. Most heat shrink will shrink to about 50% of its normal diameter and about 10% of its length, so keep this in mind when sizing the right size heat shrink for your battery. The method I use to calculate the right size is to measure the perimeter of the pack in whichever direction I will be surrounding it, then use that number to calculate the size heat shrink tube that I need, which will end up being anything between that number and twice that number, with the sweet spot being somewhere in between.

It's fairly simple in practice. For example, my first piece of heat shrink tubing I used went around the pack I made in the long direction. I measured the pack and found the perimeter of that shape to be about 42cm. Heat shrink tubing is normally measured by the diameter, but really big heat shrink tubing like this is often measured by the half circumference instead because it comes flat, not round like small heat shrink tubing for wires. So if the perimeter of my pack is 42 cm, and the heat shrink will shrink to half of its size, that means I need a heat shrink section with a half perimeter of between 21 and 42 cm (though it's better to stay away from the extreme ends of that range so the heat shrink doesn't end up being too tight or too loose. I ended up using 26 cm heat shrink for this piece.

For any piece of heat shrink that is slipped around the sides of the pack, meaning it runs 90 degrees to the direction of the cells, I cut it 11 cm wide. This 11 cm has proven to be the magic number that gives it enough overhang at the tops and bottoms of the cells to wrap around them but not too much that you get extra floppy material that has to be cut off.

You should use a heat gun on the heat shrink tube, but make sure you don't turn it up too high or you can actually burn or melt the heat shrink. My heat gun is quite powerful and so I often use my wife's hair dryer on high which works great for heat shrink tubing!

After your first piece of heat shrink tubing, you'll likely want to add a second piece going in another direction to cover the ends of the pack. For my pack, the circumference at the widest part was about 35 cm, and so I used 190 mm heat shrink for this section.

Step 11: Optional -- Add a Handle

I wanted to make sure it was easy to remove the battery from the bag even with a tight fit, so I added this handle to the pack. I laid some 1" nylon webbing around the pack to form a circle and added a little extra to allow me to fit a few fingers into the handle.

I marked the overlap and took it over to my sewing machine. I picked up this cool beginner sewing machine that has proven to be super handy - I'm using it for all sorts of projects that I wouldn't have expected - like in battery building! I'm still a beginner on my sewing machine but I think the stitching came out pretty well and it felt plenty secure.

I placed the loop around the battery and hot glued it in place on three sides, leaving a handle formed at the back end of the battery.

I should have incorporated a piece of heat shrink tubing into the loop before I sewed it, but I forgot, so I had to think of a good way to cover the small end of the pack. I first tried to use a small piece of heat shrink tubing but it wouldn't stay in place since it was on a wedge shape and just slid down the pack as it shrunk, ultimately falling off the tip.

Instead, I had to cheat a bit. I developed this method for when I want to get heat shrink onto a wedge shape but just can't get it to stay by itself. First I cut a piece of heat shrink tubing sized to cover the small end of the pack and extend almost all the way to the large end of the pack. Then I glued it in place at the far ends so it wouldn't slip back down. Then I slide a piece of heat shrink tube over it and heated that in place. When that piece shrunk down, it locked the piece of heat shrink under it, keeping it firmly in place. Lastly I applied heat to the tip of the battery and that piece of heat shrink I had originally cut to place there sealed the end of the battery, covering the nylon strap at the tip and stayed in place due to the heat shrink above it holding it tightly.

Step 12: ...And That's It!

That's everything! I test fit the battery and it slid in the bag nice and snug. The little door at the back covers the connectors and allows me to access them without removing the battery each time.

I hope you found this helpful and feel free to ask any questions in the comments below!

If you'd like an even more detailed writeup, I created a how-to article here, and I also made a video on youtube that shows this whole process on a different shaped battery here.