# Indirect velocity measurement of permanent magnet DC motor

**Indirect velocity measurement of permanent magnet DC **

**motor **

**Abstract.** In this paper a method of indirect velocity measurement for a low

cost mobile robot is presented. The odometry is highly used to determinate the

relative displacement of a robot; so we use encoders in order to measure the

robots wheels speed of rotation, and then turn that information in the

displacement performed by the robot. But the encoders are an expensive

resource and so the aim of this work is to show that it is possible to indirectly

obtain a close number of the speed of a DC motor by using cheaper sensors. For

that, we need to get to know some parameters of the motor and get other

quantities such as the current and voltage on the motor driver.On this article there will be introduced: the equations that rule the permanent

magnets DC motor; the description of the hardware used on this essay; the

characterization of the measurement of the current and voltage of the driver; the

connection between these measures and the voltage and current to the motor

terminals, and as the error affects this same measures; and even the description

of the experimental method to determinate the motor parameters. Next, and to

validate the method introduced in here, we will compare the results of the

indirect measure of the DC engine speed with the direct measure that uses

encoders, with the engines in different charge conditions. In the end, we will

show the conclusions of this work.## 1 Introduction

This paper is part of a project that aims the development of a robot with reduced costs. Reduced cost robots are greatly to be desired due to an recent and increasing interest of applications in the field of education [1], general services [2] and junior robotic competitions [3].

In this application we pretend that the robot has autonomous movement confined to a limited area predefined by user. In a perspective of total cost reduction of the robot, the traditional encoder based odometry approach isn’t the best one. So, another approach will be the use of cheaper measuring methods of voltage (Va) and current (Ia) of the robot motors. With this data, and using mathematical models of those motors, it’s possible to estimate its angular velocity (Wa).

### 1.1 Permanent magnet DC motor model The model for the electric and mechanical circuit of a DC motor is presented on Fig.

1. This model is described by the following equations [4]: Va=Ra*Ia+La*d(Ia)/d(t)+Vc (**1**)

Vc=Kr*Ke*Wa (2) Equation (1) refers to the electric circuit of the motor, being Ra and La the armature resistance and inductance, respectively. Equation (2) relates the counter electromagnetic force (Vc) with the armature angular speed (Wa). Kr is the gear box ratio, and Ke is the relation between the armature angular speed and Vc. From these equations we can see that Vc is directly proportional to the angular speed, and can be obtained from Ia independently of the load J.

We then define the constant K as: K=Kr*Ke (**3**)

The parameters to be determined are therefore Ra, La and K. The time constant Ra/La is small compared to the mechanical time constant, so the the parameter La can be neglected, and was assumed to be zero.

**Fig. 1.** Representation of a DC motor connected to a gear box with a gain Kr and an inertial load J.

## 2 Hardware Description

In this work a robot having a differential traction system was used. The hardware used for the control of one of the wheels is depicted in Fig. 2. The power is applied to the motor terminals through an H-bridge, excited by a PWM signal generated by a microcontroller (uC). Notation: since PWM is computed at uC as a single byte, we will refer to it in a 0-255 scale, corresponding directly to the 0-100% duty-cycle.

**Fig. 2.** Hardware scheme.

**2.1 Measurement of Ia ** A resistor R was placed in series with the H-bridge in order to measure the current Ia.

The voltage drop on the resistor R goes through a low-pass filter, and the resulting signal corresponds to the average tension (Vad). After proper isolation, this signal is digitized by the microcontroller’s analog to digital converter. This measurement is taken using a low cost circuit, using only an opto-coupler and some resistors and capacitors.

The relation between Vad and Ia is given by the following equation: Ia=(Vad*(255/PWM))/R (**4**)

In this relation the dependence of the PWM value is evident. On the other hand, the resistor R should be small in order to minimize the power consumption. The resistor R was chosen to have a value of 1 Ω with a tolerance of 0.01Ω (ΔR), and the AD converter has a resolution of 9.67mV (

Δvad). The measurement error estimate of Ia (E ) is obtained by applying the general error equation [5] to equation

Ia

(4), resulting in (5):

2 E =255/(PWM*R)* )* Ia ΔVad+(255*Vad)/(PWM*R ΔR (**5**)

From (5) we can conclude that the precision of the Ia measurement is limited by the PWM value applied to the H-bridge. As the PWM value decreases, the measurement error increases, being impossible to measure Ia if the PWM value is zero.

The motor driver limit the current to 1A, which means that since R (Fig. 2) is 1 Ω, the maximum Vad is 1V. The motor dead zone extends from a PWM value of 0 to about 25. From equation (5) this means that the maximum E value is 201mA. For

Ia

the most favorable situation, corresponding to a PWM value of 255, we have an E of

Ia 19.7mA.

**2.2 Measurement of Va **

The average tension applied to the motor terminals is obtained by the following equation:

- Va=(PWM/255)*(V -Ia*R) (
**6**)

The error estimation of the measurement of Va is given by the following relation: E =(PWM/255)* ΔV+(PWM/255)*R*E +(PWM/255)*Ia* ΔR (**7**)

Va Ia

It can be seen that the effect of the PWM value in the error of Va is reverse to that in Ia. The less favorable E estimate occurs for a PWM value of 255 and for the

Va

maximum value of Ia (1 A). In this situation, and for a ΔV+ value of 10mV, the maximum E is 39.4 mV.

Va

### 2.3 Measurement of Wa

The motor's angular speed Wa was measured by temporarily installed optical encoders. This measurement will be used to determine the motor's K parameter, and to assess the performance of this technique.

The measurement of Wa has a resolution of 0,392 Rad/s.

## 3 Motor parameters estimation The methods used for the motor's parameters estimation will now be presented.

### 3.1 Measurement of Ra

The measurement of the rotor resistance (Ra) was made with the motor's axis blocked to prevent its rotation. From equation (1), Vc=0 results in Ra=Va/Ia. The measurements were taken using a voltmeter and an amperimetric clamp with precisions of +/-0.5% and +/-3%, respectively. The results are presented in Table 1.

**Table 1.** Results in the determination of Ra.

**Voltage (V) Current (A) Resistance (**

**Ω)**

0,537 0,235 2,28 1,91 0,683 2,80 3,10 1,15 2,70 4,32 1,65 2,61 5,45 1,89 2,88

*5,59 *

2,14 2,61 Mean=2.72 Ω

Standard deviation=0.206 Ω

The obtained standard deviation is about 7,8%. The value is influenced by factors as the windings temperature or the rotor position (the brush contact isn't uniform along the colector). Being Ra a relatively small resistance, care should be taken for its measurement. In this work the motor current was measured with an amperimetric clamp.

### 3.2 Estimation of K

The estimation of K consisted in the application of different PWM values to the H- bridge, and for each of them Ia and Wa were measured, along with the V+ value before and after each experiment. Each registered Wa value corresponds to the average of 125 samples. Each value of Ia corresponds to the average of 1250 samples (this because each sample of Ia sent by the microcontroller corresponds in reality to the average of 10 samples). The following model was obtained from equations (1) and (2):

Wa=(Va-Ia*Ra)/K (**8**) The K value was estimated using numeric minimization algorithm that minimizes the quadratic error between the Wa value given by equation (8) and the Wa value measured by the encoder for the various PWM values. The used search algorithm was newton's.

Both the measured Wa values and those obtained by the model with the estimated K, are shown in the chart on Fig. 3. _{measured estimated} _{7} _{8}

9 _{/s)}

6 (Rad _{5} _{eed} ‐Wa _{4} _{Angular} sp _{1} _{2} _{3}

50 100 150 200 250 _{PWM} As can be seen, the model approaches the real data for intermediate values of PWM. However, a visible deviation occurs for PWM values between 0 and about 76. For values above 235 there is also a deviation, albeit smaller.

The deviation observed for the lower PWM values can be in part explained by the error in the measurement of Ia, as explained in section II. Conversely, the deviation for the higher values of PWM can be in part explained by the error in the measurement of Va. Another important factor for the divergence in the extremes of the PWM range is that equation (4) ignores the switching time Ts for the H-bridge transistors. As the PWM values reach the extremes, this time becomes important relatively to the Ton and Toff times, as shown in Fig. 4.

**Fig. 4.** Voltage drop in resistor R for different PWM’S.

Because of these model deviations, the PWM intervals [0,76] and [235,255] were not used for the estimation of K. The estimated value for K was 1,53V/rad/s, and the quadratic error is

2

0.0343(rad/s) ; Should the entirely PWM interval be considerate, the average

2

2 quadratic error increases to 0.02(rad/s) , and 0.305(rad/s) maximum.

## 4 Model validation

In Fig. 5 is shown the robot used for the present work. Several experiments were made, with the robot running on the floor. Several working conditions were tested, with different values of PWM and with different loads. The real speed, measured by the temporary encoders, was compared with that estimated by the model in equation (8) in order to assess the model quality.

**Fig. 5.** Picture of the robot used for this purpose.

Fig. 6 shows the comparison between the measured angular speed and that estimated by the model for a PWM value of 115. It can be seen that in steady state the estimated value lies within the encoder's resolution. In the initial phase of transient response there is a small deviation, but after just two samples (80 ms) the model also follows the transient response.

**Fig. 6.** Comparison between measured and estimated angular speed for a PWM value of 115.

Fig. 7 shows the response obtained by the application of two consecutive PWM steps of 78 and 156, respectively. It can be seen that the observations are similar to what was described before. ^{0,5} ^{1} ^{1,5} ^{2} ^{2,5} ^{3} ^{3,5} ^{4} ^{4,5} ^{5} ^{0,2 0,4 0,6 0,8} ^{1 1,2 1,4 1,6 1,8} ^{2} ^{An} ^{gu} ^{lar}

** speed** **‐Wa** ** (Rad/s)** **time (s)** ^{measured estimated}

_{/s)} _{3,5} _{4,5} _{4} _{5} measured estimated (Rad _{3} ‐Wa _{An} _{eed} _{gu 1,5} _{la} _{r} _{sp} _{0,5} _{2,5} _{1} _{2}

0,8 1,6 2,4 3,2 ^{4 4,8 5,6 6,4 7,2} _{time(s)} ^{8 8,8} **Fig. 7.** Comparasion between measured and estimated angular speed for a initial PWM value of 78 and 156 at t=5s.

The steady state results for the various experiments are shown in Table 2, and consisting of the average estimated Wa, the average current, the PWM step value and the error between the measured and estimated Wa. Since the used encoders' resolution is 0,392 Rad/s, it can be seen that the largest difference between the estimated and the measured values for Wa is 0,17 rad/s.

**Table 2.** Summary of experiences results.

**Exp. 1 Exp. 2 Exp. 3 Exp. 4 Exp. 5 Exp. 6 Exp. 7**

**Wa mes. (rad/s) ** 1,812 2,496 4,200 5,574 5,376 1,758 7,136

1,990 2,665 4,297 5,615 5,490 1,933 7,165 **Wa est. (rad/s) **

**Current (A) ** 0,245 0,350 0,301 0,321 0,371 0,605 0,319

**PWM ** 78 100 156 200 200 200 250

**Error (rad/s) ** 0,177 0,169 0,0968 0,0413 0,113 0,174 0,0287

## 5 Conclusions

This work shows that it is possible to estimate the angular speed of a DC motor efficiently and with low implementation cost. For such estimation we can use less expensive measurements, like the motor tension and current, avoiding the use of encoders. This is achieved by estimating the DC motor model parameters and by using the model equations that relate the motor tension and current with its rotor's angular speed.

Although the presented technique doesn't perform as well for the lower PWM values, that fact doesn't present a problem for the present application. The used robot is equipped with gear boxes that allow it to move with low speeds and still maintain a PWM value high enough for the estimation error not to be a serious concern, as can be seen for the first experiment in table II.

A small model deviation at the start of the step response was also observed. The obtained results show that indirectly obtained odometry, without the use of encoders or other wheel sensors is viable from the low cost mobile robotics' point of view.

## 6 References

[1] Robotics in education: Low-cost platforms for teaching integrated systems Author(s): Weinberg, JB; Yu, XD Source: IEEE ROBOTICS & AUTOMATION MAGAZINE Volume: 10 Issues: 2 Pages: 4-6 Published: JUN 2003

[2] Evaluating the Roomba: A low-cost, ubiquitous plat form for robotics research and

education Author(s): Tribelhorn, B; Dodds, Z Conference Information: IEEE International Conference on Robotics and Automation, Date: APR 10-14, 2007 Rome ITALY Source: PROCEEDINGS OF THE 2007 IEEE INTERNATIONAL CONFERENCE ONROBOTICS AND AUTOMATION, VOLS 1-10 Pages: 1393-1399 Published: 2007

[3] RoboCup Junior - http://rcj.sci.brooklyn.cuny.edu/

[4] R. Krishnan, Electric Motor Drives, Modeling, Analysis, and Control: Prentice Hall, 2001.

[5] Aurélio Campilho, Instrumentação electrónica. Métodos e Técnicas de Medição:

Instrumentação electrónica. Métodos e Técnicas de Medição.