The beginners tutorial explained how DC motors worked and how to control them with a micro controller or the Robocore. This intermediate tutorial will look a bit more closely at the DC motor and its characteristics.
We learned that reversing the polarity of the supply current controls the direction the motor rotates. This is not the only technique that can be used to control the motor. Changing the voltage supplied to the motor can also vary its speed. But your motor controller only has 2 settings, on and off, so how can the voltage be temporarily changed? Enter a technique called pulse width modulation.
Pulse Width Modulation:
This is a technique where pulses of electricity are fed into the motor at a fairly fast rate to produce an average voltage effect. To help us understand this lets look at a few examples.
Lets say that for our pulse we'll turn on 10 volts for 40mS (40 thousandths of a second) and then we'll turn the voltage off for 10mS. If we repeat this cycle over and over the voltage is changing so quickly that the on's and off's become an average voltage. In this case the voltage is off for 20% of the time, so the average voltage to the motor is 80% of 10 volts, which is 8 volts. This will cause the motor to run slower than at 10 volts.
Therefore the speed of the motor can be changed by varying the amount of time the current is on and the current is off.
The DACPin command can be used with the motor drivers on the Robocore. Full syntax for the command can be found in the document files supplied with the Basix X software but the basic command is:
Call DACpin(Pin, Voltage, DACcounter)
Pin = The output pin
Voltage = Byte value between 0 and 255
DACcounter = The function must return a value in this variable. If more than one pin is using DACPin then each pin must use a differently names variable.
The actual results obtained once the pulse has run through the motor driver chips will vary depending on the voltage used but typically a 25% reduction in power can be achieved. With most DC motors any further reductions will not supply the motor with enough power to operate.
Torque:
At this point I would like to say a little bit about torque. Torque is a measurement of the motors power. The higher the torque of the motor the more weight it can move. DC motors provide different amounts of torque depending on their running speed, which is measured in RPM (revolutions per minute). At low RPM DC motors produce poor torque, and generally the higher the RPM, the better the motors torque.
So what does this mean in practical robotics terms? Lets say that a robot is propelled by 2 DC motors. Using gears to reduce the overall speed of the robot and running the motors at top speed will result in the most power being delivered to the wheels. Using pulse width modulation too slow the motor will result in the motors not delivering less torque to drive your robot forward.
Pulse width modulation is still a very useful technique to use as it gives the programmer control over the robots speed purely using software. Sometimes you might want to slow your robot down a little, for reversing away from obstacles or turning on the spot for example
No comments:
Post a Comment