Arduino Application Speed control of small DC Motors

















- Slides: 17
Arduino Application: Speed control of small DC Motors ME 120 Mechanical and Materials Engineering Portland State University http: //web. cecs. pdx. edu/~me 120 ME 120: Speed control of small DC motors Fall 2013
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 -dcmotors/overview ❖ ME 120: Speed control of small DC motors 2
Using a transistor as a high speed switch ME 120: Speed control of small DC motors 3
Transistor as a switching device • Each Arduino output channel has a 40 m. A 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 m. A • Use the Arduino as the brain • Let another switching element be the brawn ME 120: Speed control of small DC motors 4
Use an NPN Transistor as a switch This device is designed for use as a medium power amplifier and switch requiring collector currents up to 500 m. A ME 120: Speed control of small DC motors 5
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() { pin. Mode( LED_pin, OUTPUT ); } void loop() { int duty, pot_pin=0, reading; reading = analog. Read(pot_pin); duty = map(reading, 0, 1023, 0, 255); duty = constrain(duty, 0, 255); analog. Write(LED_pin, duty); // // read potentiometer rescale to 8 -bit be safe 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 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 Transistors can be used as switches: By applying relatively small voltage to the Base, electrical current will flow from the collector to the base. C is the collector. B is the base E is the emitter ME 120: Speed control of small DC motors
NPN Transistors as Switches 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. C is the collector. B is the base E is the emitter ME 120: Speed control of small DC motors
What is a snubber diode, and why should I care? ME 120: Speed control of small DC motors 11
Simplest DC Motor Circuit Connect the motor to a DC power supply ME 120: Speed control of small DC motors 12
Current continues after the switch is opened Opening the switch does not immediately stop current from flowing in the motor windings ME 120: Speed control of small DC motors 13
Reverse current Charge build-up can cause damage ME 120: Speed control of small DC motors 14
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 ❖ ME 120: Speed control of small DC motors 15
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 ME 120: Speed control of small DC motors 16
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 +5 V DC motor Motor Pin (Digital pin ~11) flyback diode transistor Pot. Pin (Analog pin A 0) 330Ω Potentiometer ME 120: Speed control of small DC motors 17