|
|
Line 1: |
Line 1: |
| <metadesc>DC Motors are controlled by a DC voltage where the speed and torque is varied by changing the duty cycle. Learn more at Phidgets.com.</metadesc>
| |
| [[Category:Primer]] | | [[Category:Primer]] |
| __TOC__
| | [[Image:3253.jpg|link=|270px]] |
| | | [[Image:DCC1000.jpg|link=|270px]] |
| <br clear="all" />
| | [[Image:DC Motor Image 3.jpg|link=|270px]] |
| | {{TOC limit|2}} |
| ==Introduction== | | ==Introduction== |
| A DC motor is an electric motor that runs on direct current (DC). They are commonly found in applications as diverse as industrial fans, blowers and pumps, machine tools, household appliances, power tools, disk drives, and many more.
| | [[File:DC Motor and Controller.jpg|link=|200px|thumb|A DC Motor and Phidgets DC Motor Controller]] |
| | | DC Motors are the simplest way to turn electrical power into physical motion. |
| ==Choosing a DC motor==
| |
| [[Image:DCC1002.jpg|link={{SERVER}}/products.php?product_id=DCC1002|right|300px|thumb|<center>Our DCC1002 motor controller</center>]] | |
| There are 3 things to consider when choosing a DC motor.
| |
| *'''Current Consumption''' - You need to make sure that the controller you have is capable of providing enough current to drive your motor at its full rated current.
| |
| *'''Torque''' - Choose a motor that has enough torque to accomplish your goal.
| |
| *'''Speed''' - In the case of fans or RC cars you will need to choose a motor that can spin fast enough to be useful.
| |
| | |
| Note that while Phidgets sells several [{{SERVER}}/?tier=2&catid=19&pcid=16 DC Motors], if your requirements are not met by any of them you can still use one of our [{{SERVER}}/?tier=2&catid=18&pcid=15 DC Motor Controllers] with a motor from another supplier. You just need to make sure that the motor's specs are less than or equal to what the motor controller is capable of driving. For example, the [{{SERVER}}/products.php?product_id=1064 1064 - PhidgetMotorControl HC] has a continuous motor current of 14A, and takes a power supply of up to 15V DC. This means that the current ratings for your third-party motors should not add up to more than 14A, and each motor should be rated for no more than 15V DC if you want the advertised torque and speed of the motor.
| |
| | |
| For more information comparing DC motors with stepper motors and servo motors, see the [[Motor Selection Guide]].
| |
| | |
| ==Types of DC motor==
| |
| ===Brushed DC motors===
| |
| [[Image:3253.jpg|link=|400px|right]]
| |
| Brushed DC Motors are very simple to understand, but very difficult to control precisely. By applying a voltage, or pulsing a voltage rapidly, at the terminals of the motor, current flows through the motor, and it will begin rotating. Depending on the direction of the current, the motor will rotate clockwise or counterclockwise. The brushes inside the motor automatically flip the direction of current inside the motor, allowing the motor to rotate continuously without the external precise control required for stepper motors. This is a huge benefit because it means the cost and complexity of controllers for this type of motor goes significantly down. There are two downsides of letting the motor ‘sequence’ itself.
| |
|
| |
| *It’s not possible to control the timing - the motor will rotate as fast as possible, given it’s construction, the voltage applied, and the load it is driving.
| |
| *The brushes generate sparks and Electromagnetic Interference, and have a fairly limited lifetime.
| |
| | |
| Given that the speed of the DC motor depends on its construction, the load it is driving, and the voltage applied, the only practical way to change the speed of the motor is by changing the applied voltage. Typically this is done by changing the percentage of time the full supply voltage is applied to the motor. By switching the voltage very quickly (a technique called PWM or pulse width modulation), the controller is made smaller, more efficient, and cheaper.
| |
| | |
| ===Linear Actuators===
| |
| [[File:3578_0.jpg|link=|400px|right]]
| |
| A linear actuator is simply a DC motor that has been geared in such a way that it extends and retracts an arm instead of spinning a shaft. Depending on the power of the motor and the reduction ratios of the gearbox, linear actuators range from slow (0.5 inches/sec) to very fast (9 inches/s). Linear actuators are often specified for a certain ''Load Capacity''. This is analogous to a conventional motor's stall torque. | |
| | |
| Linear actuators almost always come with built-in limit switches. These allow the motor to stop trying to extend or retract once it's near the limit. Without limit switches, a linear actuator could easily damage itself by trying to extend beyond its physical limit.
| |
| | |
| Some linear actuators come with a built-in potentiometer or rheostat, allowing it to know the approximate position of the arm. With this information, you could program a control system to actively control the position of the arm.
| |
| | |
| ===Brushless DC motors===
| |
| These motors require the motor controller to deliver AC power. This design is simpler than brushed motors because it eliminates the complication of transferring power from outside the motor to the spinning rotor. Brushless motors have longer life spans and are more efficient than their brushed counterparts, but they are significantly more expensive and require much more complex and expensive controllers to operate.
| |
| | |
| ==Achieving rough control of DC Motors==
| |
| Depending on your application, you may not need precise control of the motor. If your power supply voltage and load are relatively constant, and you can tolerate some small variation in speed, simply tuning the velocity in software to get the results you want will work. Using a DC Motor as a fan is a suitable example- Since the fan only needs to turn on and spin at a constant speed, it doesn't need any sort of control system. However, without the use of an [[Encoder Primer|encoder]] or some kind of feedback device, you won't be able to actively brake the motor or make it hold its position and resist rotation.
| |
| | |
| ==Achieving precise control of DC Motors==
| |
| ===Encoder Input===
| |
| The true acceleration, velocity and number of rotations of a DC motor is controlled by using an [[Encoder Primer|encoder]] to measure the movement of the motor shaft. The encoder rotates with the motor, and produces pulses. An encoder with very high resolution will produces thousands of precisely spaced pulses with a single rotation - an encoder with lower resolution will produce a dozen pulses. Please note we are referring to Quadrature (incremental) Encoders. By having electronics counting the number of pulses, and the time between pulses, it’s straightforward to calculate the velocity of the motor, and how far it has rotated. Use high CPR (counts per rotation) encoders (500 - 1000) for maximum precision.
| |
| | |
| An encoder is often placed on the exposed rear shaft of the motor. In this situation, remember to factor in the gearbox reduction ratio when calculating motor position and speed, since the rear shaft of a motor doesn't spin at the same speed as the gearbox output shaft.
| |
| | |
| ===Control Loops - Overview===
| |
| A software control loop is an algorithm in your software application that receives sensor data, and uses that data to calculate how hard and in what direction it should drive the motor to achieve it's goal. Control Theory is an extremely complex academic field, and in most cases there are simpler methods. If your application is simple - opening a door with two limit switches, for instance, no fancy algorithm is required.
| |
|
| |
| ====PID Loop====
| |
| To control a motor's position and/or velocity under varying load conditions - a common application - the PID loop is a place to start. The performance of the system is determined by tuning three parameters for the Proportional, Integral and Derivative terms. If you are familiar with Control Theory, these parameters can be calculated accurately. For the rest of us, the typical approach is to first tune the Proportional Term, increase the Integral term if necessary, and usually leave the Derivative term at zero. At its most basic a PID controller looks like this:
| |
| :<math>\mathrm{u}(t)=K_p{e(t)} + K_{i}\int_{0}^{t}{e(\tau)}\,{d\tau} + K_{d}\frac{d}{dt}e(t)</math>
| |
| where
| |
| : <math>K_p</math>: Proportional gain, a tuning parameter
| |
| : <math>K_i</math>: Integral gain, a tuning parameter
| |
| : <math>K_d</math>: Derivative gain, a tuning parameter
| |
| : <math>e</math>: Error, or the difference between the current value and the target value
| |
| : <math>t</math>: Time or instantaneous time (the present)
| |
| The proportional term sets how strongly the system responds immediately to the difference between it’s target goal, and it’s current measured performance. For example, if the cruise control on a car is set to 100 kph, and the speedometer indicates the speed is 90 kph, the proportional term sets how much throttle is applied.
| |
| | |
| The integral term allows the control loop to respond more strongly over time to situations where the proportional term is unable to reach the target. The integral term can be thought of as a slowly building impatience within the control loop.
| |
| | |
| The derivative term is used to prevent the control loop from overshooting the target. In practice, it requires very precise measurements to calculate how quickly the loop is approaching the target. In many systems, the measurements are not accurate enough, and the derivative term only causes system instability.
| |
| {| class="wikitable"
| |
| |+ Effects of ''increasing'' a parameter independently
| |
| ! Parameter
| |
| ! Rise time
| |
| ! Overshoot
| |
| ! Settling time
| |
| ! Steady-state error
| |
| ! Stability
| |
| |- style="text-align:center;"
| |
| ! <math>K_p</math>
| |
| | Decrease
| |
| | Increase
| |
| | Small change
| |
| | Decrease
| |
| | Degrade
| |
| |- style="text-align:center;"
| |
| ! <math>K_i</math>
| |
| | Decrease
| |
| | Increase
| |
| | Increase
| |
| | Decrease significantly
| |
| | Degrade
| |
| |- style="text-align:center;"
| |
| ! <math>K_d</math>
| |
| | Minor decrease
| |
| | Minor decrease
| |
| | Minor decrease
| |
| | No effect in theory
| |
| | Improve if <math>K_d</math> small
| |
| |}
| |
| [[File:Step_Response.jpg|link=|400px|right]]
| |
| Where:
| |
| *'''Rise time''' is the time it takes for the system to go from rest to within a certain percentage of its target value. This is usually measured as the 10-90 rise time or the time it takes to go from 10% of the way to the target value to 90% of the way to the target.
| |
| *'''Overshoot''' is how far the system overshoots its target value before turning around to come back like a spring (this can be 0 in some systems).
| |
| *'''Settling time''' is how long it takes for the oscillations in the system to get below a certain amount. Typically this is measured as the 2% or 5% settling time meaning the time for the oscillations to get within 2 or 5% respectively of the target value.
| |
| *'''Steady-state error''' is the distance from the target once the oscillations have reached a constant state. This is usually a small number and for most practical systems can be entirely ignored if the controls have been well chosen. If the parameters are made too large, the steady-state error will become infinite meaning the system has become unstable and will vibrate around the target wildly.
| |
| *A system is considered stable if the steady-state error is finite.
| |
| <br clear = "all">
| |
| | |
| =====Sample Code=====
| |
| Here is some code for a simple PI loop. The <math>K_d</math> term has been left out because it is very difficult to correctly tune and often just leads to instability in the system. For a more in depth look you can also look at our PID loop example {{ARTICLE|DcMotorsPidControl|here}}.
| |
| | |
| <source lang=CSharp>
| |
| Kp = ? //proportional control
| |
| Ki = ? //integral control
| |
| Ko = ? //overall gain
| |
| | |
| MAXOUTPUT = ? //max output wanted by the motor
| |
| DEADBAND = ? //allowable region of error around target
| |
| | |
| dt = feedbackPeriod;
| |
| | |
| feedback = sensor.Value;
| |
| | |
| error = target - feedback;
| |
| | |
| //Create a dual-sided deadband around the desired value to prevent noisey feedback from producing control jitters
| |
| //This is disabled by setting the deadband values both to zero
| |
| if (Math.Abs(error) <= DEADBAND)
| |
| {
| |
| error = 0;
| |
| if (target == 0)
| |
| output = 0;
| |
| }
| |
| else
| |
| output = ((Kp * error) + (Ki * integral))/Ko;
| |
|
| |
|
| |
| //Prevent output value from exceeding maximum output, otherwise accumulate the integral
| |
| if (output >= MAXOUTPUT)
| |
| output = MAXOUTPUT;
| |
| else if (output <= -MAXOUTPUT)
| |
| output = -MAXOUTPUT;
| |
| else
| |
| integral = integral + (error * dt);
| |
|
| |
| errorLast = error;
| |
| | |
| motoControl.motors[0].Velocity = Math.Round(output);
| |
| </source>
| |
| | |
| ====Kalman Filter====
| |
| More sophisticated control loops, like Kalman filters, are built with specialized knowledge of the exact application. In fact, a Kalman filter is not so much a filter as it is a mathematical model of the application, incorporating the laws of physics, and expectations of how the system should behave and respond. With the cruise control example, if the wheels spin on black ice, the PID loop will not respond appropriately. An experienced driver, and a much more sophisticated control algorithm like a Kalman filter will realize that something unusual is happening.
| |
| | |
| For more information on Kalman filters check out this link: http://en.wikipedia.org/wiki/Kalman_filter '''Warning''': if you are not very familiar with state space equations and advanced control theory this will not help you much.
| |
| | |
| ====Impact of Latency on Control Loops====
| |
| There is a time delay required to measure the system (encoders, Back EMF, current, sensors, etc.), receive this data in your application, and send the new target velocity to the Motor Controller. If the system being controlled by the control loop can respond as quickly, or quicker than this time delay, the system will be plagued by oscillations.
| |
| | |
| ==Gearboxes==
| |
| A gearbox is a motor attachment that uses the mechanical advantage of gears to either increase torque at the cost of speed, or increase speed at the cost of torque. Often times, motors are faster than necessary for their application, but lack the required torque. A gearbox can be used to take the excess speed and convert it into extra torque. For example, if a motor had a gearbox with a 5:1 reduction ratio, it would mean that the output shaft of the gearbox will rotate once every five times the motor's shaft rotates. This means that the shaft will rotate five times slower than if it didn't have the gearbox, but it will have five times the torque (minus a bit, since some energy will be lost to friction and heat inside the gearbox). By reducing the speed of the shaft, you also increase its precision. For example, if your motor controller can control the velocity of your motor with a resolution of 1.5% of the motor's maximum velocity, then a 5:1 reduction ratio would allow you to control the output shaft with a resolution of 0.3% of the motor's maximum velocity.
| |
| | |
| In order to achieve high reduction ratios, you need a large number of teeth on the output gear. Since most gearboxes are too small to house a single gear with many teeth, a gearbox will often contain several "stages", where each stage has its own set of gears. Each successive stage reduces the gear ratio a bit more. However, a larger number of stages usually results in more power lost to heat and friction inside the gearbox.
| |
| | |
| ===Types of Gearboxes===
| |
| ====Spur Gearboxes====
| |
| A spur gearbox is one of the simplest types of gearboxes. It is designed simply to provide a specific reduction ratio. Because of its simplicity, a spur gearbox is typically inexpensive. Spur gearboxes will typically be rated for lower torque than other types of gearboxes of the same size, because all of the torque is focused on one gear junction.
| |
| | |
| ====Planetary Gearboxes====
| |
| A planetary gearbox has a more complex gear layout that allows torque to be loaded evenly across multiple planetary gears. They are more expensive, since they contain more gears per stage, but they are also more efficient and have less backlash. Planetary gearboxes are typically rated for higher speed also, since the design is better suited to recirculating oil throughout the gears. A planetary gearbox will often be noisier than a spur gearbox of the same quality, because there are more points of contact inside the gearbox.
| |
| | |
| ===Maximum Strength of Gears===
| |
| Often a gearbox will be rated for a certain amount of torque. This value is the absolute maximum torque that the gearbox should have to endure. You can probably run it above this value, but doing so will drastically shorten the lifespan of the gearbox. If you have a powerful motor that is able to produce more torque than your gearbox is rated for, you must control the motor carefully to ensure that you don't damage the gearbox. Even if your motor is incapable of producing such a large amount of torque by itself, the load it's driving could resist hard enough to damage the gearbox.
| |
| | |
| ====Axial Load and Radial Load====
| |
| =====Axial Load=====
| |
| [[File:Axial_Load.jpg|link=|200px|thumb|A diagram showing the direction of axial load.]]
| |
| The axial load of a gearbox refers to the maximum force the gearbox can endure in a direction parallel to the output shaft. Exceeding this value will reduce the gearbox efficiency and shorten the lifespan. For example, if the motor was being used to turn a miniature carousel from underneath, the weight of the carousel pushing down on the motor's shaft would contribute to the axial load. This type of force often arises from sudden physical impacts to the axle the motor is driving. These types of forces can be mitigated with the use of external bearings.
| |
| <br clear=all>
| |
| | |
| =====Radial Load=====
| |
| [[File:Radial_Load.jpg|link=|175px|thumb|A diagram showing the direction of radial load.]]
| |
| The radial load of a gearbox refers to the maximum force the gearbox can endure in a direction perpendicular to the output shaft. Exceeding this value will reduce the gearbox efficiency and shorten the lifespan. For example, if the motor is being used to turn a pulley, the tension on that pulley would contribute to the radial load on the motor's shaft. This type of force is most often encountered when trying to use a motor to drive an axle directly. Keep in mind that the longer the axle is, the more leverage the radial force will have on the motor's shaft. Even if the motor is mounted close to a tire, if the tire is wide it will still have considerable leverage on the motor's shaft. In applications with high potential for radial load, it would be advisable to drive the axle indirectly.
| |
| | |
| <br clear=all>
| |
| | |
| ==Torque, Speed, Voltage and Current==
| |
| ===Constant Voltage===
| |
| [[File:torque_vs_rpm.png|link=|500px|center]]
| |
| | |
| | |
| In a simple example with no motor controller, when you constantly provide the rated voltage (12V in this example), the motor will try to spin as fast as it can based on the magnitude of the load resisting it.
| |
| The blue line in the above graph illustrates the range of torque/speed values that the motor could operate at depending on the magnitude of the load.
| |
| | |
| At the far left, the load is too heavy; the motor will try to apply the needed force and fail, resulting in zero speed. This is called ''stalling''. When stalling, the motor is pushed to its limit, causing it to consume the maximum possible amount of current for this particular supply voltage (This value is known as ''Stall Current''). Since the motor is consuming the highest possible electrical power, it also outputs the highest possible mechanical power (''Stall Torque'') while stalling. It is not a good idea to stall a motor, because it will very quickly overheat from the increase current draw and eventually burn out. When using a motor controller, the board will often have a maximum current rating based on the board's ability to dissipate heat. You could add heatsinks, fans, or other cooling devices to the board to increase the current limit, but do so with caution. Unless you have a way of monitoring the temperature of the driver chip during operation, you have no way of knowing how far beyond the rated specification you can go.
| |
| | |
| At the far right, the motor shaft is spinning freely, with no load other than the force required to spin the shaft. The motor will keep spinning faster and faster, until the back EMF generated by the motion of the motor reduces the current and limits the speed to a maximum value.
| |
| | |
| Since torque and RPM are linearly related, these two extreme cases represent points that create a line along which the motor can operate. Reducing load (and therefore the required torque) increases speed, and vice-versa. When voltage is held constant, the motor can only operate along this line, which is inconvenient when you want to vary speed at a constant load (for example, speeding up or slowing down a remote-controlled car).
| |
| | |
| ===Dynamic Voltage===
| |
| [[Image:torque_at_different_voltages.png|link=|500px|center]]
| |
| | |
| | |
| Building on the previous example, lets say that we're using a motor controller that enables switching between three voltage levels: 8V, 10V and 12V. Please note that while it's acceptable to provide less than the rated voltage, you should not supply a motor with significantly more than the rated voltage. In this example, assume the motor is rated for 12V.
| |
| | |
| When you change the voltage, the relationship between RPM and torque changes. A lower voltage produces a second line parallel to the first, with a lower stall torque and free-spinning RPM, for the motor to operate across.
| |
| | |
| At a constant load, decreasing the voltage means decreasing the speed, as illustrated by the three black points on the green line.
| |
|
| |
|
| ===Pulse-Width Modulation===
| | They can be found in all types of applications, from power tools, to remote control cars, to large industrial machinery. |
| [[Image:torque_at_different_pwm.png|link=|500px|center]]
| |
|
| |
|
| | ==Brushless DC Motors vs Regular DC Motors== |
| | [[File:BLDC Motor and Controller.jpg|link=|200px|thumb|A BLDC Motor and Phidgets BLDC Motor Controller]] |
| | Brushless DC (BLDC) Motors are similar enough in control principles to DC Motors when using the right Phidgets that they can be treated the same as basic DC Motors for this discussion. |
|
| |
|
| Now, constantly changing the amount of DC voltage supplied to the motor is difficult without expensive hardware and large efficiency losses.
| | Brushless DC motors tend to have better efficiency, power and longevity than their standard (brushed) counterparts, while simply requiring more wiring. There are more internal complexities, but these differences are handled automatically by using the correct motor controller. |
| The most effective solution to this problem is called '''pulse-width modulation''' (PWM for short).
| |
|
| |
|
| PWM involves giving the motor an AC signal that varies from zero volts to the full amount (12V in this example).
| | ''Phidgets brushless DC motor controllers only support sensored BLDC motors, which are the most common type for serious applications.'' |
| For each period of the PWM waveform, the value is high for a certain percentage of time. This percentage is called the '''duty cycle'''.
| |
| For example, a waveform that is high (12V) for two thirds of each period and low (0V) for one third of each period would have a 66% duty cycle, as shown in the waveform in the diagram.
| |
|
| |
|
| Normally you might expect these sudden pulses of power to result in stuttering or jerky movements in the device being powered. However, since motors are essentially large coils of wire, they act as inductors which have a smoothing effect on this signal. Thus, by providing a 12V PWM signal at a 50% duty cycle, you can simulate the effect of using a 6V power supply. It is very easy and inexpensive to implement PWM, and you can choose virtually any duty cycle (limited by how precisely the controller can generate the PWM waveform), which means the motor could be operated at any point on the graph below the 100% line.
| | ==Basic Principles== |
| | [[File:DC Motor Basic Image.jpg|link=|200px|thumb|A DC Motor spins when voltage is applied.]] |
| | At the most basic level, a DC motor spins by applying voltage across the motor terminals. Apply more voltage and the motor spins faster. As the motor gets loaded down, it will be forced to spend more energy fighting the load, and will slow down accordingly. |
|
| |
|
| ===Peak Efficiency===
| | The force applied by a DC motor at a given voltage reduces as it spins faster. We’ll cover the reasons later, but the result is that for any applied voltage and motor loading, the motor will accelerate to a speed that balances the force required to move the motor. |
| Key concepts:
| | <br/> |
| [[Image:torque_safe_zones.png|link=|500px|center]]
| |
|
| |
|
| | The graph below shows the relationship between motor voltage and speed of rotation for a motor we tested, captured in the Phidgets Control Panel. |
| | [[File:DC Motor Simple Control Graph.jpg|link=|500px|center|Controlling a DC Motor]] |
|
| |
|
| The above graph is separated into three sections based on the size of the load that the motor is working against (and consequently the amount of torque being applied).
| | ==Basic Control== |
| | In this way, you can control a DC Motor’s speed by adjusting the applied voltage. This can be done using DCMotor Phidgets to drive a motor forwards or backwards at different speeds. |
|
| |
|
| The green zone indicates the range of torque values where the motor is running at peak efficiency. This zone starts at the rated torque for the motor, and continues down to the maximum speed (free spinning shaft) point. When in this zone, the motor has the highest efficiency (conversion of electrical to physical power), and will draw current equal to the rated current value, assuming the motor is also running at the rated voltage. In order to maximize the lifespan of your motor, you should choose a motor that has a high enough rated torque that your application runs in this zone most of the time.
| | [[File:DC Motor Simple Control.jpg|link=|center|Controlling a DC Motor]] |
|
| |
|
| The brown zone indicates the range of torque values where the motor is running at reduced efficiency. This zone starts at the physical limit of the motor and continues down to the rated torque. If the motor has a gearbox, the upper limit of this zone is usually the torque limit of the gearbox. The motor can be operated in this zone occasionally, for short periods of time. If the motor is run in this zone constantly, it will reduce the lifespan of the motor significantly. You may be familiar with the "burned" smell of a DC motor that's running too hard and overheating- this is not from high speed, but from low speed and high torque.
| |
|
| |
|
| The red zone indicates the range of torque values where the motor is stalling or nearly stalling. This zone starts at the stall torque for the motor, and continues down to the physical limit. If the motor has a gearbox, operating in this range will cause extreme wear on the gears, and the gearbox will eventually seize if left in this zone too long. Running a motor in this zone will drastically reduce its lifespan due to overheating.
| | A DC motor controller Phidget allows you to control the relative speed of the motor by setting a fraction of full power to give to the motor. For many applications this is already a good enough approximation of controlling the motor’s speed for basic control. |
|
| |
|
| ===Comparing Motors=== | | ==Control Methods== |
| [[Image:different_motors_PWM.png|link=|500px|center]] | | [[File:DC Motor with Encoder.jpg|link=|200px|thumb|An encoder attached to a DC Motor]] |
| | You can pair a DC motor with data from any number of sensors to move mechanical systems in various ways. We won’t cover the specifics of how to use them here, but Phidgets users have had success controlling DC motor based systems using a wide array of sensors, from rotation sensors, to draw-wire sensors, to spatial tilt sensors. |
|
| |
|
| In the above graph, we compare two DC motors: the [http://www.phidgets.com/products.php?product_id=3264 3264] and the [http://www.phidgets.com/products.php?product_id=3267 3267].
| | The most direct way of measuring the position of your motor with Phidgets is using an encoder interface. For the purposes of this document, an encoder is simply a device that measures position information in a way that digital systems can understand. |
| Both motors have approximately the same stall torque, as seen by the intersection of the blue lines at the top of the graph. Both motors have a similar rated torque also, but the 3267 has a much higher rated RPM (as shown by the green lines).
| |
|
| |
|
| From looking at the motor specifications, you might simply think of the 3267 as a motor with the same torque as the 3264, but with more RPM. This is true, but you could also think of it this way: The 3267 could be run at the rated RPM of the 3264, but at a much higher torque (as evidenced by the red lines). Keep in mind, however, that this would cause the 3267 to run outside of its [[#Peak Efficiency|peak efficiency zone]]. The important thing to take away from this graph is that torque and speed go hand-in-hand, and you don't really get the full picture by simply comparing stall torques, rated torques or rated RPM values.
| | DC Motors sold by Phidgets have the option to attach an encoder to measure their rotation, and most Phidget motor controllers have a plug for an encoder built-in. Modern Phidgets motor controllers have built-in features to use this information to produce smooth motion. |
|
| |
|
| ===Example: Two-motor Vehicle Control=== | | ==Phidgets Built-In Position Control== |
| [[Image:constant_velocity_hard.png|link=|500px|center]]
| | You can use the built-in encoder input on many recent DC Motor Phidgets to control the position of your system directly, using the MotorPositionController feature provided by Phidgets. |
| | <br><br> |
| | <center>{{#ev:youtube|0cQlxNd7dk4|||||rel=0}}</center> |
| | <br> |
| | This feature allows you to set up your system so you only need to tell the motor where to go with a given speed and acceleration, and it will go there. |
|
| |
|
| In this example, we will illustrate how PWM control can aid in navigation for a two-motor robot (each motor drives one side of the vehicle).
| | ==Torque, Current and Power== |
| | Now that we have covered the basics of using DC motors and how easily they can be controlled with Phidgets, we can cover more in-depth concerns, such as torque curves and power consumption. |
|
| |
|
| The above graph illustrates a major weakness of using a DC motor in an application with unpredictable, inconsistent torque requirements. | | [[File:DC Motor Current vs Supply.jpg|link=|200px|thumb|A DC Motor Draws More Current Under Load]] |
| | A DC Motor’s torque is proportional to the electrical current flowing through it. The more current, the harder the motor pushes to get moving. A higher supply voltage will try to push more current, and allow a higher maximum torque for a given motor. |
|
| |
|
| Imagine our vehicle is driving in a straight line on level terrain. The motor controller is telling the motors to go at a specific speed (through PWM), and the vehicle doesn't have any problems with this. But when one of the wheels encounters some difficult terrain (bumpy, slippery, etc), that wheel is forced to operate at a higher torque value along the blue line, which results in lower speed. When the wheels on one side of a vehicle rotate more slowly than the wheels on the other side, it causes the vehicle to turn in the direction of the slower wheel.
| | As a DC motor spins faster, it begins trying to generate its own current to oppose the motion. So long as the motor is powered, this results in a reduced current driving the motor. Under no load, the motor will spin up to the point where this generated electromotive force (EMF) cancels out the supply, and the system consumes barely any power while spinning as fast as it can. |
|
| |
|
| [[Image:velocity_via_pwm.png|link=|500px|center]]
| | As the motor gets loaded down, the motor slows allowing more current to flow and generating more torque to fight the load. This tendency of the motor to consume more current at low speeds means that the DC Motor will work harder when it’s weighed down, and when it’s starting up. |
|
| |
|
| Now, in a scenario with a constant torque value, the motor controller can only change the PWM duty cycle. By increasing the duty cycle, you increase both the torque and the RPM (as shown by the black line vector components). In this case we cannot change RPM and torque individually.
| | [[File:DC Motor Overload.jpg|link=|200px|thumb|Thermal Image of a Stalled DC Motor]] |
| | Once the motor is loaded down to the point it can no longer spin, it will consume as much current as it can, generating maximum torque, but potentially overheating in the process. Overloading an electric motor to this point is called a “stall” and should be avoided. |
|
| |
|
| [[Image:velocity_via_load.png|link=|500px|center]]
| | To prevent problems caused by this kind of runaway current, Phidgets DC Motor Controllers have a current limiting feature. This can be useful in both preventing overheating and/or automatically limiting the available torque if desired. |
|
| |
|
| In this case, the PWM duty cycle is held constant, but the load is changed (in this example, because of difficult terrain). When this happens, both RPM and torque change, and we're unable to change torque or RPM individually to compensate and keep moving at a constant speed. If we combine the concepts of these previous two graphs, we can devise a method to control the RPM for a changing load.
| | ==Braking== |
| | [[File:DC Motor Braking.jpg|link=|200px|thumb|A DC motor can be made to passively resist fast movement]] |
| | Another result of the electromotive forces (EMF) caused by the spinning motor is that by connecting the motor terminals together when it’s spinning, the motor will produce a current (and thus a force) opposing the rotation of the motor. This method of using the motor’s own rotation against itself is called braking. |
|
| |
|
| [[Image:constant_velocity_strategy.png|link=|500px|center]]
| | When braking, a faster rotation generates a higher EMF, resulting in a higher braking current, and the motor will brake harder when it’s spinning faster. |
|
| |
|
| In this solution, we attach [[Encoder Primer|encoders]] to each wheel so we can tell when it has encountered an obstacle that is decreasing its speed (red line in the graph).
| | A DC Motor that is not moving will generate no passive braking, as no motion results in no EMF being generated, and thus no current and no torque. |
| When the speed decrease is detected, the motor controller bumps up the PWM duty cycle of that motor by an amount that will result in both wheels having the same RPM (green line in the graph).
| |
| When the wheel passes the obstacle, the reduction in the load will cause the speed to increase, and the motor controller will detect this increase and bring the PWM duty cycle back down to normal.
| |
| In order for this solution to work, the motors need to operate at a lower default PWM duty cycle so that increasing the duty cycle to bypass difficult terrain is an option.
| |
|
| |
|
| ===Wire Length===
| | A Phidgets DC Motor controller can be used to control the braking force applied by your DC motor. |
| Since the DC motor controller is sending a fairly simple signal to the motor, interference from having long wires is not a big concern. You should be able to have quite long wires between your motor and controller. For more information, see the [[Effects_of_Long_Wires|effects of long wires]] page.
| |
Introduction
A DC Motor and Phidgets DC Motor Controller
DC Motors are the simplest way to turn electrical power into physical motion.
They can be found in all types of applications, from power tools, to remote control cars, to large industrial machinery.
Brushless DC Motors vs Regular DC Motors
A BLDC Motor and Phidgets BLDC Motor Controller
Brushless DC (BLDC) Motors are similar enough in control principles to DC Motors when using the right Phidgets that they can be treated the same as basic DC Motors for this discussion.
Brushless DC motors tend to have better efficiency, power and longevity than their standard (brushed) counterparts, while simply requiring more wiring. There are more internal complexities, but these differences are handled automatically by using the correct motor controller.
Phidgets brushless DC motor controllers only support sensored BLDC motors, which are the most common type for serious applications.
Basic Principles
A DC Motor spins when voltage is applied.
At the most basic level, a DC motor spins by applying voltage across the motor terminals. Apply more voltage and the motor spins faster. As the motor gets loaded down, it will be forced to spend more energy fighting the load, and will slow down accordingly.
The force applied by a DC motor at a given voltage reduces as it spins faster. We’ll cover the reasons later, but the result is that for any applied voltage and motor loading, the motor will accelerate to a speed that balances the force required to move the motor.
The graph below shows the relationship between motor voltage and speed of rotation for a motor we tested, captured in the Phidgets Control Panel.
Basic Control
In this way, you can control a DC Motor’s speed by adjusting the applied voltage. This can be done using DCMotor Phidgets to drive a motor forwards or backwards at different speeds.
A DC motor controller Phidget allows you to control the relative speed of the motor by setting a fraction of full power to give to the motor. For many applications this is already a good enough approximation of controlling the motor’s speed for basic control.
Control Methods
An encoder attached to a DC Motor
You can pair a DC motor with data from any number of sensors to move mechanical systems in various ways. We won’t cover the specifics of how to use them here, but Phidgets users have had success controlling DC motor based systems using a wide array of sensors, from rotation sensors, to draw-wire sensors, to spatial tilt sensors.
The most direct way of measuring the position of your motor with Phidgets is using an encoder interface. For the purposes of this document, an encoder is simply a device that measures position information in a way that digital systems can understand.
DC Motors sold by Phidgets have the option to attach an encoder to measure their rotation, and most Phidget motor controllers have a plug for an encoder built-in. Modern Phidgets motor controllers have built-in features to use this information to produce smooth motion.
Phidgets Built-In Position Control
You can use the built-in encoder input on many recent DC Motor Phidgets to control the position of your system directly, using the MotorPositionController feature provided by Phidgets.
This feature allows you to set up your system so you only need to tell the motor where to go with a given speed and acceleration, and it will go there.
Torque, Current and Power
Now that we have covered the basics of using DC motors and how easily they can be controlled with Phidgets, we can cover more in-depth concerns, such as torque curves and power consumption.
A DC Motor Draws More Current Under Load
A DC Motor’s torque is proportional to the electrical current flowing through it. The more current, the harder the motor pushes to get moving. A higher supply voltage will try to push more current, and allow a higher maximum torque for a given motor.
As a DC motor spins faster, it begins trying to generate its own current to oppose the motion. So long as the motor is powered, this results in a reduced current driving the motor. Under no load, the motor will spin up to the point where this generated electromotive force (EMF) cancels out the supply, and the system consumes barely any power while spinning as fast as it can.
As the motor gets loaded down, the motor slows allowing more current to flow and generating more torque to fight the load. This tendency of the motor to consume more current at low speeds means that the DC Motor will work harder when it’s weighed down, and when it’s starting up.
Thermal Image of a Stalled DC Motor
Once the motor is loaded down to the point it can no longer spin, it will consume as much current as it can, generating maximum torque, but potentially overheating in the process. Overloading an electric motor to this point is called a “stall” and should be avoided.
To prevent problems caused by this kind of runaway current, Phidgets DC Motor Controllers have a current limiting feature. This can be useful in both preventing overheating and/or automatically limiting the available torque if desired.
Braking
A DC motor can be made to passively resist fast movement
Another result of the electromotive forces (EMF) caused by the spinning motor is that by connecting the motor terminals together when it’s spinning, the motor will produce a current (and thus a force) opposing the rotation of the motor. This method of using the motor’s own rotation against itself is called braking.
When braking, a faster rotation generates a higher EMF, resulting in a higher braking current, and the motor will brake harder when it’s spinning faster.
A DC Motor that is not moving will generate no passive braking, as no motion results in no EMF being generated, and thus no current and no torque.
A Phidgets DC Motor controller can be used to control the braking force applied by your DC motor.