arduino application: speed control of small dc motors v cb o collector -bas e v oltag e 60 v v ebo...
TRANSCRIPT
ME 120: Speed control of small DC motors
Arduino Application:
Speed control of small DC Motors
ME 120Mechanical and Materials Engineering
Portland State University
http://web.cecs.pdx.edu/~me120
ME 120: Speed control of small DC motors
Learning Objectives
• Be able to describe the use of a transistor as a high
speed switch
• Be able to build a breadboard circuit that uses a
transistor as a high speed switch
• Be able to explain the role of a snubber diode
• Be able to implement PWM speed control of a DC motor
• Additional references:
❖ Circuit 12 (p. 64) in the SIK manual
❖ ME 120 course notes on PWM
❖ http://learn.adafruit.com/adafruit-arduino-lesson-13-dc-
motors/overview
2
ME 120: Speed control of small DC motors
Using a transistor as a high
speed switch
3
ME 120: Speed control of small DC motors
Transistor as a switching device
• Each Arduino output channel has a 40 mA limit
❖ Only current to power a very small DC motor
❖ Arduino is not designed as a power supply
• Maximum current draw for an Arduino is 200 mA
• Use the Arduino as the brain
• Let another switching element be the brawn
4
ME 120: Speed control of small DC motors
Use an NPN Transistor as a switch
5
NPN General Pupose Amplifier
This device is designed for use as a medium power amplifier and
switch requiring collector currents up to 500 mA.
MMBT44012N4401
Absolute Maximum Ratings* TA = 25°C unless otherwise noted
*These ratings are limiting values above which the serviceability of any semiconductor device may be impaired.
NOTES:
1) These ratings are based on a maximum junction temperature of 150 degrees C.
2) These are steady state limits. The factory should be consulted on applications involving pulsed or low duty cycle operations.
Symbol Parameter Value Units
VCEO Collector-Emitter Voltage 40 V
VCBO Collector-Base Voltage 60 V
VEBO Emitter-Base Voltage 6.0 V
IC Collector Current - Continuous 600 mA
TJ, Tstg Operating and Storage Junction Temperature Range -55 to +150 °C
Thermal Characteristics TA = 25°C unless otherwise noted
Symbol Characteristic Max Units
2N4401 *MMBT4401
PD Total Device Dissipation
Derate above 25°C
6255.0
3502.8
mW
mW/°C
RqJC Thermal Resistance, Junction to Case 83.3 °C/W
RqJA Thermal Resistance, Junction to Ambient 200 357 °C/W
CB
E
TO-92
C
B
E
SOT-23Mark: 2X
*Device mounted on FR-4 PCB 1.6" X 1.6" X 0.06."
ã 2001 Fairchild Semiconductor Corporation
2N
44
01
/ MM
BT
44
01
2N4401/MMBT4401, Rev A
This device is designed for use
as a medium power amplifier
and switch requiring collector
currents up to 500 mA
ME 120: Speed control of small DC motors
Use Digital I/O pin to switch LED on/off
Digital I/O pin → LED
ME 120: Speed control of small DC motors
Use Digital I/O pin to switch LED on/off
Digital I/O pin → LED
ME 120: Speed control of small DC motors
Code to control brightness of an LED
int LED_pin = 11; // PWM pin LED or motor control
void setup() {
pinMode( LED_pin, OUTPUT );
}
void loop() {
int duty, pot_pin=0, reading;
reading = analogRead(pot_pin); // read potentiometer
duty = map(reading,0,1023,0,255); // rescale to 8-bit
duty = constrain(duty,0,255); // be safe
analogWrite(LED_pin,duty); // set duty cycle
}
In the following examples, the Arduino code does not
need to change when the electrical circuit is changed.
The Arduino code only needs to use a single digital
output pin, which in this code is LED_pin.
ME 120: Speed control of small DC motors
Use Digital I/O pin to switch LED on/off
Use of a potentiometer
Digital I/O pin → LED
(Analog pin A0)
Pot. Pin
Potentiometer
ME 120: Speed control of small DC motors
Use Digital I/O pin to switch LED on/off
Use of a potentiometer
Digital I/O pin → LED
(Analog pin A0)
Pot. Pin
Potentiometer
ME 120: Speed control of small DC motors
(Analog pin A0)
Pot. Pin
Potentiometer
Use a Transistor to switch LED on/off
Digital I/O pin → Transistor → LED
ME 120: Speed control of small DC motors
(Analog pin A0)
Pot. Pin
Potentiometer
Use a Transistor to switch LED on/off
Digital I/O pin → Transistor → LED
ME 120: Speed control of small DC motors
NPN Transistors as Switches
C is the collector.
B is the base
E is the emitter
Transistors can be used as switches: By applying
relatively small voltage to the Base, electrical
current will flow from the collector to the emitter.
NPN General Pupose Amplifier
This device is designed for use as a medium power amplifier and
switch requiring collector currents up to 500 mA.
MMBT44012N4401
Absolute Maximum Ratings* TA = 25°C unless otherwise noted
*These ratings are limiting values above which the serviceability of any semiconductor device may be impaired.
NOTES:
1) These ratings are based on a maximum junction temperature of 150 degrees C.
2) These are steady state limits. The factory should be consulted on applications involving pulsed or low duty cycle operations.
Symbol Parameter Value Units
VCEO Collector-Emitter Voltage 40 V
VCBO Collector-Base Voltage 60 V
VEBO Emitter-Base Voltage 6.0 V
IC Collector Current - Continuous 600 mA
TJ, Tstg Operating and Storage Junction Temperature Range -55 to +150 °C
Thermal Characteristics TA = 25°C unless otherwise noted
Symbol Characteristic Max Units
2N4401 *MMBT4401
PD Total Device Dissipation
Derate above 25°C
6255.0
3502.8
mW
mW/°C
RqJC Thermal Resistance, Junction to Case 83.3 °C/W
RqJA Thermal Resistance, Junction to Ambient 200 357 °C/W
CB
E
TO-92
C
B
E
SOT-23Mark: 2X
*Device mounted on FR-4 PCB 1.6" X 1.6" X 0.06."
ã 2001 Fairchild Semiconductor Corporation
2N
44
01
/ MM
BT
44
01
2N4401/MMBT4401, Rev A
ME 120: Speed control of small DC motors
NPN Transistors as Switches
C is the collector.
B is the base
E is the emitter
When used as a switch, ICE, the current from
the collector to the emitter is large compare to
IBE, the current from the base to the emitter.
NPN General Pupose Amplifier
This device is designed for use as a medium power amplifier and
switch requiring collector currents up to 500 mA.
MMBT44012N4401
Absolute Maximum Ratings* TA = 25°C unless otherwise noted
*These ratings are limiting values above which the serviceability of any semiconductor device may be impaired.
NOTES:
1) These ratings are based on a maximum junction temperature of 150 degrees C.
2) These are steady state limits. The factory should be consulted on applications involving pulsed or low duty cycle operations.
Symbol Parameter Value Units
VCEO Collector-Emitter Voltage 40 V
VCBO Collector-Base Voltage 60 V
VEBO Emitter-Base Voltage 6.0 V
IC Collector Current - Continuous 600 mA
TJ, Tstg Operating and Storage Junction Temperature Range -55 to +150 °C
Thermal Characteristics TA = 25°C unless otherwise noted
Symbol Characteristic Max Units
2N4401 *MMBT4401
PD Total Device Dissipation
Derate above 25°C
6255.0
3502.8
mW
mW/°C
RqJC Thermal Resistance, Junction to Case 83.3 °C/W
RqJA Thermal Resistance, Junction to Ambient 200 357 °C/W
CB
E
TO-92
C
B
E
SOT-23Mark: 2X
*Device mounted on FR-4 PCB 1.6" X 1.6" X 0.06."
ã 2001 Fairchild Semiconductor Corporation
2N
44
01
/ MM
BT
44
01
2N4401/MMBT4401, Rev A
ME 120: Speed control of small DC motors
What is a snubber diode, and
why should I care?
15
ME 120: Speed control of small DC motors
Simplest DC Motor Circuit
Connect the motor to a DC power supply
16
ME 120: Speed control of small DC motors
Current continues after the switch is opened
Opening the switch does not immediately stop current
from flowing in the motor windings
17
ME 120: Speed control of small DC motors
Reverse current
Charge build-up can cause damage
18
ME 120: Speed control of small DC motors
Motor Model
• Simple model of a DC motor:
❖ Windings have inductance and resistance
❖ Electrical energy is stored in the windings – the inductance
effect
❖ We need a way to safely dissipate electrical energy when
the switch is opened after the motor has been running
19
ME 120: Speed control of small DC motors
Flyback diode or snubber diode
Adding a diode in parallel with the motor provides a path
for the dissipation of stored energy when the switch is
opened
20
ME 120: Speed control of small DC motors
DC motor speed control circuit
The circuit for DC motor speed control uses the idea from
the LED brightness control circuit. Replace the LED circuit
with the DC motor and snubber diode
21
(Analog pin A0)Pot. Pin
Potentiometer
(Digital pin ~11)
flyback diodeDC motor
Motor Pin
330Ω
+5V
transistor
ME 120: Speed control of small DC motors
DC motor speed control circuit
The circuit for DC motor speed control uses the idea from
the LED brightness control circuit. Replace the LED circuit
with the DC motor and snubber diode
22
(Analog pin A0)Pot. Pin
Potentiometer
(Digital pin ~11)
flyback diodeDC motor
Motor Pin
330Ω
+5V
transistor