Introduction: Designing a Dual 40A PWM Speed Controller for Brushed Motors

This is a step-by-step Instructable of how I designed a Dual 40A PWM Speed Controller for two brushed electric motors.

Please note that this was my first H-Bridge that I have build, and the design might not be ideal. I would love to hear from more experienced persons where I made errors and/or omissions.

If you like this Instructable, please vote for me in the Circuits Contest.

INSTRUCTABLE AND FILES UPDATED ON 6 November 2016

Thank you all for the positive remarks and assistance received. I have updated the Instructable, and added some calculations regarding the MOSFET switching voltages and driving transistors. See Step 7 & 8.

Some of the changes made due to user's comments are:

  • Faster MOSFET turn-off times (reducing R1 - R4 values)
  • Gate voltage reduced from 24V to around 16V (introduced a voltage divider on Gate of MOSFETs)
  • Recalculation of MOSFET switching resistors (Step 7 & 8 added for more clarity)
  • Additional control signal protection (can no longer switch between FORWARD & REVERSE without first turning of the H-Bridge outputs. This is done in the PIC 12F675, and new firmware was added under step 15.)

Step 1: Basic Design of the H-Bridge

The H-Bridge will be a high current bridge, thus the design will be done using MOSFET transistors.
The bridge consists of four transistors, Q1 - Q4.

Q1 and Q3 forms the positive leg of the bridge and are P-channel MOSFETs. To turn on Q1 or Q3, the Gate voltage must be about 10V lower than the Source voltage, which is connected to +24V.

Q2 and Q4 forms the negative leg of the bridge and areN-channel MOSFETs. To turn on Q2 or Q4, the Gate voltage must be about 10V higher than the Source voltage, which is connected to 0V.

Switching on Q1 and Q4 with Q2 and Q3 turned off, will cause current to flow through then, and apply +24V to terminal M1, and 0V to terminal M2. The motor will turn forwards.

To change the direction of the motor, Turn off Q1 and Q4, and switch on Q2 and Q3. +24V is now applied to terminal M2, and 0V to terminal M1. The motor will now turn in the opposite direction.

Step 2: Adding Back-EMF Protection

It is always a good idea to protect the H-Bridge from back-EMF using fly-back diodes. Some MOSFET transistors already have build-in diodes, but the best design will also include additional fly-back diodes.

Diodes D1 - D4 are placed across the Drain-Source of the MOSFET transistors to protect them from back-EMF. Fast switching diodes are required, and should be either fast recovery or schottky diodes.

Step 3: Making the H-Bridge Failsafe

Resistors R1 to R4 are used to force all the MOSFET transistors off. With no input to the Gate of the MOSFET, these resistors will ensure that they do not switch on. As the MOSFET is a voltage controlled transistor, no Gate current is needed. For the design, I opted for 1K resistors. The smaller this resistors, the faster the MOSFETs can switch on and off. Switching time is a determined by the charging time of the Gate capacitance. Thus, the smaller the resistor, the faster the switching time.

R1 and R3 pulls the Gate of Q1 and Q3 to +24V, turning them off.

R2 and R4 pulls the Gate of Q2 and Q4 to 0V, turning them off.

Now, with no control signals connected to the H-Bridge , or in the event that connections to the H-Bridge are compromised, the relevant MOSFET will be turned off.

Step 4: Add Noise Suppression

Capacitor C1 can be placed across the motor terminals M1 and M2. Some motors already have a capacitor connected on the motor itself.

C1 does two things. First, it suppresses noise caused by the motor, and secondly, limit the rate of change of the voltage (Dv/Dt) across the motor terminals.

Step 5: Identify High Current Paths

The next step in the design is to identify the paths where high motor current will flow. This will assist later in the design of the PC Board.

Connections to these paths must be made as short and thick as possible to reduce heat caused by the motor current. It will also identify the components which should be placed as close as possible to each other.

Identified components are:

  • Q1 to Q4
  • D1 to D4
  • Supply terminals (+24V and 0V)
  • Motor terminals (M1 and M2)

Step 6: Selecting H-Bridge Components

The component selection depends on the supply voltage and load current of the motor that will be connected to the H-Bridge. Specifications for this design are as follow:

  • Motor voltage: 24V DC
  • Motor type: Brushed motor
  • Motor control: PWM speed control
  • Motor current: 5 to 20A

H-Bridge Specification

  • 24V Supply voltage
  • 100A Peak current
  • 20A continuous current

With only a limited number of components to choose from, I decided on the following:

  • P-Channel, SUP65P06
  • N-Channel, IRF3710
  • Schottkey Diode, 1N5822

The MOSFETs were chosen on their nominal current ratings, and the lowest Rds.

With this component selection, the H-Bridge will be able to switch up to 40 amps, as long as the MOSFET temperature can be kept below 100°C.

Step 7: Switching the MOSFETS

Calculations

N-Channel Ratings

Pmosfet max = 200W

Rds = 23mΩ

Vsd max = 20V

P-Channel Ratings

Pmosfet max = 250W

Rds = 33mΩ

Vds max = 20V

LOAD

Vload = 24V

Iload max = 40A

Iload avg = 20A

First, calculate power requirements of the MOSFETs

N-Channel

Pmosfet max = Imax² x Rds

= 40² x 23mΩ

= 36.8W

P-Channel

Pmosfet max = Imax² x Rds

= 40² x 33mΩ

= 52.8W

Load will not exceed power rating of the MOSFETs.

NOTE ! ! !

The MOSFETs will need additional cooling, as their power ratings are at 25°C.

Driving Voltage

Next, calculate the required Vds driving voltage. To ensure the lowest Rds, the gate voltage should be as high as possible. Both MOSFETs are rated for a maximum Vds of 20V. This should not be exceeded.

Too low a gate voltage will increase the Rds. From the Transfer Characteristics, both MOSFETS are turned on correctly with a gate voltage of at least 8V.

As the H-Bridge will be used on a 24V battery system, we need to take into account the maximum and minimum battery voltage. Fully charged, the voltage can be around 30V. The low battery warning operates at 20V, which will be the lowest voltage the H-Bridge will normally operate at. For safety, I will use 18V.

Vmax = 30V

Vmin = 18V

Resistors R1 – R4

To ensure fast switch-on and switch-off times of the MOSFETs, the input impedance of the gate must be as low as possible. I have chosen these resistors as 1KΩ. This low resistance will ensure that the MOSFETS are turned off hard and fast.

Calculate the voltage divider resistance values (R1 – 4, and R27 – R30)

Vout = Vin x (R1/(R1 + R27))

or

R27 = (Vin X R1) / Vout - R1

10V = 18V x (1K/(1K + R27))

R27 = 800Ω

Use = 820R

With R27 = 820R, at Vbatt = 18V

Vgs = 18V x (1k/(1K + 820R))

= 9.89V

With Rx = 820R, at Vbatt = 30V

Vgs = 30V x (1k/(1K + 820R))

= 16.48V

In both cases, Vds is above 8V and below 20V, and should ensure the lowest Rds for any voltage between 18V and 30V.

Step 8: Interfacing Between 5V and the MOSFETs

POSITIVE LEG

To interface this leg to 5V, transistor Q5 is used. Current Ice is calculated as follow:

Use Vbatt of 30V (worst case)

Ice = Vsupply / (R1 + R27)

= 30V / (1K + 820R)

= 16mA

Typical transistors have a gain of between 50 .. 100. Lets use Hfe = 50 (worst case)

Now, current needed into base of Q5 is calculated as follow:

Ibe = Ice / Hfe

= 16mA / 50

= 0.3mA minimum base current.

To calculate R5, I used nominal base current of 1mA to drive Q5. For 5V control, the voltage across R5 will be

5V - 0.7V, or 4.3V.

R5 = V / I

= 4.3 / 1mA

= 4300 ohm.

I opted for 2K2, thus ensuring Q5 is turned on fully.

NEGATIVE LEG
To interface this leg to 5V, transistor Q6 is used. Current Ia is calculated as follow:

Use Vbatt of 30V (worst case)

Ia = Vsupply / (R1 + R27)

= 30V / (1K + 820R) = 16mA

Typical transistors have a gain of between 50 .. 100. Lets use Hfe = 50 (worst case)

Now, current needed into base of Q6 is calculated as follow:

Ib = Ia / Hfe = 16mA / 50 = 0.3mA minimum base current.

To calculate R8, I used nominal base current of 1mA to drive Q6 via Q7.

R8 = V / I

= 30 / 1mA

= 30K

I opted for 10Kohm.

Q7 will also be switched using 5V. Again, I opted for 1mA base current into Q7.

For 5V control, the voltage across R9 will be

5V - 0.7V, or 4.3V.

R5 = V / I

= 4.3 / 1mA

= 4300 ohm.

I opted for 2K2, thus ensuring Q7 is turned on fully.

Step 9: Controlling the Positive Leg of the H-Bridge

Resistor R1 keeps Q1 Gate at +24V. To turn on Q1, the Gate voltage should be 10V less than the Source voltage (+24V). This is done using transistor Q5. When Q5 is turned on via R5, the Gate voltaqe of Q1 is pulled to 0V, turning on Q1. Resistor R6 ensures that Q5 is kept off without a signal on point A.

Similar, resistor R3 keeps Q3 Gate at +24V. To turn on Q3, the Gate voltage should be 10V less than the Source voltage (+24V). This is done using transistor Q9. When Q9 is turned on via R14, the Gate voltaqe of Q3 is pulled to 0V, turning on Q3. Resistor R13 ensures Q9 is kept off without a signal on point C.

Step 10: Controlling the Negative Leg of the H-Bridge

With Q7 turned off, the base of Q6 is pulled to +24V via R7. This ensures Q6 stays turned off. The Gate of Q2 is pulled low by R2, turning off Q2. When Q7 is turned on via R9, the base of Q6 is pulled low, and Q6 turns on. +24V is now applied to the Gate of Q2, turning Q2 on. Resistor R10 ensures that Q7 is kept off without a signal on point B.

Similar, with Q11 turned off, the base of Q10 is pulled to +24V via R15. This ensures Q10 stays turned off. The Gate of Q3 is pulled low by R4, turning off Q3. When Q11 is turned on via R17, the base of Q10 is pulled low, and Q10 turns on. +24V is now applied to the Gate of Q3, turning Q3 on. Resistor R19 ensures that Q11 is kept off without a signal on point D.

Step 11: Adding Pulse With Modulation (PWM) Control

Q8 is added in series with Q7 to control the switching of Q2. Now, Q7 and Q8 needs to be turned on before Q6 and Q2 can be turned on. The PWM signal is fed in to Q8 via R11. Resistor R12 ensures that Q8 is kept off without a signal on the PWM line.

Similar, Q12 is added in series with Q11 to control the switching of Q4. Now, Q11 and Q12 needs to be turned on before Q10 and Q4 can be turned on. The PWM signal is fed in to Q12 via R18. Resistor R20 ensures that Q12 is kept off without a signal on the PWM line.

Step 12: Configure the H-Bridge

All that is left to do, is to connect the different legs of the H-Bridge together.

Point A is connected to point D. Now, applying a 5V signal to FORWARD will turn on Q1 and Q4. +24V will be present on motor terminal M1, and 0V on terminal M2. The motor will spin in one direction, lets call it forward.

Point B is connected to point C. Now, applying a 5V signal to REVERSE will turn on Q2 and Q3. +24V will be present on motor terminal M2, and 0V on terminal M1. The motor will spin in the opposite direction, lets call it reverse.

A single PWM signal will be used on the H-Bridge. Thus, both PWM signals are connected together.

This completes the design of the H-Bridge. The following control signals are now present:

  • FORWARD
  • REVERSE
  • PWM

Step 13: Interfacing With a Microcontroller

There were two options to choose from, each with it's own advantages/disadvantages. For both options, the PWM signal will be the same.

OPTION 1 - FORWARD/REVERSE CONTROL SIGNALS

With this option, there are two lines controlling the direction of the motor, FORWARD and REVERSE.

Advantages

  • A change of state in a single control signal can not change the direction of the motor.
  • When the FORWARD and REVERSE control signals are both LOW, all four MOSFETs are turned off. No supply will be present on the motor terminals.
  • With FORWARD and REVERSE signals LOW, standby current is reduced, as all the driving transistors for the MOSFETs are switched off.

Disadvantages

  • Controller requires three pins from the uC.
  • The H-Bridge can be damaged if both FORWARD and REVERSE control signals are HIGH at the same time. Additional circuitry is needed to prevent this condition.

OPTION 2 - ONLY DIRECTION CONTROL SIGNAL

Advantages

  • Controller only requires 2 pins from the uC.
  • Single control signal to determine motor direction.
  • Incorrect FORWARD/REVERSE control signals can not cause any damage to the H-Bridge.

Disadvantages

  • Either Q1 or Q3 will always be turned on, depending of the status of the DIRECTION control signal.
  • Increased standby current, as either Q1 or Q3 will always be turned on.
  • There will always be 24V present on one of the motor terminals, even with no PWM signal.

I have decided to go with OPTION 1 in the rest of the design.

Step 14: Add H-Bridge Input Protection

With the H-Bridge completed, we need to look at what can go wrong when using the H-Bridge.

There is one condition that will totally destroy the H-Bridge. This will occur when 5V is applied to the FORWARD, REVERSE and PWM signals at the same time. The FORWARD signal will turn on Q1 and Q4, and the REVERSE signal will turn on Q2 and Q3. With Q1 and Q2 turned on, or Q3 and Q4 turned on, we create a dead short across the supply side of the H-Bridge. Short-circuit current will flow through the H-Bridge, most likely destroying the MOSFETs, as well as all wiring associated with the H-Bridge.

To protect against this condition, a PIC 12F675 is added to the control signals. The PIC is programmed to prevent both FORWARD and REVERSE sided of the H-Bridge to be turned on at the same time.

Additionally, to change the motor direction, both FORWARD and REVERSE inputs must be LOW for at least 20ms. This will prevent the H-Bridge to be switched between FORWARD and REVERSE too fast.

The FWD signal is fed into the 12F675 via R23. Resistor R25 ensures that the input to the 12F675 is pulled low without a signal present on the FWD point.

Similar, the REV signal is fed into the 12F675 via R24. Resistor R26 ensures that the input to the 12F675 is pulled low without a signal present on the REV point.

The PWM signal is not used in the protection circuit.

To keep the idling current of the H-Bridge as low as possible, the +5V needed for the 12F675 must be supplied from the device controlling the H-Bridge. Capacitor C2 and C3 are used to filter out any noise on the +5V supply.

Step 15: Adding H-Bridge Cooling Fan Control

A LM35 temperature sensor is added to the PIC 12F675 to measure the temperature of the MOSFET heatsinks. The output of theLM35 is measured by the 12F675, and will turn on the COOLING line of the temperature exceeds 50°C. The COOLING line will be turned off once the temperature is below 40°C again. The cooling fans are controlled by Q13 connected in a open collector configuration. Q13 is controlled by the COOLING signal via resistor R22. Resistor R21 ensures that the base of Q13 is pulled low without a signal present on the COOLING signal.

Because the H-Bridge will be used on a 24V battery system, 12V is unavailable for the fans. Obtaining 24V fans is much more difficult and expensive when compared to 12V fans. To overcome this shortcoming, a small DC/DC converter is used to convert the 24V to 12V. Supply to the DC/DC converter and cooling fan is controlled by Q13, and will not use any current when switched off.

! ! ! NOTE ! !
Before connecting the cooling fans, adjust the output of the DC/DC converter to the correct output voltage. In my case, I used two 12V fans.

Step 16: Adding H-Bridge Temperature Protection

Temperasture protection was added to the 12F675 to prevent the H-Bridge from exceeding the rated temperature of the MOSFETs. This protection uses the same LM35 as for the cooling fan control.

When the temperature of the H-Bridge reaches 90°C, the FORWARD and REVERSE control signal to the H-Bridge is blocked, and the H-Bridge turns off. The temperature has to fall below 60°C for the H-Bridge to turn on again.

The temperature protection works independent from the cooling fan.

! ! ! UPDATE ! ! !

After testing, I made some slight changes to the temperature protection. The new ASM and HEX files are included.

  • H-Bridge will now turn of at 80 Degreec C
  • H-Bridge will only reset at 40 Degrees C
  • Forward/Reverse inputs must also both be pulled low to reset the H-Bridge

Step 17: Driver PC Board

The design is for a dual H-Bridge, and the PC Boards were made to contain both H-Bridges. The design was split into 2 boards:

  • Driver Board
  • MOSFET Board

The first board is the Driver board.

The PCB is a standard through-hole board, with no special components needed.

! ! ! NOTE ! !
Before connecting the cooling fans, adjust the output of the DC/DC converter to the correct output voltage. In my case, I used two 12V fans.

Step 18: MOSFET PC Board

Again, the PC Board contain both H-Bridges.

The second board is the MOSFET board. The PCB is a standard through-hole board,

After all components are soldered, and the heatsinks fitted, the surface of the current carrying tracks needs to be increased. Before tinting the tracks, I laid lengths of 1.5mm solder wick onto the tracks as close to the connections as possible. This should reduce the chances of the tracks burning off during normal operation of the H-Bridge.

! ! ! NOTE ! !

The 820R resistors must be soldered on the solder side of the PC Board to allow the heatsink to be mounted on the component side of the PC Board.. The design does make provision to replace these resistors with 1206 SMD resistors if required.

Step 19: MOSFET Heatsinks

The MOSFETS are all mounted on top of a 100 x 40 x 5 mm aluminium heat sink that fits onto the PC Board. Each MOSFET is further fitted with an additional 13 x 19 mm finned heatsink. Thermal paste must be applied to all heat conducting areas. See drawing for detailed mounting method.

Step 20: MOSFET Cooling Fans

The cooling fans, one for each H-Bridge, is mounted on top of the heatsinks using 4mm bolts and nuts. The direction of the fans are such that the hot air is extracted from the heatsink, and blown into the atmosphere. Cool air is then sucked into the housing of the H-Bridge via separate ventilation holes.

Step 21: Motor and Battery Connections

All the battery and motor wires from the H-Bridge should be done using at least 4mm² silicone wire. Due to the high currents present, the PC Board does not have terminal blocks for the connections. The wiring should be soldered directly onto the PC Board. Remember to keep all wiring as short as possible

Step 22: Final Testing

After assembly, the speed controller was bench tested to make sure everything was working correctly. All recordings were taken with the speed controller connected to a dummy load of 8 Ohm.

I had the following limitations in conducting prolonged load testing:

  • Maximum current available from bench power supply is 3 Amps at 24V.
  • Load testing was limited to 24V x 3A, or 72 Watt.
  • The dummy load was made up of 20 x 1 Watt resistors in parallel. I could not test the system with an inductive load.
  • Power dissipation through the load resistor was limited to 20 Watt. Load resistor had to be submersed in water to prevent overheating.
  • Heat of the bench power supply had to be monitored. This was the limiting factor during testing.
  • Continuous load current of 3 Amp could only be maintained for 30 minutes.

No problems were detected during the bench tests. At 75 Watt load, no temperature increase could be detected on the heat sinks of the MOSFETs.

Step 23: Installation Into My Project

The final step was the installation of the speed controller into an existing Electric Wheelchair Controller. Refer to one of my previous Instructables:

Electric Wheelchair Controller

Apart from the following minor software issues on the Electric Wheelchair Controller, this speed controller was installed successfully into the electric wheelchair:

  • Left and Right motor signals had to be swapped in software. It was easier to do this in software compared to changing the control signal wiring between the speed controller and the Electric Wheelchair Controller.
  • Forward and Reverse control signals had to be changed in the Electric Wheelchair Controller to be compatible with this speed controller.
  • Motor direction was wrong, and had to be changed in the Electric Wheelchair Controller. Again, it was easier to do this in software compared to swapping the motor wiring on the speed controller.

XT60 and DEAN plugs were used to connect the fully assembled Electric Wheelchair Controller to the existing wiring of the wheelchair. The battery and motor wiring connections were made using XT60 plugs. These plugs are rated for 60A. The electromechanical motor brake connections were made using DEAN plugs. This ensured that the wiring can not be connected incorrectly. The plugs also makes it possible to remove the controller with the least amount of effort.

Step 24: Final Words and Credits

This concludes the design and installation of my Dual 40A PWM Speed Controller for Brushed Motors.

Thanks to all the viewers, and the positive comments received on this Instructable. I definitely gained valuable knowledge on the following:

  • MOSFET switching
  • H-Bridge operation
  • Pulse With Modulation (PWM)
  • DC motor control

A special thanks to the following contributors:

I hope you enjoyed this Instructable.

Regards

Eric Brouwer

Step 25: Death of the Wheelchair Project

During the final setup of the wheelchair, one of the speed controller channels failed with a big bang. The power MOSFETs actually exploded, leaving only the tap and three leads.

The motor was suspected, and removed from the wheelchair. I removed the electromechanical brake from the motor, as well as the reduction gearbox. The motor was connected directly to the 24V batteries, and current measurements taken........ Starting current exceeded my measuring equipment's 200A scale. After 1 second, current dropped down to 39A. At the same time, smoke was coming out of the motor.

On opening the motor, it was discovered that the seal between the motor and gearbox failed, as the motor was 1/3 full of grease. The grease had a consistency of dried peanut butter. After the motor was cleaned, it was again tested. Tests confirmed that the motor windings had failed, and the motor needs to be replaced.

The faulty MOSFETs were replaced, and the channel tested correct on the healthy motor.

After spending a lot of time and money to get the wheelchair running again, a decision was taken to finally give up on this project.

Circuits Contest 2016

Fourth Prize in the
Circuits Contest 2016