Go Down

Topic: Is arduino fast enough to handle brushless motors commutation?! (Read 1 time) previous topic - next topic

Ludo91

Hi guys!
I`m making a BLDC motor controller and I am thinking about using Arduino to control it.
It` s very simple, depending on the digital input from 3+1 sensor it has to properly control 6 mosfets. (reads the gas potentiometer once in a while and then applies a pwm signal to 6 mosfets, depending on the readings of 3 hall sensors. Very simple process, based on a Boolean logic that relates hall imputs to phase commutations.)

The question is: Is arduino fast enough for that?!
The motor will be spinning at max 5000 rpm, wich is about 85 rpSecond.
Each mecahnical  rotation is made of 4 electrical rotation, and each rotation is made of 6 state changes. (each state change is the change of TWO pwm output status)

So, 24 commutations * 85 revolutions is 2040 operations per second. Is Arduino with its 16000000 Hertz able to handle that?

A quick math says it has something like 7500 clock cycles for each commutation, but in order not to loose sync the delay of each commutation should not be over let`s say 3%... 
That means not over 250 clock cycle to read 3 digital sensor status, perform a supereasy boolean thing and set two pwm write. Can Arduino handle that?

Thankyou so much!  ^_^

MarkT

Yes, shouldn't be a problem.   You will however, I think, need to up the PWM frequency to higher than the commutation speed to get reasonable behaviour.  The default timer settings are about 1000Hz on timer0, 500Hz on timers 1 and 2.  Each timer controls two PWM pins - timer0 also maintains the millis() clock.  Timers have a prescaler that divides the system clock.  This can be set to divide by one, giving a maximum PWM frequency in 8 bit fast mode of  62.5kHz - plenty I think.

If you want to use all 6 pwm pins then that means you may have to give up on millis() being at all accurate - and learn how to directly set the timer prescaler settings.

[ If you want less delay in the system you can use direct access rather than digitalRead() and analagWrite() - at the expense of clarity.  It is possible to read a digital pin or set a PWM output value in a couple of cycles.... I think that  digitalRead and analogWrite are probably fast enough ]
[ I won't respond to messages, use the forum please ]

westfw

Many of the "homebrew" Brushless motor controllers used in the RC hobby area use an ATmega8 CPU, which is the same CPU  used on the original Arduino (the newer CPUs are essentially the same speed, but have more program memory.)
http://www.radetzki.info/html/sbl_micro_e.html is an example.
(many commercial controllers use the same CPU, and there are assorted instructions out there for reprogramming some of the inexpensive imported ESCs with alternative software.)

MarkT

And don't underestimate the important of monitoring current to such a low-resistance motor - overdrive it and it will take all the current you can throw at it till something melts...  RC brushless motors are typically 0.1 ohms or so winding resistance.
[ I won't respond to messages, use the forum please ]

bastukee

No trees were harmed by the transmission of this message. However a few million electrons were temporarily inconvenienced.

Go Up