Skip to 0 minutes and 1 secondIn this video, we're going to explain why it is we need speed control by talking about the factors which affect the speed of a robot. Now, we've seen how we can set the desired speed of a robot by generating a PWM signal, which we connect to the motor, whose average value determines the motor speed. And the direction is set by the bridge circuit. However, the actual speed may not be the same as the desired speed. Let's explain why and, in a later section, we will explain how we control the motor to address these issues. So the basic motor operation is we apply a voltage, v. That's the PWM signal.

Skip to 0 minutes and 38 secondsThat generates a current, I, which generates a torque, which makes the motor turn with a speed, O. The motor speed, therefore, depends on v. And as v becomes bigger, so does the speed, O. Well, we can describe this by a simple mathematical model, which is to say that O is some constant, k times v, where the k depends on the motor. And in the web page simulation we're going to use, k is 1/8, or 0.125. But we need to think about friction. The motor is connected to a wheel. And if we hold the robot with its wheel in the air, the speed is, indeed, k times v.

Skip to 1 minute and 14 secondsBut when we put it on the surface, friction between that surface and the wheel will slow it, and the friction depends on the surface. For instance, carpet slows the wheel more than, say, wood. The faster the speed, it turns out, the bigger the friction. So our mathematical model now becomes more sophisticated. O is k times v, as before, but minus F, for frictional effect, times the v. Then we need to think about going up hills. When the robot is going uphill, gravity will slow it. Now, what about gravity? Well, the robot's weight, which is its mass times g, means there's a vertical force pulling the robot down.

Skip to 1 minute and 55 secondsAnd a component of that force is parallel to the slope and, therefore, in the opposite direction to which the robot is travelling. And this will slow the robot. And it turns out, the steeper the slope, the greater this force. In fact, if the slope is of length, L, and it rises by an amount, h, then the slowing weight is mass times g times h/l. That means our model now becomes as follows. So if the robot is in a slope with friction, F, where it rises by an amount, h, while travelling a distance, l, the robot mass is m.

Skip to 2 minutes and 28 secondsBut the speed, O, when you apply the PWM voltage, v, is O is k times v, minus F times v, minus m times g, times h/l. If the robot is going downhill, its weight will speed it up. So the model becomes k times v, minus F times v, as before, but now it's plus m times g, times h/l. And if we put some numbers in, we get to see what happens. So let's suppose we put v is 24 and k is 0.125, as before, and there's no friction, then O is 24 times 0.125, which is 3, which is the speed that we want.

Skip to 3 minutes and 6 secondsBut if the robot is on a surface with friction F equals 2 and the slope is flat, put the numbers in. O is now 2.75, which is less than the 3 we want. And then if the robot goes uphill, where it rises by an amount h equals 1 while travelling a distance, that is 2, and m is 0.1, put the numbers in. O is now 2.26, much slower than 3. And if the same robot is going on the same surface downhill, the speed becomes 3.24, which is too fast. So clearly, the speed is varying a lot. Now let's watch this in action on a simulation of the robot.

Skip to 3 minutes and 49 secondsSo here is the web page which we use, not only to illustrate the material here, but also what happens when we apply control to the robot. So if I scroll down to see the actual area, we see a landscape. The robot is here. And we put the input voltage to be 24, because k was 1/8. Means we're trying to get a speed of 3. Now if I press start run, we see the robot moving along. It's now going a bit slower. It speeds up and speeds up again. Can't necessarily see that but, fortunately, the web page gives you a graph showing the speed varying with time.

Skip to 4 minutes and 30 secondsSo here corresponds to when it was flat, slower speed when it's going uphill, and then a faster speed when it's going downhill. So this is the simulation.

Skip to 4 minutes and 46 secondsSo in summary, we've developed a simple mathematical model of our robot though, in reality, it's actually much more complicated than this. And the key point is that we've seen that, when we consider friction and whether the robot is going uphill or down, the speed can be much different from the speed that we specified using the PWM signal. How can we address this? Answer; we use feedback control. I'm now going to illustrate how that can be done when the human is the controller and when we do it automatically. But that's for a later video.

# Why do we need control?

Last week, we saw that by using Pulse Width Modulation (PWM) we can generate the correct average voltage so that the motor rotates at the correct speed.

We also noted how switches arranged as a bridge circuit could be used to set whether the motor rotates left or right and how we could measure the speed, and stated that would be needed for control.

But do we need control? The actual motor speed is not necessarily what we intended when we set a specific PWM signal.