Printer Friendly

Control algorithm of a BLDC motor.


In this paper are discussed the steps of developing several controllers for brushless motors. Sensored and closed loop design will be covered. There is even a controller with independent voltage and speed controls so it can be discovered the motor's characteristics empirically.

The code in this paper was developed with the Microchip PIC16F877 PICmicro[R] Microcontroller, in conjunction with the In-Circuit Debugger (ICD). As the design develops, the program is made in the target device and the code is exercised directly from the MPLAB[R]. (microchip, 2009).

It should also be noted that the code was bench tested and optimized for a Pittman N2311A011 brushless DC motor. Other motors were also tested to assure that the code was generally useful (Pires, 2007).

The key to BLDC commutation is to sense the rotor position, then energize the phases that will produce the most amount of torque. The rotor travels 60 electrical degrees per commutation step. The appropriate stator current path is activated when the rotor is 120 degrees from alignment with the corresponding stator magnetic field, and then deactivated when the rotor is 60 degrees from alignment, at which time the next circuit is activated and the process repeats. Commutation for the rotor position would be at the completion of current path 2 and the beginning of current path 3 for clockwise rotation. Commutating the electrical connections through the six possible combinations, numbered 1 through 6, at precisely the right moments will pull the rotor through one electrical revolution.


In this paper the sensored closed loop control method is discussed.

2.1 Sensored commutation

The easiest way to know the correct moment to commutate the winding currents is by means of a position sensor. Many BLDC motor manufacturers supply motors with a three-element Hall-effect position sensor.

In this context, it's possible to start building the motor commutation control code. Commutation consists of linking the input sensor state with the corresponding drive state. This is best accomplished with a state table and a table offset pointer. The sensor inputs will form the table offset pointer, and the list of possible output drive codes will form the state table.

2.2 Determining the Back Electromagnetical Force (BEMF)

The BEMF, relative to the coil common connection point, generated by each of the motor coils, can be expressed as shown in equations from (Jang & Chang, 2001).

Fig.1. shows the equivalent circuit of the motor with coils B and C driven while coil A is undriven and available for BEMF measurement. At the commutation frequency the L's are negligible. The R's are assumed to be equal. The L and R components are not shown in the A branch since no significant current flows in this part of the circuit so those components can be ignored.


The BEMF generated by the B and C coils in tandem, as shown in Fig.1, can be expressed as shown in equation 1.

[BEMF.sub.BC] = [B.sub.BEMF]--[C.sub.BEMF] (1)

At full speed the applied DC voltage is equivalent to the RMS BEMF voltage in that 60 degree range. In terms of the peak BEMF generated by any one winding, the RMS BEMF voltage across two of the windings can be expressed as shown in equation 2.

[BEMF.sub.RMS] = 1.6554 (2)

This result will be used later to normalize the BEMF diagrams presented later, but first let's consider the expected BEMF at the undriven motor terminal (Xiang-jun, 2007).

Since the applied voltage is pulse width modulated, the drive alternates between on and off throughout the phase time. The BEMF, relative to ground, seen at the A terminal when the drive is on, can be expressed as shown in equation 3.

Notice that the winding resistance cancels out, so resistive voltage drop, due to motor torque load, is not a factor when measuring BEMF.

The BEMF, relative to ground, seen at the A terminal when the drive is off can be expressed as shown in equation 3.

[BEMF.sub.A] = [A.sub.BEMF]--[C.sub.BEMF] (3)

Fig.2. is a graphical representation of the BEMF formulas computed over one electrical revolution. To avoid clutter, only the terminal a waveform, as would be observed on a oscilloscope is displayed and is denoted as BEMF (drive on). The terminal a waveform is flattened at the top and bottom because at those points the terminal is connected to the drive voltage or ground. The sinusoidal waveforms are the individual coil BEMFs relative to the coil common connection point. The 60 degree sinusoidal humps are the BEMFs of the driven coil pairs relative to ground. The entire graph has been normalized to the RMS value of the coil pair BEMFs.

Notice that the BEMF (drive on) waveform is fairly linear and passes through a voltage that is exactly half of the applied voltage at precisely 60 degrees which coincides with the zero crossing of the coil A BEMF waveform. This implies that the rotor electrical position can be determined by detecting when the open terminal voltage equals half the applied voltage.


Fig. 2. BLDC Motor Waveforms at 100% drive

The BEMF waveforms are all reduced proportionally but notice that the BEMF on the open terminal still equals half the applied voltage midway through the 60 degree drive phase.

The rotor position can be determined by measuring the voltage on the open terminal when the drive voltage is applied and then comparing the result to one half of the applied voltage.

Recall that motor speed is proportional to the applied voltage. The formulas and graphs presented so far represent motor operation when commutation rate coincides with the effective applied voltage. When the commutation rate is too fast then commutation occurs early and the zero crossing point occurs later in the drive phase. When the commutation rate is too slow then commutation occurs late and the zero crossing point occurs earlier in the drive phase. We can sense and use this shift in zero crossing to adjust the commutation rate to keep the motor running at the ideal speed for the applied voltage and load torque.

2.3 Determining the Commutation Times Value

The assembler supplied with MPLAB performs all calculations as 32-bit integers. To avoid the rounding errors that would be caused by integer math, we will use a spreadsheet, such as Excel, to compute the table entries then cut and paste the results to an include file. The spreadsheet is setup as shown in Table 1.

The body of the spreadsheet starts arbitrarily at row 13. Row 12 contains the column headings. The body of the spreadsheet is constructed as follows:

* column A is the commutation table index number N. The numbers in column A are integers from 0 to 255.

* column B is the RPM that will result by using the counter values at index number N. The formula in column B is: =IF(Offset+A13*Slope>Min RPM, Offset+A13*Slope, MinRPM).

* Column C is the duration of each commutation phase expressed in seconds. The formula for column C is: =6/(Phase*B13).

* Column D is the duration of each commutation phase expressed in timer counts. The formula for column D is: =C13*Fosc_4/Prescale

The range of commutation phase times at a resolution requires a 16 bit timer. The timer counts from 0 to a compare value then automatically resets to 0. The compare values are stored in the commutation time table. Since the comparison is 16 bits and tables can only handle 8 bits the commutation times will be stored in two table accessed by the same index.

* column E is the most significant byte of the 16 bit timer compare value. The formula for column E is: =CONCATENATE ("retlw high D", INT(D13), ...)

* column F is the least significant byte of the 16 bit timer compare value. The formula for column F is: =CONCATENATE ("retlw low D", INT(D13),...)

When all spreadsheet formulas have been entered in row 13, the formulas can be dragged down to row 268 to expand the table to the required 256 entries. Column E and F will have the table entries in assembler ready format.


Using the BEMF zerocros detection to control the BLDC motor simplify the calculation blocks included in the main program. In the same time it is very easy to adjust the offset value when the zerocros point is moving related to the speed of the motor.

The PIC microcontroller family has a large variety of configurations for the controller's interface with the same instruction sets and registers. In this case the migration of the program can be made easy to a simplified controller with the minimal necessary interfaces with same computation power.

This control method works well for low complexity system and can be applied to a large variety of control systems with a little changes in the program algorithm.


We would like to acknowledge the financial support of National Council for Research in Superior Education Institutions (CNCSIS), through the grant PNII-ID-694/2008.


Bara, A., Rusu, C., Dale, S. (2009). DSP Application on PMSM Drive Control For Robot Axis, Proceedings of the 13th WSEAS International Conference on Systems, ISSN 17902769, ISBN 978-960-474-097-0, Rodos, Greece, July22-25, 2009, pp 381-385

Jang, G.H. & Chang, J.H. (2001). Numerical analysis of the electromechanically coupled magnetic field in brushless DC motors. Journal of Magnetism and Magnetic Materials, Vol. 226-230, part 2, (may 2001), pp 1223-1225, ISSN: 0304-8853.

Pires, J.N. (2007). Industrial Robots Programming, Springer, ISBN 978-0-387-23326-0,


Xiang-jun, Z. (2007). A new method for reducing commutation torque ripples in BLDC motors. Journal of Shanghai University, Vol.5, No. 1 (march 2001), pp 71-75. ISSN: 1007-6417

*** (2009) Microchip Technology Inc. site, Accesed on 2009-08-16
Tab 1. Commutation Time Table Values

 Name Number or Formula Description

Phases 12 Number of commutation phase changes
 in one mechanical revolution.
Fosc 20 MHz Microcontroller clock frequency
Fosc_4 Fosc/4 Microcontrailer timers source clock
Prescale 4 Timer 1 prescale
MaxRPM 8000 Maximum expected speed of the motor
 at full applied voltage
MmRPM (60*Fosc_4)/ Limitation of 16-bit timer
Offset -345 This is the zero voltage intercept
 on the RPM axis.
 A property normalized to the 8-bit
 A to D converter.
Slope (MaxRPM-Offset) Slope of the RPM to voltage input
 /255 response curve normalized to the
 3-bit A to D converter.
COPYRIGHT 2009 DAAAM International Vienna
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2009 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:brushless direct current
Author:Nagy, Zoltan; Bara, Alexandru; Dale, Sanda
Publication:Annals of DAAAM & Proceedings
Article Type:Report
Geographic Code:4EUAU
Date:Jan 1, 2009
Previous Article:Behavior of a life cycle of business systems under recession.
Next Article:Image retrieval based on color and shape.

Terms of use | Privacy policy | Copyright © 2021 Farlex, Inc. | Feedback | For webmasters |