Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Human Computer Interaction Laboratory
@jonfroehlich Assistant Professor Computer Science
CMSC838 Tangible Interactive Computing
Week 11 | Lecture 20 | April 9, 2015 Motors
TODAY’S LEARNING GOALS
1. Learn about the three most common motor types:
DC hobby motors, servo motors, and stepper
motors
2. Learn how to interface with said motors using
Arduino
3. Learn about common motor drivers like H-Bridges
and the Arduino motor shields
One More Inspiration for MP4
ATMOSPHERE Created by CMSC838f Spring2014 Students Ruofei Du, Kent Wills, and Max Potasznik
[source: https://youtu.be/W6fZNOhm72c]
MOTOR OVERVIEW
MEET THE MOTORS Created by Jeff Feddersen of NYU ITP
[source: https://vimeo.com/84274150]
Pulse Width Modulation (PWM): A Quick Refresher
WHAT IS PULSE WIDTH MODULATION? Afrotechmods
[source: https://youtu.be/YmPziPfaByw]
ARDUINO: ANALOG OUT
[sources: https://learn.sparkfun.com/tutorials/what-is-an-arduino; http://arduino.cc/en/Main/arduinoBoardUno; http://www.gammon.com.au/forum/?id=11473;
https://learn.adafruit.com/arduino-tips-tricks-and-techniques/arduino-uno-faq]
The Arduino UNO has 14 digital pins that can be used either as input or output (using the pinMode, digitalWrite, and digitalRead
functions). The pins operate at 5 volts. Each pin can provide or receive a maximum of 40mA and has an internal pull-up resistor,
which is disconnected by default, of 20-50kOhms.
14 digital I/O pins: these pins can be used for either input or output (set the mode using the pinMode function). Some pins have special functions. For example, pins with the ‘~’ symbol can be used to simulate analog output using pulse-width modulation (PWM). Other special functions are marked on this slide.
Six of the Digital I/O pins can be configured for analog out (pins 3, 5, 6, 9, 10, & 11 on the Uno): Any pin with a ‘~’ prefix can simulate analog output using 8-bit PWM with the analogWrite() function
ARDUINO ANALOGWRITE USES PULSE WIDTH MODULATION (PWM) The Arduino simulates analog output using PWM, which is very useful for controlling motors! Assume we are
controlling analog pin 3.
Approximately approximately every 1/490 of a second (490Hz), the Arduino generates a PWM pulse. The length of this pulse is controlled by the ‘analogWrite’ function. So, analogWrite(0) will not produce a pulse, analogWrite(128) creates a pulse that lasts half of the cycle, and analogWrite(255) creates a pulse that lasts all the way until the next pulse (i.e., the output is on all the time)
analogWrite(3, 13)
5% duty cycle
Mean output: ~0.25V
analogWrite(3, 128)
50% duty cycle
Mean output: ~2.5V
analogWrite(3, 225)
90% duty cycle
Mean output: ~4.5V
[sources: http://arduino.cc/en/Reference/analogWrite; http://arduino.cc/en/Tutorial/PWM; https://learn.adafruit.com/adafruit-arduino-lesson-3-rgb-leds/theory-pwm]
In-Class Exercises
IN-CLASS EXERCISES Today, we are going to walk through multiple motor exercises in class to familiarize ourselves with different types of
motors and motor driver circuitry (e.g., H-Bridges and motor shields).
DC Motors and H-Bridges Learn about the simplest type of motor—the DC hobby motor—and how to use an H-Bridge to control the motor’s direction. http://goo.gl/DShDLJ
Servo Motors Servo motors use PWM for precise control of angular position, velocity, and acceleration. Servo’s also contain additional sensor circuity to sense position. http://goo.gl/aNJeKm
Stepper Motors Stepper motors divide a motor’s full rotation into “steps”—the motors position can be precisely controlled with these steps (assuming the maximum load is not exceeded). Unlike servor motors, typical steppers do not have built-in position feedback circuitry. http://goo.gl/TqxDsI
[sources: https://learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors; https://learn.adafruit.com/adafruit-arduino-lesson-15-dc-motor-reversing/parts; https://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors]
Motor Drivers
ADAFRUIT EXERCISES USE A L293D H-BRIDGE, WHICH IS EQUIVALENT TO THE SN754410
[source: https://www.sparkfun.com/products/315]
SPARKFUN EASYDRIVER: STEPPER MOTOR DRIVER
ARDUINO MOTOR SHIELDS Because many motors have high current requirements (higher than individual ports can support on the arduino)
and can cause problems with voltage spikes when a motor turns on and off, motor shields have become popular,
easy-to-use boards for working with motors.
Sparkfun Ardumoto Motor Shield: $24.95 Uses a L298 H-Bridge IC to control two DC motors up to 2A per channel https://www.sparkfun.com/products/9815
Adafruit Motor Shield v2: $19.95 Drives up to 4 DC motors or 2 stepper motors using transistor-based drivers with 1.2A per channel and 3A peak current and a fully dedicated PWM driver chip http://www.adafruit.com/product/1438
ADAFRUIT MOTOR SHIELD V2 TUTORIAL
[source: https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/overview]
Slip Rings
FLASHGEAR Created by CMSC838f Students Jonggi Hong and Karthik Badam
[source: http://cmsc838f-s15.wikispaces.com/FlashGear]
At first glance, it may seem like the same long wires go from the
Arduino to the LEDs
It’s actually two sets of wires connected through a special device called a
slip ring
These wires rotate freely
HOW DO SLIP RINGS WORK?
Output
[source: http://www.bgbinnovation.com/engineeringAnimation.html]
SLIP RING WITH FLANGE Sold by Adafruit: http://adafru.it/736
[source: https://vimeo.com/38377598]
ADAFRUIT SLIP RING EXAMPLES You can purchase slip rings in all sorts of varieties/configurations—a few different examples are listed below.
[source: adafruit.com]
6-Wire Slip Ring: $14.95 22mm diameter, 6 wires, max 240V @ 2A http://www.adafruit.com/products/736
12-Wire Slip Ring: $19.95 22mm diameter, 12 wires, max 240V @ 2A http://www.adafruit.com/products/1196
12-Wire Miniature Slip Ring: $24.95 12mm diameter, 12 wires, max 240V @ 2A http://www.adafruit.com/products/1195
A BIT MORE ON SLIP RINGS The ITP Vimeo Channel has a quick 3 minute video on slip rings including using a barrel audio jacks or barrel
power connectors for simple slip rings that only need a few connections
[source: http://www.bgbinnovation.com/engineeringAnimation.html]
More Great Resources
NYU ITP PHYSICAL COMPUTING VIDEO SERIES The NYU ITP Video series is now up to 74 videos (all short, ~5 min high-quality videos). The following are related
to motors, which I encourage you to watch. The images/thumbnails are clickable.
[source: https://vimeo.com/channels/pcomp/103165443]
NYU ITP VIDEO SERIES: BASIC CIRCUITS TO DRIVE MOTORS These videos cover basic ICs, like transistors and H-Bridges, that are commonly used to drive motors. The
thumbnails are clickable.
Intro to Using Transistors for Motors (3:53) Using a transistor and an external power supply to control a ‘high load’ motor
H-Bridges (4:27) An H-Bridge is an IC that enables you to reverse your supply voltage (and thus dynamically control a motor’s direction).
High Current Loads (5:12) How to use relays and transistors to control ‘high loads’ like motors
Servo Motor (10:54) Basic introduction to servo motors
NYU ITP VIDEO SERIES: SERVO MOTORS A servo motor allows for precise control of angular position, velocity, and acceleration. A servo consists of a motor coupled
to a sensor for position feedback.
NYU ITP VIDEO SERIES: STEPPER MOTORS A stepper motor is a brushless DC electric motor that divides a rotation into equal steps. The motor ’s position can be
commanded to move and hold at any of these steps without a feedback sensor. The thumbnails below are clickable.
[source: https://vimeo.com/channels/pcomp/103165443; http://en.wikipedia.org/wiki/Stepper_motor]
Stepper Motors: Types (3:01) Covers different types of stepper motors (5-wire stepper, 8-wire stepper, etc.)
Stepper Motors: Unipolar Steppers (5:34) Covers different types of stepper motors (5-wire stepper, 8-wire stepper, etc.)
Stepper Motors: Bipolar w/H-Bridge (3:14) Using an H-Bridge with Bipolar (4-wire) stepper motors.
Stepper Motors: Dedicated IC Drivers (6:54) To get the most out of a stepper motor, you will want to use a dedicated stepper motor IC.