EGH168 Hands-on Lab

Lab 3: Motor Dynamics

 

Introduction ††††††††††††††††††††††††††††††

Background

Most likely your robot will need to use several DC motors to perform different tasks (such as moving or lifting things). In order to select the appropriate motors for your application, it is important to understand their operating characteristics and their dynamic performance.

Purpose

The purpose of this lab is to familiarize you with the dynamic performance of a range of DC motors.

Basic Principles

In this lab write-up, we will cover some basic principles behind:

 

1)            DC Motors,

2)            Pulse Width Modulation,

3)            Stall Current, and

4)            Torque Vs Speed.

Lab Experience

The lab experience will encompass:

1)            Measuring the armature resistance, and

2)            Collecting data using a shaft encoder.

 

BASIC PRINCIPLES

DC Motors

A DC motor has a two wire connection. All drive power is supplied over these two wires -- think of a light bulb. When you turn on a DC motor, it just starts spinning round and round. Most DC motors are pretty fast, about 5000 RPM (revolutions per minute).

 

Pulse Width Modulation

With the DC motor, its speed (or more accurately, its power level) is controlled using a technique named pulse width modulation, or simply PWM. This idea of controlling the motor's power level is achieved by turning the power on and off. The key concept here is duty cycle -- the percentage of "on time" versus "off time." If the power is on only 1/2 of the time, the motor runs with 1/2 the power of its full-on operation.

If you switch the power on and off fast enough, then it just seems like the motor is running weaker -- there's no stuttering. This is what PWM means when referring to DC motors. The Handy Board's DC motor power drive circuits simply switch on and off, and the motor runs more slowly because it's only receiving power for 25%, 50%, or some other fractional percentage of the time.

 

 

Handy Boardís Current and Voltage draw

The Handy Board is designed for motors that will operate at 9.6 volts and draw up to about 1 ampere of current maximum. This includes all of the motors sold by the LEGO Group (the 9v standard motor, 9v gear motor, and 9v micro motor) and a variety of hobby motors which will be used in todayís laboratory exercise.

Stall Current

A motor draws its maximum amount of current when it is stalled (this is sometimes referred to as the "stall current"). A good way to get an estimate of how much current this will be at the Handy Board's rated 9.6v battery supply level is to measure the motor's resistance using a standard VOM (volt-ohm meter), and apply the Ohm's Law formula: current = voltage divided by resistance. Set the meter to its most sensitive resistance scale (typically, 0 to 200 ohms), apply the probes to the motor terminals, and gently rotate the motor shaft by hand until you obtain the smallest possible reading. The idea is to find the static position of the shaft that gives you the lowest resistance and take that as the measurement.

If this reading is nine ohms or more, then the motor should be nicely compatible with the Handy Board. (At 9 volts, a 9 ohm reading would mean a current draw of one amp, the maximum the Handy Board can deliver.) If the reading is less than four ohms, the motor will probably draw too much current and won't work.

Motor Incompatibility with the Handy Board

Please be aware that the Handy Board is not directly compatible with 3v to 4.5v motors found in many toy cars. These inexpensive motors are extremely noisy from an electrical standpoint. Also, they typically will draw several amperes of current, thereby overloading the Handy Board's motor drivers and causing the board to reset.

The Handy Board also is not compatible with motors used in high-end radio control cars. These motors are designed to draw huge amounts of poweró25, 50, or more amperes of starting current.

 

 

Torque Vs. Speed

Important characteristics of a DC motor are usually given as a plot of one of the motorís output quantities versus another. The output quantities of primary interest for a DC motor are shaft torque and speed. Thus, an important characteristic of a DC motor is a plot of its output torque versus speed. The type of DC motors which you will use generally exhibit an operating characteristic called negative speed regulation. This simply means that the motorís speed decreases as the load connected to its shaft increases, and an example of this characteristic is shown in a simplified motor performance plot shown below.

The maximum speed with no load attached is called "no-load speed" (nr). The load that stalls the motor is called the "stall" torque (or sometimes the starting torque)

 

The Torque vs. Speed characteristic of a DC motor can be obtained using a shaft encoder connected to the Handy Board. The shaft encoder is normally used along with an 8-hole bushwheel (one of the erector set components). Every time a hole passes through the shaft encoder two counts are sent through the port of the controller. These signals can be measured in terms of the number per unit time. Knowing this information can give the rotational speed and can ultimately be converted to a speed for the robot.

 

LAB EXPERIENCE

 

Make sketches of equipment used in class; include them in your lab write-up.

Procedure
  1. Use an ohmmeter to measure the armature's resistance of the DC motor you were given. Calculate the "stall" current for the motor's rated voltage.
  2. Connect both the shaft encoder and the DC motorto the appropriate ports onthe Handy Board.
  3. Download the appropriate libraries (use "f" encoder icb routine) onto the Handy Board for the shaft encoder. Use the provided IC code to run the experiment. Modify the code so that the port numbers match with the ports you are using.†† The code will allow you to determine the speed of the motor while a specific torque is being applied.
  4. Run the program to determine the no load speed.
  5. Different weights being lifted at a constant speed can be used to determine points on the Torque vs. speed curve. Work to obtain three data points including the no-load speed and extrapolate to get the stall torque. Express torque in units of "inch-ounces" or in.- oz.Do not stall the motor since it may cause problems to both motor and controller due to high current demand.
  6. Fill out the given table indicating the type of DC motor tested and its obtained "stall" current.
  7. Print copies of your table and your Torque vs. speed graph andturn them in at the end of the period. (One set of copies per team).

LAB REPORT

Format

   Lab reports must be done Individually.

   Follow given lab report format.

   Maximum 4-5 pages (including figures and tables)

 

General Guidelines

   Cover page: title, name, section, team number, date, and professor.

   Include a sketch of the motor test stand.

   .Show the "stall" current your measured and include sample calculation of torque.

   Plot the Torque versus Speed characteristic, with Torque expressed in units of Inch-ounces. Extrapolate to obtain the stall (or starting torque). Use labels accordingly.

   Obtain an equation that allows you to compute speed for a given torque (use appropriate units).

   Discuss briefly the operating characteristics of the motor you tested. Indicate your opinion of this motorís suitability for use in a robot drive system or robot arm mechanism, or other robot applications.

 

 

APPENDIX: SHAFT ENCODER ROUTINES

 

Introduction

There are 2 sets of seven software routines available within the IC libraries to use up to seven shaft encoders, one connect to each of the Handy

Boardís analog inputs. Those routines work with simple break-beam or reflective encoders (shaft encoders), and provide a count of encoder

counts or "clicks" as well as velocity. They count upward regardless of which direction the encoder is turning.

 

The appropriate drivers must be loaded into IC for downloading to the Handy Board in order for the shaft encoder(s) to work. The routines are

named either "sencdr#.icb" or "fencdr#.icb", where the "#" is replaced by a numeral from 0 to 6 (corresponding to an interrupt-driven service

routine for analog inputs 0 to 6).

 

The "s" in the "sencdr#.icb" routine name stands for "slow" while the "f" in the "fencdr#.icb" routine name stands for "fast". The "s" versions

update at 250 times per second (called Hertz or Hz) while the "f" versions update at a rate of 1000 Hz. It is usually recommended to use the "s"

versions unless you are losing counts due to a high shaft rotational speed because the "s" versions take up less CPU time.

 

Installing Software

To install the software driver for a shaft encoder connected to analog port 1, load either "sencdr1.icb" or "fencdr1.icb". In IC, first click on "Load",

and then click on "Download File". Next select the "libs" sub directory in the "IC" directory on drive C (that is, C:\IC\libs\ ). Pull down the list of "file

of type" name extensions and select "*.icb", which is a designation for an "Interactive C binary" file type. Now select the appropriately named

encoder routine and then click on "Open" to load the file into IC.

 

Encoder Routines

For any given encoder routine, there are four globals are defined within IC. The following example assumes that either "sencdr1.icb" or

"fencdr1.icb" has been loaded. Note that there is no difference in the four global definitions between the "s" and "f" versions of the encoder

routines.

 

encoder1_counts -- A running count of the encoder clicks. To reset to zero, simply use an assignment statement; e.g., encoder0_ counts= 0;

 

encoder1_velocity -- A successive differences velocity measure, calculated every 64 milliseconds. It is simply the number of "clicks" which have

been counted during the 64 millisecond time period.

 

encoder1_low_threshold -- The lower limit below which the encoder count is increased. The default value is 50.

 

encoder1_high_threshold -- The higher limit above which the encoder count is increased. The default value is 200.

 

Depending on the performance of your shaft encoder sensor, the encoder click detection thresholds may need to be changed. To change them,

simply assign them a new value. For example, to raise the lower threshold for an encoder connected to analog port 1:

 

encoder1_low_threshold= 75;

 

The default values are restored on system reset, so any encoder threshold assignment statements need to be executed each time the board is

restarted.

 

Shaft Encoder Wiring Schematics