MASTERCLASS

# Robot joint Control

### Lessons

#### Share

#### Transcript

A rotary electric motor can be modelled by this electrical schematic. Important components of the model are a resistor and this is the resistance of the armature coil.

That's the electromagnet in the rotor. The other component is a voltage source. A motor can be used in reverse as a generator but even when it's acting as a motor the generator is producing a voltage that opposes the applied voltage and this is referred to as the back EMF. And this voltage is proportional to the rotational speed of the motor.

The current that flows into the motor is given by the difference between the applied voltage fee and the back EMF voltage VB divided by the armature resistance RA.

The torque generated by the motor is proportional to the current that flows through the motor and the proportionality constant is KM. These two KMs have exactly the same value though they're written typically with different units. This one here has units of volts seconds per radians. This one here has units of Newton meters per Amp but with a little bit of effort you can show that these two units are in fact equivalent.

There are two ways to control an electric motor. We can control the voltage or we can control the current.

Let's first of all look at the voltage control case. So we're going to adjust the voltage that we apply to the motor and we can do that using a power amplifier or something like a pulse with modulator. And we'll look at that shortly. I've written down all the relevant equation and if I rearrange this equation we can get an expression for the rotational speed omega in terms of the applied voltage the current and so on.

Imagine that the motor starts at rest and I apply a voltage, current flows and the motor will start to increase in speed. As it does so the back EMF will increase and eventually the back EMF will be equal to the applied voltage and then no current will flow into the motor. The motor will then stop accelerating and when this occurs we have a simple expression for Omega it's the applied voltage divided by the motor constant.

Now in practice the motor has got friction and in practice that makes the speed of the motor less than the value shown here. The important take away is that the speed of the motor is proportional to the applied voltage. The most common way to drive an electric motor today is with what's called an H bridge circuit.

It comprises four switches and they’re typically some kind of field effect transistor. They're very small and they're very efficient when they're closed they have a very very small resistance.

As shown here no current can flow through the motor but if I close two of the switches then we see the current will flow through the motor in one particular direction and the motor will rotate in the forward direction. If I open those two switches and close the other two, current flows in the other direction through the motor and the motor rotates backwards.

One of the advantages of these electronic fed switches is that we can them on and off very quickly. The voltage that's applied to the motor can be the maximum value for a time period which we refer to as the on time and there can zero for what we refer to as the off time. And the electronics which is driving the H bridge circuit is able to control the duty cycle. That's the ratio of the on time to the period and this can vary from the voltage being always off to the voltage being always on.

The motor responds to the average voltage. So here's an example where the duty cycle is relatively low that is the voltage is off for more time than it is on. And the motor sees an effective average voltage shown by the red line as I increase the duty cycle the average voltage rises and I can increase the duty cycle even further.

So by adjusting the duty cycle which is something that a micro controller can do quite easily, we can control the average voltage in an almost continuous fashion. This switching happens very very quickly, typically a frequency of at least 1 kHz.

An alternative way of controlling the electric motor is to regulate the current that flows into the motor. There are many ways to create a control current source.

A common way is to take a control voltage source and apply a current feedback loop. The torque generated by the motor is proportional to the current flowing through the motor. The torque is also equal to the rotational inertia of the motor multiplied by its rotational acceleration. This is the rotational equivalent of the equation F = MA. Now we can write an expression for the rotational acceleration of the motor in terms of the current flowing into the motor.

We can model a DC motor as a resistor and a voltage source, and then understand the implications of controlling either the voltage or current supplied to the motor. We also learn about common methods for motor control such as the H-bridge driver and pulse width modulation.

### Skill level

Undergraduate engineering

#### Undergraduate-level engineering

This content requires an understanding of undergraduate-level engineering; for example, dynamics, classical control theory - PID, poles, zeros, probability theory - random variables and Bayes’ rule.

#### Undergraduate-level mathematics

This content requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.