Saturday, November 24, 2012

12-24v High Current Motor Speed Controller Part 1

 This 12V or 24V high-current DC Motor Speed Controller is rated at up to 40A (continuous) and is suitable for heavy-duty motor applications. All control tasks are monitored by a microcontroller and as a result, the list of features is extensive.

This high-current motor speed controller is based on a PiC16F88 microcontroller. This micro provides all the fancy features, such as battery monitoring, soft-start and speed regulation. it also monitors the speed setting potentiometer and drives a 4-digit display board, which includes two pushbuttons.

The 4-digit display board is optional, but we strongly recommend that you build it, even if you only use it for the initial set-up. it unlocks the full features of the speed controller and allows all settings to be adjusted.

The microcontroller will detect whether the display board is connected, and if not, the speed controller will support only the basic functions. in this simple mode, it will function as a simple speed-regulated controller with automatic soft-start and with the speed being directly controlled by a rotary potentiometer (VR1). All the other settings will be the initial defaults or as last set (with the display board connected).

When connected, the 4-digit display allows you to monitor the speed and the input voltage (useful when running from a battery). it also enables you to navigate through the various menus to adjust the settings.

The circuit can run from 12V or 24V batteries and can drive motors (or resistive loads) up to 40A. Furthermore, this is our first DC speed controller (except for train controllers) incorporating speed regulation under load. in other words, a given motor speed is maintained, regardless of whether the motor is driving a heavy load or not.

Monitoring the back-EMF
in speed controllers which do not have good speed regulation (ie, the vast majority of designs), the more a motor is loaded, the more it slows down. In order to provide speed regulation, the circuit must monitor the back-EMF of the motor, since this parameter is directly proportional to its speed.

12-24v High Current Motor Speed Controlle
As a result, this speed controller monitors the back-EMF of the motor. ‘Back-EMF’ is the voltage generated by any motor to oppose the current through its windings. EMF stands for ‘electromotive force’ and is directly proportional to the motor speed and so by monitoring this parameter, we have a means of controlling and maintaining the motor speed.

In practice, the main control loop of the microcontroller tries to match the speed of the motor (back-EMF) to the speed set by the pot or a value recalled from a preset memory. If the measured speed is lower than the set speed, the duty cycle of the pulse width modulation (PWM) signal used to drive the power MOSFETs that control the motor is gradually increased. In other words, if the speed tends to drop, more power is fed to the motor
and vice versa.

The frequency of the pulse width modulation can be set from 488Hz to 7812Hz. This is a useful feature, since different motors will have different frequency responses, as well as different resonant frequencies. It is important to reduce the audible buzzing from the pulse width modulation, as these frequencies are well within the range of hearing.

Window of opportunity
By now, you’re probably wondering how the microcontroller monitors the back-EMF of the motor, considering that the motor is continuously driven with pulse-width modulated DC. The answer is that the micro periodically turns off the PWM signal to the motor for just enough time for the back-EMF to stabilise.

This ‘window’ needs to be wide enough to ensure that we are measuring back-EMF and not the spike generated by the last PWM pulse. On the other hand, we don’t want the window so wide that the maximum power to the motor is significantly reduced or that the motor noticeably slows.

The compromise value is that the motor is monitored for 200m s every 7.4ms (ie, about 135 times a second), as shown in the scope screen shots in Fig.3 to Fig.7. As a result, the fact that we do monitor the back-EMF around 135 times a second means that the power applied to the motor is slightly less than the theoretical maximum, although this effect is negligible.

A low-battery alarm is also incorporated to warn when the battery level drops below a preset value. This is especially useful for applications like electric wheelchairs.

There are also eight memory speed settings. All settings are persistent, meaning they are retained in nonvolatile memory.

When the motor is switched off, perhaps by an external switch in series with one of its terminals, the voltage at the drain (D) of the MOSFETs will be 0V (this is due to the voltage divider used to scale the back-EMF voltage to within the operating range of the microcontroller). The microcontroller converts this analogue value to a digital value using an on-board ADC (analogue-to-digital converter).

The firmware detects this 0V condition and sets the duty cycle of the PWM to 0%. This ensures that when the motor is switched in, its speed will increase gradually from the stationary state to the desired speed setting.

Turn-on currents for motors can be very high and it is desirable to reduce these surge currents as much as possible. That is why the automatic softstart feature has been incorporated into the firmware. It will ensure that the motor is brought up to the set speed gradually.

Fast switch-off feature
Another feature that has been incorporated into the firmware is the so-called ‘fast-off’ feature. This means that the duty cycle of the PW modulation is set to 0% (turning off the motor) whenever the selected speed setting of the pot goes to 0%. Rather than decreasing the speed gradually, setting the pot to its lowest setting turns the motor off immediately.

This design also incorporates our extensive experience with previous speed controllers. As a result, it uses four high-current MOSFETs to do the switching (pulse width modulation), uses very wide tracks on the PC board and heavy-duty (40A) terminal blocks to carry the large currents.

User interface
Two pushbuttons on the display board are used to navigate through the menus, while the potentiometer (VR1) is used both to vary the speed and to vary certain settings.

The two pushbuttons are sensitive to two types of presses, short and long. A short press is of the order of half a second or less, while a long press is around one second.

To change a setting, a long press is usually needed. This prevents unwanted changes to the settings, which are stored in EEPROM and thus recalled at the next switch on. Because of the capabilities offered by the PIC microcontroller, we have been able to incorporate a large
number of features into the firmware, as described in the separate panel later.

Circuit description
The circuit for the speed controller is shown in Fig.1. As noted previously, it can work with 12V or 24V batteries, but has been optimised for operation at 24V. Within the circuit itself, there are two separate voltage rails: +5V for the microcontroller and +16V for driving the gates (G) of the MOSFETs. Both are derived from the +24V input supply.

The main input supply is filtered by a 2200uF low ESR capacitor, to minimise highvoltage transients which can be produced by the inductance of the battery connecting leads. This capacitor is absolutely vital to the proper operation of the speed controller at high currents.

Power switch S1 and diode D1 protect the lowpower part of the circuit (IC1 and IC2) from reverse polarity. A 22W 1W resistor, a 33V 5W Zener diode (ZD7) and a 100n F capacitor also protect the MC34063 DCDC converterIC from transients on the supply rail. 

The filtered supply is fed to the MC34063 (IC2), which operates in a standard step-down converter configuration to provide the +5V rail. Three 1W resistors between pins 6 and 7 are used to set the maximum switching current. The output voltage is set by the voltage divider associated with trimpot VR2. Only about 200mA is ever drawn from this supply, and most of this is used to drive the display.

IC1 is the heart of the circuit and is the popular PIC16F88 microcontroller, which incorporates a number of peripheral functions. Of these, the timers, hardware PWM (pulse width modulation) and three ADC inputs are used.

The three ADC inputs used are at pins 1, 2 and 18. As these need to be within the 0V to 5V range, voltage dividers consisting of 33kW and 4.7kW resistors are used to scale both the input voltage rail (which could be as high as 29V) and the backEMF from the motor, to be fed to the ADC inputs at pins 1 and 18. The ADCs convert the monitored voltages to 10bit values.

Gate driver
The +16V rail is used as the gate drive supply for the MOSFETs and is derived from the 24V supply via a 1kohm resistor and a 16V 1W Zener diode (ZD1). Bypassing of this rail is particularly important and is accomplished using 100uF and 100nF capacitors near ZD1 and adjacent to the transistors Q1 and Q2.

If the battery supply is to be 12V, the 1k ohm resistor feeding ZD1 should be reduced to 100ohm. In this case, the supply will actually be between 12V and 14V (depending on the actual battery voltage); still enough to provide adequate gate drive for the MOSFETs and ensure minimum heat dissipation (low onresistance).

The PWM output of the PIC16F88 (adjusted by firmware) appears at pin 6 and drives transistor Q3, which then drives complementary transistors Q1 and Q2. Transistor Q1, Q2 and Q3 thus provide buffering and voltage level translation for IC1’s PWM output to drive the gates of MOSFETs Q5 to Q8, via 15ohm resistors.

Note that these resistors need to be relatively low in value (ie, 15ohm) in order to ensure quick charging and discharging of the gate capacitances. That’s because the gate capacitance of these MOSFETs can be quite high, of the order of 5000pF to 10,000pF each. If the gate charging time is too long, the MOSFETs will spend too much time between the on and off states and this will lead to much higher heat dissipation.

In fact, the gate voltage transitions need to be very fast, of the order of 1m s or less. This has been accomplished, as shown by the oscilloscope screen grab of Fig.4.

The specified MOSFETs are from International Rectifier, type IRF1405. This is a 55V 169A N-channel HexFET with an exceptionally low on-resistance (Rds) of 5.3 milliohms (5.3mohm) typical. Their pulse current rating is a stupendous 680A.

The IRF1405 is specifically intended for automotive use, in applications such as electric power steering, anti-lock braking systems (ABS), power windows and so on, and is therefore ideal for this speed control application.

Why four MOSFETs?
In fact, since the ratings of this MOSFET is so high, you might think that just one device on its own would be enough to handle the 40A rating of this speed controller project. So why are we using four MOSFETs in parallel?

As always, real world use brings us down to earth. For a start, we are using these MOSFETs without heatsinks, apart from the heatsink effect of bolting them to the copper side of the PC board – not much heatsink benefit there. Their thermal characteristic is 62°C per watt (junction to ambient), if they are mounted in free air (which they are not).

Assuming an ambient temperature of 25°C and an on-resistance of 10mohm (conservative), we can approximate the temperature of the MOSFETs at their highest operating current (10A per MOSFET for a total of 40A). At 10A and 10m ohm on-resistance, the power dissipated is: 10^2 × .01 = 1W Therefore, the temperature of the case will be approximately: 25 + 62 × 1 = 87°C

This means that at full current, the MOSFETs will be very hot to the touch. Careful: they will burn you. Our measurements produced a top temperature of around 77°C after a test period of half an hour.

In practice, even with much higher ambient temperatures, the MOSFETs should not get quite this hot because in ‘real world’ operation, the speed control is not likely to be providing full power to the motor on a continuous basis. At 24V and 40A, the motor would have 960W applied (ie, more than 1HP) and this equates to relatively high power operation.

Zener diodes ZD2 to ZD5 are included to protect the MOSFETs from excessive gate voltages. In normal circuit operation, these Zener diodes do nothing.

Additional protection for the drains of the paralleled MOSFETs is provided by 33V 5W Zener diode ZD6, in parallel with a 100nF capacitor. The Zener is there to clip any residual voltage transients which get past the 2200uF low-ESR input filter capacitor.

The MOSFETs are further protected by fast-recovery diode D3 and its parallel 220nF capacitor. These parts are wired across the motor terminals and are used to suppress the high back- EMF spikes caused by the armature inductance when the motor is switched off by the MOSFETs.

These components are crucial to the operation of the speed controller. Without them, the high voltages generated can and probably would destroy the MOSFETs.

Note: In above text where you find 'W' with resistor values, its actually Ohm not watt; mistake, sorry for that. 


  1. Hi
    Muhammad Zohaib,
    Have you really tested this application under the heavy loads????
    If yes.
    What was the result????
    Did the circuit work???
    I am afraid, the circuit will not work under the heavy load like electric bikes.