BLDC; Motor Control Design:

Discussion in 'The Projects Forum' started by engstudent08, Mar 13, 2009.

  1. engstudent08

    Thread Starter New Member

    Oct 21, 2008
    I am having some difficulties when designing the controller and it would be great if anyone could clear up some theoretical principles...

    I have a Mars Pmac BLDC and i am trying to design a full bridge Inverter based on the Microcontroller PIC 18FXFXX31 MCU's.

    The motor was purchased from electric motor and i am completing this task with visions of intigrating regenerative breaking next semester..

    So... the Motor comes with three Hall effect sensors that will provide me rotor Flux position and hence the commutation sequence with respect to the 6 Mosfets on the bridge.

    Where i am having difficulty in understanding is the following...
    Given that we have the Sequence... binary code for each position and hence firing cycle how can i intigrate speed control. From my understanding torque is proportional to the current vector magnitude at the stator windings. but wont the Motor just draw the currents it needs ? Can i just use a potentiomiter as the reference and just modify the PWM duty cycles that will in turn correlate with the RMS volts seen at the motor and hence speed ?

    Can i just use a look up table.. for example have the pot chopped into 0-256 bits and then have ranges coprrelating to PWM duty cycles ?

    I have been told i need to monitor current by my supervisor.. But im of the impression that i would ahev to intigrate some sort of CT or extra analogue electronics to scale the current given its operating level at apprioximatly 70 apms..

    What would be the best and easiest way to have closed loop control ? I dont need the highest of resulutions, its not like it a CNC machine. i just want it to ramp up and down.. Its for a go kart application so i figue knowing rotor position i can just make the angle between rotor flux and stator current 90 to get max torque...

    .. the motor has 8 pole pairs. so i was thinking, if it takes one electrical cycle to get 1/8 of a mechanical cycle can i just use a timer or counter to determine the speed ? for the speed reference.. ?? ANd do i even need a speed reference. Given that RMP will be correlated to Voltage applied and hence PWM duty cycle ?

  2. thatoneguy


    Feb 19, 2009
    In a multi phase BLDC Motor:
    Changing the frequency of the pulses will change the speed of the motor by "pulling" the poles around at a different rate. Reducing the duty cycle would only give a shorter duration of acceleration towards the next pole, which is effectively less torque.

    For a closed loop control, an opto-interrupter could be mounted near a spinning shaft that has a tab protruding to break the beam. The output could then trigger the counter on the controller. A Hall sensor + magnet affixed to shaft is slightly more durable and immune to dirt, but the same results would be had.
  3. engstudent08

    Thread Starter New Member

    Oct 21, 2008
    I was thinking along the lines of using the hall effect sequencing to provide the reference..
    For example. we know that the mechanical revolutions lags that of the electrical cycle.. by 1/8th .. i think ,given that its an eight pole machines. so can i count the amount of six step transitions to determine how many mechanical cycles have passed given that they will be proportional ??

    I want to have closed loop control of the system, so like you said i will need a reference. I;m just wondering if there is any other way of accomplishing this with out having to use a direct speed measuring component. maybe the maths can just be done in the micro ... or will the delays be too much. i guess the commutation wont be a problem given that we have three halls embedded in the stator. so position is always known.. to a point.

    But what is easiest to compare my reference potentiometer too .. to formulate that error for closed loop control.

    Has anyone done this before ? or have any good references.

    Engstudent :)
  4. RajakumarRamu

    New Member

    Nov 28, 2016

    For BLDC motor Closed loop speed control first we need to calculate the actual speed. you told your motor is 8 pole so all three hall will give 4 pulse(On+OFF). it will vary based on the motor speed.
    To Calculate the Speed any one ON+OFF duration of any one hall sensor has to be measured by making rising edge(or falling edge) capture mode timer configurations.
    once you arrived this duration.


    duration is your electrical frequency
    No.of. Pole pair * Duration is your mechanical frequency

    mechanical frequency can be converted as speed in RPM by using equation (1)

    or we can use Speed=120* F(mech freq)/P(no.of pole)

    For Reference Speed you can use pot or UART or anything else

    if UART you can Send the real speed value ...

    if you want POT. then you need to connect with ADC
    for example that ADC is 8 bit then you will get 0 to 255 step
    this 256 step should be converted as you reference speed 0 rpm to max rpm of your motor. this either you can use lookup table or any linear algorithm
    ex your max ref speed is 10000 rpm then
    your per step ref rpm if 10000/256...

    Now you have Actual speed and reference speed
    from this you can find the Speed error. then this speed error is amplified with PID controller. then this PID controller output is need to saturate with your PWM min and Max. after this saturation you feed this to your PWM.

    now PWM is ready ....

    usually the PWM frequency should be more than 20KHz...
    and it should be more than your electrical time constant of you motor (L/R)

    to run the motor we need to make six step sequence of h bridge switching from the three hall output
    i think you know the six step switching sequence...

    Now the six step sequence should be modulated with the PWM.
    its simple
    just do AND operation of all six output of controller (which will go to MOSFET/IGBT gate driver)pin and PWM out.

    Now the real challenge is tuning the PID gain....
  5. MaxHeadRoom


    Jul 18, 2013
    Look at the Picdem MC LV development board on the Picmicro site, it gives schematics and software for BLDC motors.
  6. MaxHeadRoom


    Jul 18, 2013
    Do you intend building the motor control etc or off the shelf?
    For what country, what is freq. of service supply?