Example Code

6-Phase (Trapezoidal) Control for Brushless DC Motors

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Brushless Servo Motor

Code and Documents

Attachment

Description

 

This piece of code represents the simplest method for controlling a brushless DC (BLDC) motor, 6-phase (also called trapezoidal) control. The algorithm uses feedback from hall sensors to dictate which FETs or IGBTs should be energized in the motor control bridge. The following diagram shows the hardware setup that accompanies this code.

 

system_configuraiton2.jpg

 

The Compact RIO system reads the hall sensors from phases A, B and C and actuates a single high-side FET and a single low-side FET to make the motor spin either clockwise or counter-clockwise. Actuating the 7th FET with a PWM signal provides speed control by setting an effective bus level voltage. The code generates a 9-bit PWM signal (a magnitude of 0-511), resulting in a carrier frequency of just over 78kHz.

 

The following pictures show the code itself. The top loop in the code generates the FET signals based on the hall sensor input and the commanded bus voltage. The bottom loop generates the PWM for the bus-level FET.

 

6-phase control.JPG

 

The following picture show the hardware used to test this control algorithm (a custom-made motor drive bridge and a Maxon brushless DC motor).

 

motor and board.jpg

 

More compliated control algorithms can be found at the following links:

sinusoidal control - https://forums.ni.com/t5/Example-Code/Look-up-Table-for-Sinusoidal-V-f-Control-of-a-Brushless-DC-Mot...

field-oriented control - https://forums.ni.com/t5/Example-Code/Field-Oriented-Controller-FOC-Space-Vector-Controller-for-a/ta...

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
colevivaviva
Member
Member
on

Ben,

I'm so interested in this project, that I wanna make one myself. Would you please send me more details about the motor drive bridge(circuit diagram,the data of every electronic component or the PCB). My e-mail address is coleviva@yahoo.com.cn.

Thank you for your time.

Sincerely,

                                                                                                                                                                      Cole

venkatesh87
Member
Member
on

I am interested to do it this project my self can u send me related papers to my mail id :  venkat007ice@gmail.com

I nweed Related circuit connection details..

Thank you

gnrttr
Member
Member
on

 could you please send me this program's JPGs? my e-mail : blue_dus46@hotmail.com

Jessie9527
Member
Member
on

Hello Ben, I am interest in the BLDC control VI you shared, and could you send me detail information about 6-FET circuit which can be applied  to this control method. 

Look forward to your reply.

Thanks very much

Best Regards

 

yi-fan
Member
Member
on

Hi,

 

I'm new here. This seems to be an old thread. All the jpgs are not showing. Could anyone share the information (or send to yfc500@gmail.com)? Thanks in advance.

Contributors