PWM Motor Control Using MOSFETS

G

Gerrard Shaw

Guest
Hi, my name is Gerrard Shaw, I am doing my A-levels at the moment,
including one in Electronics (Systems and Control Technology). My
final design paper concerns cordless power tools and variable
electronic speed controls. After looking at various systems available
to do this job (darlington pair + simple potentiometer) I have what I
think is quite a good circuit. Check it out at: -

http://www.orient.fsworld.co.uk/Motors/Motor1.GIF

(you probably need to take a look to understand any of the stuff
below)

The voltage regulator would be a 7805 to give 5V regulated from a
12/24V battery whilst still giving the motor the high voltage. As seen
on this site, the DPDT switch gives motor direction control.

It uses two MOSFETS driven by a PIC microcontroller to give out the
PWM pulses. This would allow input from a linear potentiometer on the
trigger and an algorithm to produce the right pulse train. Another
input switch could set high or low speed setting as well, which would
be easy to do in the PIC program.

The circuit turns on one MOSFET in antiphase to the other from the
output of the PIC (i.e. when 1 on the other is off).

The flywheel MOSFET works like a reverse bias diode to prevent voltage
spikes under normal conditions but when the output of the controller
decreases (i.e. motor slowing down / stopping) it also allows reverse
current to flow back into the battery, thus recharging it and slowing
down the motor in one go.

I could also interface a temperature sensor that checks the
temperature of the motor / drive MOSFET to ensure that the system
doesn't overheat.

What I wanted to check is that MOSFETS do conduct in either direction
when switched on and that this circuit would work in practice. What do
you guys think? A second opinion would be very useful!

Any help much appreciated.

Regards,

Gerrard Shaw
 
barneycalhoun2@hotmail.com (Gerrard Shaw) writes:

Hi, my name is Gerrard Shaw, I am doing my A-levels at the moment,
including one in Electronics (Systems and Control Technology). My
final design paper concerns cordless power tools and variable
electronic speed controls. After looking at various systems available
to do this job (darlington pair + simple potentiometer) I have what I
think is quite a good circuit. Check it out at: -

http://www.orient.fsworld.co.uk/Motors/Motor1.GIF

(you probably need to take a look to understand any of the stuff
below)

The voltage regulator would be a 7805 to give 5V regulated from a
12/24V battery whilst still giving the motor the high voltage. As seen
on this site, the DPDT switch gives motor direction control.

It uses two MOSFETS driven by a PIC microcontroller to give out the
PWM pulses. This would allow input from a linear potentiometer on the
trigger and an algorithm to produce the right pulse train. Another
input switch could set high or low speed setting as well, which would
be easy to do in the PIC program.

The circuit turns on one MOSFET in antiphase to the other from the
output of the PIC (i.e. when 1 on the other is off).
Hi Gerrard,

Sounds straightforward, but there is an obvious danger here that at
some point you will accidentally turn on both together, in which case
you will get "shoot through" and smoke! This is especially likely
since the sparks from the motor and the reversing switch will likely
make the PIC crash.

I have been through this myself, buy plenty of MOSFETs because you
will blow up a lot before you are finished :)

The flywheel MOSFET works like a reverse bias diode to prevent voltage
spikes under normal conditions but when the output of the controller
decreases (i.e. motor slowing down / stopping) it also allows reverse
current to flow back into the battery, thus recharging it and slowing
down the motor in one go.

I could also interface a temperature sensor that checks the
temperature of the motor / drive MOSFET to ensure that the system
doesn't overheat.

What I wanted to check is that MOSFETS do conduct in either direction
when switched on and that this circuit would work in practice. What do
you guys think? A second opinion would be very useful!
Q3 won't work I'm afraid. To turn it on, the "control voltage" on the
gate needs to rise several volts above the drain, which for Q3 will be
at 24V! This is a general problem when driving N channel MOSFETs in
this configuration. There are driver ICs available to do the job that
contain the required "boost" circuitry. Or you could hack something up
yourself. Alternatively, can you not just use a diode for Q3? A power
Schottky type would probably be best, e.g. 1N5822.

I would also put some resistors between the MOSFETS and the PIC, to
protect it.

--

John Devereux
 
Gerrard Shaw wrote:
Hi, my name is Gerrard Shaw, I am doing my A-levels at the moment,
including one in Electronics (Systems and Control Technology). My
final design paper concerns cordless power tools and variable
electronic speed controls. After looking at various systems available
to do this job (darlington pair + simple potentiometer) I have what I
think is quite a good circuit. Check it out at: -

http://www.orient.fsworld.co.uk/Motors/Motor1.GIF

(you probably need to take a look to understand any of the stuff
below)

The voltage regulator would be a 7805 to give 5V regulated from a
12/24V battery whilst still giving the motor the high voltage. As seen
on this site, the DPDT switch gives motor direction control.

It uses two MOSFETS driven by a PIC microcontroller to give out the
PWM pulses. This would allow input from a linear potentiometer on the
trigger and an algorithm to produce the right pulse train. Another
input switch could set high or low speed setting as well, which would
be easy to do in the PIC program.

The circuit turns on one MOSFET in antiphase to the other from the
output of the PIC (i.e. when 1 on the other is off).

The flywheel MOSFET works like a reverse bias diode to prevent voltage
spikes under normal conditions but when the output of the controller
decreases (i.e. motor slowing down / stopping) it also allows reverse
current to flow back into the battery, thus recharging it and slowing
down the motor in one go.

I could also interface a temperature sensor that checks the
temperature of the motor / drive MOSFET to ensure that the system
doesn't overheat.

What I wanted to check is that MOSFETS do conduct in either direction
when switched on
Yes they do, but there are some other things you should consider:

1) MOSFETs are controlled by the gate voltage relative to the source
(V_gs). Now since the source voltage for Q3 could be anything between 0
and 24V (or even outside this range due to spikes from the motor) I
don't think Q3 will behave as you intend.

2) MOSFETs have an intrinsic diode so they will always conduct backwards
regardless of V_gs. Sometimes this is a problem, but with motor
controllers the diode is often helpful. In your case when you switch Q2
off the intrinsic diode in Q3 will conduct and clamp the spike caused by
the motor inductance. In fact I think you may be better off replacing
Q3 with a diode.

3) Check the on resistance of the MOSFETs you use at V_gs = 5V - most
MOSFETs only get down to the on resistance values on the front of the
datasheet with a V_gs of 10V. There are lots of logic level MOSFETs
around which are, as the name suggests, intended to be controlled
directly from digital logic outputs at 5V.

One other thing - what is the maximum input voltage of the ADC input to
the PIC, and do you need to make R1 bigger? you may have already
checked this, I didn't check the PIC datasheet.

Gareth.
--
-----------------------------------------------------------------------
To reply to me directly:

Replace privacy.net with: totalise DOT co DOT uk and replace me with
gareth.harris
 
John Devereux <jdREMOVE@THISdevereux.me.uk> writes:

<SNIP>
Q3 won't work I'm afraid. To turn it on, the "control voltage" on the
gate needs to rise several volts above the drain
Sorry, I meant "source" not "drain" in the above! (Although it amounts
to the same thing in this case).

--

John Devereux
 
On 30 May 2004 03:42:34 -0700, barneycalhoun2@hotmail.com (Gerrard
Shaw) wrote:

Hi, my name is Gerrard Shaw, I am doing my A-levels at the moment,
including one in Electronics (Systems and Control Technology). My
final design paper concerns cordless power tools and variable
electronic speed controls. After looking at various systems available
to do this job (darlington pair + simple potentiometer) I have what I
think is quite a good circuit. Check it out at: -

http://www.orient.fsworld.co.uk/Motors/Motor1.GIF

(you probably need to take a look to understand any of the stuff
below)
One of your DPDST switch positions places the unlimited supply voltage
directly across the lower fet in the half bridge.

If you connect one end of the motor permanently to the bridge output,
you can manually switch the other end of the motor between the + and -
supply rails using one spdt switch.

You will not be able to drive both the fet switches directly from the
PIC, as the PIC output is voltage limited in compliance to within it's
own supply rails, and the upper fet gate is expected to exceed the
motor supply rail, when enhanced.

RL
 
Hi everyone, thanks for your help. I'm glad I checked this circuit
here first as it would have looked a bit dodgy on the design paper! I
think I'll put the regen idea down as an idea but then dismiss it
because of the source-gate voltage problem. There's also a way using
discrete components but it uses more components + is probably less
reliable. A few more questions now...

1) if not using the regen braking, how would I make the motor stop
when pressure is released from the trigger - I've heard about shunt
braking but I'm not too sure how it works - can anyone advise?

2) From the following post...

"Check the on resistance of the MOSFETs you use at V_gs = 5V - most
MOSFETs only get down to the on resistance values on the front of the
datasheet with a V_gs of 10V. There are lots of logic level MOSFETs
around which are, as the name suggests, intended to be controlled
directly from digital logic outputs at 5V.

- what would be a suitable MOSFET to use? I've seen an IRF530
suggested in the manual - would this be OK?

"One other thing - what is the maximum input voltage of the ADC input
to
the PIC, and do you need to make R1 bigger? you may have already
checked this, I didn't check the PIC datasheet."

- The ADC is an integrated function on the PicAXE18X IC and can be
calibrated from the pot - the manual shows a 10k connected so I won't
argue with that!

3) From another post

"One of your DPDST switch positions places the unlimited supply
voltage
directly across the lower fet in the half bridge. If you connect one
end of the motor permanently to the bridge output, you can manually
switch the other end of the motor between the + and - supply rails
using one spdt switch."

- Is this a mistake that will stop the circuit working properly? How
should I wire it if it is wrong. I have seen another PWM circuit on
the WWW at http://www.aaroncake.net/circuits/motorcon.htm with the
DPDT switch wired, but where should I put the diode?

With regards to that circuit does the it actually vary the mark /
space ratio of the output wave or does it just change the frequency of
the output wave or both? I am right in thinking that the mark / space
ratio changes the on/off time of the output and the frequency just
keeps the motor moving smoothly? Will it always go the same speed no
matter what the frequency is if the mark/space ratio is the same in
each case – I'm a bit confused as you can guess! If the circuit does
vary the mark/space ratio how does it work as I saw something similar
that uses 2 sets of resistor / capacitor combos to make the PWM
output.

4) "You will not be able to drive both the fet switches directly from
the
PIC, as the PIC output is voltage limited in compliance to within it's
own supply rails, and the upper fet gate is expected to exceed the
motor supply rail, when enhanced."

- It looks like I'll only be driving one, should this be OK?

I know it looks like a lot of questions but I need to get this sorted
one way or another before my test!

Regards,

Gerrard
 
Gerrard Shaw wrote:
Hi everyone, thanks for your help. I'm glad I checked this circuit
here first as it would have looked a bit dodgy on the design paper! I
think I'll put the regen idea down as an idea but then dismiss it
because of the source-gate voltage problem. There's also a way using
discrete components but it uses more components + is probably less
reliable. A few more questions now...

1) if not using the regen braking, how would I make the motor stop
when pressure is released from the trigger - I've heard about shunt
braking but I'm not too sure how it works - can anyone advise?
I would expect mechanical friction to stop the motor in a reasonable
time but I don't know how quickly you want it to stop. I don't think
you would have had regen braking even with the top FET - current from
the motor would just go through the FET not back to the battery.

2) From the following post...

"Check the on resistance of the MOSFETs you use at V_gs = 5V - most
MOSFETs only get down to the on resistance values on the front of the
datasheet with a V_gs of 10V. There are lots of logic level MOSFETs
around which are, as the name suggests, intended to be controlled
directly from digital logic outputs at 5V.

- what would be a suitable MOSFET to use? I've seen an IRF530
suggested in the manual - would this be OK?
Look at the datasheet and find out what the on resistance of the MOSFET
is with a gate voltage (V_gs) of 5 Volts (there is usually a graph) then
work out the power dissipation when the MOSFET is on:

P = I^2*R (where I is the motor current)

Compare this to the power dissipation values given in the MOSFET
datasheet. Also consider how the voltage drop caused by the on
resistance will reduce the power of the motor and waste battery power.

[SNIP]

- It looks like I'll only be driving one, should this be OK?
Yes, but you need to replace the top FET with a diode as John and I
suggested.


--
-----------------------------------------------------------------------
To reply to me directly:

Replace privacy.net with: totalise DOT co DOT uk and replace me with
gareth.harris
 
On 31 May 2004 12:00:21 -0700, barneycalhoun2@hotmail.com (Gerrard
Shaw) wrote:

http://www.orient.fsworld.co.uk/Motors/Motor1.GIF

"One of your DPDT switch positions places the unlimited supply
voltage
directly across the lower fet in the half bridge. If you connect one
end of the motor permanently to the bridge output, you can manually
switch the other end of the motor between the + and - supply rails
using one spdt switch."

- Is this a mistake that will stop the circuit working properly?
This would fuse the lower fet bond wires open circuit.

How should I wire it if it is wrong.
A single-pole double-throw switch will perform the intended function.
Instructions for rewiring are in the original response's text,
reposted above.

I have seen another PWM circuit on
the WWW at http://www.aaroncake.net/circuits/motorcon.htm with the
DPDT switch wired, but where should I put the diode?
If you want to compare the two html wiring diagrams that you
reference, please do so. The 'motorcon' reference does not have the
wiring fault present in 'motor1'.

With regards to that circuit does the it actually vary the mark /
space ratio of the output wave or does it just change the frequency of
the output wave or both?
You are the designer. It's your choice.

The average voltage is being varied in order to control the dc motor's
speed.

We assume this is through pulse width modulation at a fixed
frequency, however a fixed pulse width, variable frequency scheme
could produce the same change in average voltage.

4) "You will not be able to drive both the fet switches directly from
the PIC, as the PIC output is voltage limited in compliance to within
it's own supply rails, and the upper fet gate is expected to exceed
the motor supply rail, when enhanced."

- It looks like I'll only be driving one, should this be OK?
If it's the one that is within the compliance of the PIC, the PIC will
not be damaged, however you should probably buffer the PIC to isolate
it from gate reverse transfer currents and straight gate capacitive
loading.

It should function assymetrically as a buck converter, providing the
freewheeling energy is given a diode path, in the switch 'off' time.

The simpler SPDT switch would not provide the reversing function in
that case.

RL
 

Welcome to EDABoard.com

Sponsor

Back
Top