Picture of DC Motor Controller for Electric Bicycle
I designed this controller for my Crystalite Sparrow 48V electric bicycle hub motor.  The core function of a DC motor controller is to periodically read the throttle setting and adjust the current being supplied to the motor.  It does this with a technique called pulse-width modulation or PWM (more on this later).  Other functions of the controller include:  1) low-voltage cutoff .. monitor the battery voltage and shut down the motor if the battery voltage is too low .. this protects the battery from over-discharge.   2) over-temperature cutoff .. monitor the temperature of the FET power transistors and shut down the motor if they become too hot .. this protects the FET power transistors.   3) over-current cutoff .. reduce the current to the motor if too much current is being supplied .. this protects both the motor and the the FET power transistors.  4) brake cutoff .. shut down the motor when the brake is applied .. this is a safety feature .. if the user applies brake and throttle, the brakes win.

Note1: This is a relatively advanced instructable.  Don't attempt it if you don't have experience with power electronics.  The voltages and currents used in this project can be dangerous and appropriate safety precautions must be used.  This instructable outlines what I did to make this project, but it is not a substitute for proper safety training in power electronics.  Check with your local community college for availability of classes in your area.

Note2: In addition to the 48V battery voltage, this controller requires a 12V power supply.  If your battery pack consists of 12V cells, then you can just tap 12V from the pack.  This was not possible for my battery pack, so I used a separate DC-to-DC converter to supply the 12V power.  See my other instructable on constructing this DC-to-DC converter.

Note3: This controller is over-designed for this application.  The IRFP4468 FETs are rated for a maximum of 195 Amps (each) at 100V.  This application will typically use less than 10 Amps at 50V.  I have been commuting (10 mile round trip) almost every day for the past 2 months using this controller and it has been trouble free (knock-on-wood :)
FreestyleR543 months ago

Why the MOSFETs need to be electrically isolated from the heatsink, in the schematic the Drain pins are connected together anyway..

To get better heat transfer

scd (author)  FreestyleR543 months ago
It is safer. Bicycles can vibrate and shake and it may be possible (for example) for the case to accidentally contacts the heat sink.
iwogan7 months ago

Will this controller work if use 36volts instead of 48?

scd (author)  iwogan7 months ago
This controller will work at either 36V or 48V since it does not do any low-voltage checks on the battery. I just manually check the battery before and after every ride and I my commute is short, so I never over-discharged the battery. However, adding a low-voltage check to the controller would be a good (and recommended) enhancement that would help protect the battery from over-discharging.
xmas1 year ago

I am totally blank on electric motor controller designs and i am looking for a multi-motor controller for my DIY electric bike & scooter. I was told I can use a stock controller with proper voltage and wattage (especially, wattage) to control two brushed motors for either bike or scooter. My goal is to use two low wattage hub motors (front and rear; kinda like all-wheel-drive) to drive an electric bike or scooter. your article gives me a close look into the construction of controller. thank you!!

khakhi1 year ago

is it single phase dc motor? can you send me its link.

GalFisk khakhi1 year ago

It is a single phase brushed DC motor. Brushless motors are more reliable in general, but demand a more complex controller.

scd (author)  khakhi1 year ago
It is a Crystalyte Sparrow.

ajvarath1 year ago

Good work...

I would also like to design a speed controller for 48 V/1000 W BLDC motor on a bicycle. I wanted to integrate Cruise control, few cut off functions, and be able to externally display velocity,voltage,rpm,etc. Would a PWM circuit works fine or should i use an Ardrino instead? I am an Electrical Engineering Tech student, but had done very basic microcontroller programming . How could i proceed?

scd (author)  ajvarath1 year ago
I used the free C compiler that comes with the Atmel AVR Studio software. I have not used Arduino, but I have heard that many functions are easier to implement because they have Arduino library support. You could do all the features that you listed using a simple 8-bit Atmel ATmega8, but you may also want to look at the newer 32-bit Arm-based microcontrollers which really don't cost much more than the old 8-bit controllers and they have more capabilities. I'm sure you will have lots of fun exploring. All the best !!

telesforo582 years ago
excellent for a greener world
rchan102 years ago
Hi, can you mind teach me how to choose a suitable motor to drive an e-bike. The weight that the motor can support is 100kg. So, how I am going to choose a motor that can support 100kg of weight?
scd (author)  rchan102 years ago
I weigh about 100kg and I use a non-geared hub motor that is rated at 750W. I still need to pedal on hills, but overall I find 750W is adequate. I suppose the answer depends on a) how much you want to pedal and b) how flat or hilly is the terrain in your area.
Nithin_T2 years ago
I was working on E-bike project using a 0.5HP (360W), 48V brushed motor (PMDC), so the current here will be around 8A or 16A while starting, with this circuit, will I be able to achieve speed control without burning the motor? If no, what will be the changes, especially in the motor driver part, which IC should I use.
scd (author)  Nithin_T2 years ago
To protect the motor from over-current, the controller needs to have a current limiter. I had planned to include this in the firmware, but never got around to it. The current limiter firmware would need to periodically read the shunt voltage and calculate the average current, and it this exceeds the maximum allowed current then the PWM would need to be shut down.
myshanks3 years ago
I am looking oout for a complete design and source code to controll a BLDC 250W motor for an e cycle project, battery could be either Lead Acid or Li-Ion of 24V with trottle control and Break cut off. Can any one help me. I am ready to pay professional charges for this project. My mail id is myshanks(at)gmail.com
koylum3 years ago
Which kind battery did you used. Ordinary lead acid battery or NMH or another type battery. And also I will ask the Power of the battery howmany Amper-Hour? And you said 10 miles trip every day is your way stright? You made agood job thanks for sharing this project
scd (author)  koylum3 years ago
I have had a few e-bikes which have used either "deep-cycle" lead-acid batteries or LiFePO4 Lithium Ion batteries. The deep-cycle lead-acid batteries are OK, but they are heavy and they don't take as many charging cycles as LiFePO4 Lithium Ion. I have found that a 10AH battery is adequate for my10 mile commute which is mostly-flat with a few small hills. I weigh about 200 lbs (about 90.5 kgs). I peddle while I ride, but I think the motor does more work than I do :)
wobbler3 years ago
Nice to see a design for this. How much current does the board itself take?
scd (author)  wobbler3 years ago
The prototype board is hand wired using 12AWG wire for the power sections so it should be able to handle 50 Amps or so. A printed circuit version would require using heavy (3oz) copper clad circuit board material and/or beefing up the traces by soldering wire in parallel with the high-current traces.

For handling really high currents in a DC motor controller, you should check out this instructable by Paul Holmes:

wobbler scd3 years ago
Sorry, I phrased my question badly. What I was asking about was the actual current used by the controller board electronics to run, not the current it is capable of controlling. Thanks.
scd (author)  wobbler3 years ago
I have not measured it, but it is small compared to the current supplied to the motor. The primary current consumers would be the 7805 regulator, the ATMega8, and the FET drivers. The ATMega8 data sheet states 15 mA max Icc. I do not have data handy for the 7805 or FET driver current consumption.
wobbler scd3 years ago
Thanks for this. I was just wondering if it was worth using a linear voltage regulator chip in the 78 series, but I see they are usually max. input of 35-40v so your dc-dc convertor looks like a more appropriate design.
scd (author)  wobbler3 years ago
This motor controller uses both 12V (for the FET gate drive) and 5V (for the ATMega8, etc.). I used a DC-DC converter (from my other instructable) to generate the 12V (from the 48V battery) and then I used the 7805 to generate the 5V (from the 12V input).
endload3 years ago
just so so.
profpat3 years ago
so this is not yet an instructable, but a concept yet on pwm motor controller! good design idea though!
dxr13ke3 years ago
Why do they need to be electrically isolated?
scd (author)  dxr13ke3 years ago
Because the case of the diode is electrically connected to its cathode and the case of the FET is electrically connected to its drain. If you don't isolate these from the electrically conducting heat sink, then you've just made a short from motor+ to motor- :)
dxr13ke scd3 years ago
One could use 2 separate heat sinks if one does not find the isolators.
dxr13ke3 years ago
Typo on the notes on image, bottom right: block instead of black
scd (author)  dxr13ke3 years ago
Thanks, I have fixed it .. :)
BobS3 years ago
You rode the bike for already 2 months, but say the software is not available!

Forgive me, but why then would anybody but a complete expert build this?
scd (author)  BobS3 years ago
The software is not available because I have only coded the basic PWM function. Other important functions (e.g. the battery under-voltage check and the over-current check) are not coded yet. So it's good enough for me since I know the limitations, but it is not good enough to post.