DC Motor Controller for Electric Bicycle

por
Em Destaque
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 :)

Passo 1: Parts List

Here is the parts list (with Digikey part numbers) for all the electronic parts.

You will also need:
a) a prototype circuit board (the one I used is from a local electronics surplus store)
b) wire.  I used 30AWG wire for the low current connections and 14, 12 and 10AWG wire for higher current connections.
c) 1/8" heat shrink tubing (about 2" in length)
d) two 6-32 x 1" screws
e) 4 x insulating pads for the FETs and power diodes (these can be salvaged from a broken PC power supply)
f) a heat sink for the power section.  (this can be salvaged from a broken PC power supply)
g) an enclosure.  (this can be salvaged from a broken PC power supply)

The following tools are required:
a) a programmer for the microcontroller.  I used an AVR ISP programmer (check EBay)
b) a soldering iron (and solder of course)

The following tools are recommended for debugging:
a) a digital multimetter (DMM) for checking connections, etc.
b) an oscilloscope is handy for checking the PWM waveform, etc.

Post a comment
Be nice!

Nós temos uma política de comentários em que todos devem ser gentis.
Por favor, seja positivo e construtivo.

xmas
xmas diz: Jul 29, 2014. 7:36 AM

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!!

khakhi
khakhi diz: Jul 2, 2014. 7:56 AM

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

scd
scd diz: Jul 2, 2014. 8:15 AM
It is a Crystalyte Sparrow.

http://www.electric-scooters-info.com/Crystalyte/crystalyte-sparrow-electric-bike-kit-review.html
GalFisk
GalFisk diz: Jul 24, 2014. 5:53 AM

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

ajvarath
ajvarath diz: Mai 18, 2014. 2:54 PM

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
scd diz: Mai 18, 2014. 5:39 PM
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 !!

Regards,
Scott
telesforo58
telesforo58 diz: Jul 18, 2013. 7:02 PM
excellent for a greener world
rchan10
rchan10 diz: Jun 12, 2013. 6:09 AM
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?
Thanks...
scd
scd diz: Jun 12, 2013. 7:38 AM
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_T
Nithin_T diz: Mar 17, 2013. 7:28 PM
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
scd diz: Mar 18, 2013. 1:11 AM
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.
myshanks
myshanks diz: Fev 7, 2012. 12:39 AM
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
koylum
koylum diz: Jan 7, 2012. 5:37 AM
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
scd diz: Jan 7, 2012. 12:01 PM
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 :)
endload
endload diz: Nov 27, 2011. 4:41 AM
just so so.
profpat
profpat diz: Nov 27, 2011. 2:38 AM
so this is not yet an instructable, but a concept yet on pwm motor controller! good design idea though!
dxr13ke
dxr13ke diz: Nov 26, 2011. 6:49 AM
Typo on the notes on image, bottom right: block instead of black
scd
scd diz: Nov 26, 2011. 10:41 AM
Thanks, I have fixed it .. :)
dxr13ke
dxr13ke diz: Nov 26, 2011. 6:47 AM
Why do they need to be electrically isolated?
scd
scd diz: Nov 26, 2011. 10:32 AM
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
dxr13ke diz: Nov 26, 2011. 12:05 PM
One could use 2 separate heat sinks if one does not find the isolators.
wobbler
wobbler diz: Nov 26, 2011. 1:17 AM
Nice to see a design for this. How much current does the board itself take?
scd
scd diz: Nov 26, 2011. 10:03 AM
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:

http://www.instructables.com/id/Homemade-100-HP-Motor-Controller-for-an-Electric-C
wobbler
wobbler diz: Nov 28, 2011. 2:19 AM
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
scd diz: Nov 28, 2011. 10:05 AM
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
wobbler diz: Nov 29, 2011. 8:48 AM
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
scd diz: Nov 29, 2011. 12:57 PM
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).
BobS
BobS diz: Nov 25, 2011. 8:27 PM
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
scd diz: Nov 25, 2011. 9:54 PM
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.