Design Your Own E-Bike Upgrade
I bike around pretty much every day around campus, and sometimes when it's really windy it becomes a pain to pedal against all the wind resistance. Anytime I'd have to expend a lot of energy to push through the wind, I thought about how much easier it would be if I had a motor to do the work for me, so I decided to convert my bike into an electric bicycle.
Supplies
Tools I used:
- Fablight Metal Laser Cutter
- Traditional Laser Cutter
- Bambu A1 3D printer
- Various hand tools
I recognize that many people won't have access to a metal laser cutter or a waterjet unless they are in university, however there are ways to get the needed metal parts.
A desktop CNC mill can be used to cut flat patterns and sprockets out of sheet metal, or it is also possible to order the parts online. A good website to take a look at is sendcutsend.com.
A 3D printer is extremely useful for this project. If you don't already have one/access to one, I would recommend the Ender 3 on the low end, costing about $100 from microcenter or ebay. On the middle end I would recommend the Bambu A1, and on the high end, the Bambu P1S or a Prusa MK4.
Materials I used:
- SuperPLA filament, TPU Filament
- 1/16" aluminum sheet metal
- 1/16" steel sheet metal
- Turnigy G160 brushless motor
- Turnigy 5S 8000 mAH Lipo
- Rhino 80A ESC clone
- Arduino nano
- Electric scooter throttle
- BEC 5V regulator
- Skateboard bearings
- Chain
The materials I used are a result of me having immediate access to them from spaces at my university, and I wanted to design around what I already had, as to not spend too much money on this project. The only thing I had to purchase at the end of the day was the electric scotter throttle. The result of me designing around sub-optimal materials is that I ended up having to spend more time figuring out the issues with the bike.
Math and Motor Selection
Speed
The first thing you need to know is how fast you want to go, and how large your bike wheels are.
RPM = Rotations per minute
MPH = Miles per hour
29 inch tire -> 11.6 RPM = 1 MPH
27.5 inch tire -> 12.2 RPM = 1 MPH
26-inch tire -> 12.93 RPM = 1 MPH
If I wanted to go 30 miles per hour, and I have a bike tire of 26 inches, I would need the wheel to spin 386 rotations per minute.
Motor Selection
I then start looking at suitable brushless motors, with the ratings that are most important to me being maximum power and KV. We are looking for a maximum power of about 1000 Watts or higher, and a decently low KV, something around 300 KV.
The size of the motor is also important. You want the motor to be as big as it can be, since the larger it is, the more heat it can dissipate. It is totally possible to do an electric bike modification with a tiny drone motor, as long as it can output the 1000 watts, but it won't be able to run for very long because it will heat up extremely quickly and burn out.
For brushless motors, the KV tells you how much RPM you will get based on the voltage. If a motor has 300 KV for example, and I power it with a 6S (6S stands for 6 cells, a cell is 3.7V nominal and 4.2V fully charged), it will be 25.2V * 300 KV = 7560 RPM.
It is also worth noting that there are two types of brushless motors that you can find, outrunners and inrunners. Inrunners typically have a very high KV, and as such need a lot of reduction, so for this project I used an outrunner.
Good places to purchase brushless motors are Innov8tive Designs, and Hobby King.
For now, the motor output RPM doesn't have to equal the target RPM, we'll be increasing the decreasing the RPM, and as such increasing the torque using a variety of methods later on.
Electronic Selection
Battery Selection
You want to select your battery based on your motor. the technical information for your motor, you should be able to find the power output at different cells. If not, you should be able to find the maximum current. You want to ensure that there's enough voltage to hit that 500-1000 watts range.
It is also fine to just select the battery that is the maximum that the motor is rated for. If you have too much power, you can always limit the throttle.
To decide the capacity of the battery you can do:
Battery Runtime (in hours) = Capacity (in amp hours) / Current (amps)
So a 8000 mAH battery is 8-amp hours, and if the current 80 amps, the battery will last 10 minutes.
This may seem short; however, it is important to note that a motor won't always draw its peak current, and once you're cruising, you draw significantly less power.
ESC Selection
In my case, I ended up using a clone of a Rhino 80A AM32 ESC. ESC stands for Electronic Speed Controller, and AM32 is the protocol. The other protocol that you might see is BLheli32 and Blheli_S. I would recommend AM32 always though, as it is open source, and BLheli32 has had some licensing issues recently, and since you need to connect to the internet to program Blheli32 ESCs, you might not be able to program one of those ESCs if it was manufactured recently.
It is best to select a speed controller that can handle 20A or more of your maximum current. I only used an 80A ESC since it is what I had on hand, but optimally I should have used a 100A or more ESC.
There are also VESCs, where are more suited for electric bikes/scooters, but are more on the pricy side. They are the best option for this use case, however.
Other Electronics
In most cases, you'll need a 5V regulator to feed into other systems, like other microcontrollers or whatever you use to control the bike. The throttle in my case needed a certain voltage, and the arduino I used needed 5 volts.
A BEC, or battery elimination circuit can easily handle this job. They are small and cheap and can be hooked up directly to the battery voltage.
You'll also need a throttle of some sort, you can purchase them off of Amazon. A bike throttle or scooter throttle will work fine.
Reduction
In almost all cases, the RPM output of the brushless motor will be significantly more than what you need. To get the motor to spin the wheel at a reasonable RPM, we need to utilize a reduction method.
There are 3 main types of reduction methods:
Gears:
- High transmission efficiency
- Less complex
- Cannot transmit torque over large center distances
- Compact
Chain:
- High transmission efficiency
- No sliding
- Good for long distances
- Often needs a chain tensioner
Belts:
- Smooth and quiet transmissions
- Lower transmission efficiency
- Slips on large loads
- Wears often
In my case, I decided to use gears as the primary reduction method and chain as the secondary reduction method.
In most electric bike cases, you'll see chains used for the last reduction method for the same reason that your bike uses a chain, because of the optimal torque transfer. Toothed belts also could be used.
The reason that you'll usually need two reductions is because of the fact that if you wanted to reduce something more than a 1:2 ratio, the sizes of your sprockets/gears will be extremely large.
If the RPM of your motor ends up being low enough, and you don't need a very large reduction, I would still recommend two reductions since you don't want there to be too much load directly on the motor, as in shocks from chain going directly into the motor.
Downloads
Mounting to the Wheel+sprockets
After figuring out reduction methods, you'll need to get a sprocket of some sort. In my case, I was able to use a metal laser cutter to cut out my sprockets, and then afterwards I sanded the tips down to triangles so that the chain would align more easily when rotating.
To mount the sprocket to your bike wheel, you'll need to design a hub of some sort. The way a lot of bicycle hubs work, is that one side slides behind the spokes, and the other side slides over the spokes, and you use through bolts to connect everything together, having the sprocket clamped onto the spokes.
Mounting Everything Else
The next step is to figure out how to mount everything else and how it will go together. Most bikes will have two holes somewhere on the frame or have a water bottle holder you can unscrew and reuse the threaded holes for. In my case, I used that for one of the mounts and designed a clamp mount to clamp somewhere else on the frame.
Something to consider is that the place where the clamp mount might go might not be a perfect cylinder, so you'll have to keep that into account.
Another way to go about doing it is to drill extra holes and put a bolt through it. This is the strongest way to do it.
An important note for 3D printed parts is that they should be printed out of an extremely durable material. In my case I used Overture's Super PLA, which has been holding up well. Some other options are ASA and CF Nylon.
After the mounting was done, I put two ball bearings into the large gear, and the fastened the small sprocket to the other side of the gear and put a long bolt through the gear and the mounting plates to connect everything together.
After this, I put the chain onto both sprockets and rotated the back wheel of the bike to rotate the chain on. You might have to take off your bike wheel for this to get the chain over.
Electronics
Electronics wise, you'll need to have a 5V regulator, often called a BEC, and that need to be connected to the power input of the Arduino. The output of the throttle does not interface with hobby ESCs, so an Arduino Nano is used as the intermediary between the two. The power and ground of the throttle are connected to the 5V of the Arduino Nano, and the green signal pin is hooked up to a digital pin on the Arduino.
Based on this, the Arduino can then output the appropriate PWM signals for the speed controller.
The BEC and the ESC itself need to be powered directly from the battery.
After all this is done, you can mount all the electronics to your bike. For mounting the battery, I used some sticky Velcro. I taped the rest of the electronics onto my bike using Kaptan tape.
If you decide to use a hobby ESC rather than a dedicated electric vehicle speed controller, you'll likely have to use an Arduino to negotiate the signals.
You'll also have to go into the settings of the ESC to turn off complementary PWM, which will make the motor brake the moment your finger goes off the throttle instead of coasting. You'll also want to turn off bidirectional control, because the motor should only need to spin in one direction.
You can do this if your ESC is AM32, BLheli32, or Blheli_s. For Am32, you can go to AM32.ca and do it through the website. For Blheli32 or Blheli_s, you'll have to install BLheliSuite32 or BlheliSuite respectively and modify it there.
If your ESC didn't come with the tool to connect it to your computer, you can use an Arduino Uno to do the same job.
Downloads
Test and Debug
The last step is to test your bike!
Here are some common issues and some suggestions on how to fix them:
Chain Skipping/Popping Off
This usually means that the chain isn't perfectly straight on the sprocket, so you'll have to check your mounting. It could also mean that the teeth of the sprocket and strong enough.
It could also mean that the chain is properly tensioned, and you might have to remove or add chain. If it is still too loose, you will have to add a chain tensioner.
Gears skipping
If your gears are skipping, it likely means either the gear is too squishy, or the mounting of the motor is poor. It could also mean the gears were not spaced correctly in the design.
Belt skipping
If you're using a belt for reduction, make sure to use a belt with very large teeth to decrease the chance of it skipping. If it still does, you will have to add a belt tensioner.
Bike can't start
This often means your gear reduction wasn't large enough, so it doesn't have enough starting torque. You might have to upgrade motors or increase battery cell count so the motor can output more power.
Wheel is spinning the wrong way
To change the direction the wheel spins, swap any two wires on the ESC
ESC is beeping and not going
If this happens, it either means it's not getting any signal at all, or it can't arm. The first thing you can try is connect the ESC to a servo tester, then seeing if it spins. If it's an arming issue, you'll need to make sure that the ESC is getting a 0-speed signal first. You can also do this with the servo tester by connecting it and putting it to zero.
Remember, always wear a helmet and ride safe!