Hi everyone, i have arduino due, drv8302, and BLDC motor with hall sensor. I would like to applied Proportional Integral (PI) control to controlling the speed of BLDC Motor.
I have succeed to spin the BLDC motor using switching sequence (by giving pwm signal on each mosfet based on hall sensor combination). I have some question on my mind. Here it is :
To applied PI Control do i need to spin the motor clockwise and counter clock wise? Can i just use one of it?
Is there any pin of DRV8302 that works as direction (CW/CCW) pin?
Is there any library that contain PI control to control speed (rpm or any units) in simpleFoc that maybe i can try first?
I have installed PciManager.h library via Library Manager of Arduino but it still won’t work. can you please help me? here are my full code
Also i found out that the PID to control velocity have code like this
but i dont know where’s the “output” variable goes to. i think it should be goes to analogWrite(output); but i didn’t found any code that consist of analogWrite to write the pwm. could you please explain to me?
Sorry if i am asking to many question.
Thank you very much!
As far as I can see this has to do with the PciManager library and not simepleFoc so I don’t now if this forum is the right place to ask for help with that error.
first i thought it was the library version, i already downgrade the version from 2.00 to the latest version, but it still won’t work. At this time i dont know yet how to fix it. so i think i’ll comment it and try it to my device first.
i ask here because the library are used in velocity motion control using encoder example.
The analogWrite() function is usually not sufficient for BLDC motor control. SimpleFOC has its own PWM driver code for each MCU type that it supports…
You can turn the direction either clockwise or anti-clockwise, but you don’t have to. It’s your choice. Positive target values turn in one direction, while negative ones turn in the other…
The DRV8302 does not have a direction pin. As a 3-PWM or 6-PWM brushless driver it lets the controller directly set the phase voltages/currents (via PWM) and does not support speed/direction control. You’d need a different type of driver for that, but that type will not support FOC (field oriented control).
Hi @runger based on your answer “As a 3-PWM or 6-PWM brushless driver it lets the controller directly set the phase voltages/currents (via PWM) and does not support speed”
isn’t this means that the higher voltage and current that the driver generate, the speed/spin of the BLDC Motor also goes faster too?
i have tried to analogWrite each switching pin (INH_A, INH_B, INH_C, INL_A, INL_B, INL_C) of DRV8302 with switching combination from some journal and paper, and it turns out that the higher value of pwm it makes the speed/spin of BLDC motor faster too.
Hi @runger i found out that to spin brushless dc motors we need to switching the mosfet, there are many combination of switching sequence methods such as
i would like to know what combination of switching that simpleFOC library used? where do i can look of its code and its switching sequence?
I suggest you start with our documentation site - we have an area called the “theory corner” which describes exactly the control algorithms used, and goes into some detail on field-oriented control.
We also link to some resources on the subject.
But it’s not the simplest concepts, and the code behind the switching of the MOSFETs (via an appropriate driver) is fairly complicated, and depends also on the MCU type used. You can find it all in the drivers subdirectory in our library, but it might be difficult to follow it.