Skip main navigation
We use cookies to give you a better experience, if that’s ok you can close this message and carry on browsing. For more info read our cookies policy.
We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Skip to 0 minutes and 1 secondHi. This is Richard Mitchell with a video explaining how we can set the speed of a motor on our robot, and how we can measure that speed. Now, there are many different types of motor, but here we're going to talk about DC motors, which are often used on mobile robots. We're going to consider how we set the speed of the motor we want, which we do by applying a suitable voltage. But not, perhaps, as you might expect. And then we'll explain how we can measure the actual speed, which is needed if we are to control the speed of the robot suitably. Now, the basic idea of the motor is quite straightforward.

Skip to 0 minutes and 38 secondsThis represents the motor, and we apply a voltage to it. This generates a circuit, and current will flow through that circuit into the motor. This generates a torque, which is a rotating force, which causes the motor to rotate at a particular speed. And the bigger the voltage, the faster it goes round. The motor is connected to a wheel, the wheel turns. And a Robot typically has at least two motors and wheels, and you can drive it to move it along. That's seen as fine, except computers are best at outputting only two voltages, a high one and a low one. So how are we going to get different speeds? And also, can we get the motor to go backwards as well?

Skip to 1 minute and 20 secondsWell, let's look at a web page which helps us do. Here, we see the web page, and we've got a motor going round in this particular direction. And that's achieved by applying a so-called Pulse Width Modulation signal. Here, you output two voltage, a high and low, but here, we see half of the time, the voltage is high, half the time it is low. So on average, it's at 50%, and that sets the speed. And if we want to speed up, we arrange that the voltage is high for a longer period, and low for a shorter period. And you can see the motor is going round more quickly. Slow it down.

Skip to 1 minute and 57 secondsNow it's high for a short time, low for a longer time. Put it back to where it was in the beginning. So that's fine. The motor turns in a clockwise direction. What happens if we want to go anticlockwise? Well, at the moment, this PWM signal is connected here, and then this switch is closed, so that PWM signal goes to the plus end of the motor. The minus end goes via this switch to ground. To go the other way, we have to change the switches in this bridge circuit. So reverse the motor. Now you see the PWM signal is corrected to the minus end, and the plus end goes to ground. And this is turning round in the opposite direction.

Skip to 2 minutes and 39 secondsReverse it again, you go back the same way. So the PWM signal will set the speed we want the motor to go, but the actual speed may not equal the desired speed. So to ensure that it does, we need to measure the actual speed. But how? Well, for this, we utilise the fact that when the motor rotates, it generates a voltage itself. Is called the back EMF, or electromotive force. And the faster the speed, the bigger the voltage. And we need to measure the back EMF.

Skip to 3 minutes and 14 secondsThis, we do by applying an extra resistor to the circuit. So we've got the PWM signal here, the resistor, and then the motor. And the motor generates the EMF signal, and so forth. Now, standard electronics law tells us that the voltage from the back EMF, here, equals the voltage across the resistor plus the PWM signal. During the cycle of the PWM, when the VPWM is 0, that means that the back EMF that we want to measure is simply the voltage across the resistor. So all the computer needs to do is to measure what VR is when the PWM signal is 0, and that will tell us what the speed is.

Skip to 4 minutes and 4 secondsSo we've seen how we can command what the speed should be, which is what we wanted to do, actually illustrated in the web pages in Week 1, and that's achieved by the robot's computer generating a PWM signal, whose average value sets the voltage which determines the speed we want. As I say, the actual speed may be less, and we'll explain that more next week, so we need to measure the actual speed, which we can do by the computer measuring the voltage across that extra resistor when the PWM signal is 0.

Skip to 4 minutes and 35 secondsFeel free to go to the web page and see for yourself how the PWM signal changes as you want faster speeds, or slower speeds, and you'd want to change direction.

How to set and measure motor speed

To be able to set the desired speed of a robot, we need to first measure the speed of it.

In the video above, Richard explains how we set and measure the speed of the robot with a demonstration of PWM (Pulse Width Modulation).

If you would like to investigate PWM for Setting Speed further, you can take a closer look at Pulse Width Modulation web page.

Share this video:

This video is from the free online course:

Begin Robotics

University of Reading

Contact FutureLearn for Support