Pages: [1]   Go Down
Author Topic: 24V BLDC Motor + Dual FETs + Arduino  (Read 1125 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to drive a 24V BLDC motor using dual FETs only: the IRF7389 dual FETs. I'm not using any of the 3 Hall sensors, only controlling the on/off of the 6 transistors (n-channel + p-channel), according to the AN885 Application Note (look it up!) on BLDC Brushless Motor Fundamentals. Here's my code. Instead of plugging in the motor, I have 3 LEDs connected to the drain pins (5-8 on the IRF dual FETs) where the motor outputs are usually connected. So, this way, I do not fry the motor on the first attempt. All the p-channel sources are tied to 5V, while the n-channel sources are tied to GND. Of course, I have resistors at the gates and resistors in series at the drain pins. The problem is that the LEDs each light up one by one, the current initially spikes up to 250 mA and then drops back to 0A. Why??? How do I fix this problem? I'm too scared to plug in the motor in case it either burns up or doesn't spin at all.

const int q5=7;
const int q4=6;
const int q3=5;
const int q2=4;
const int q1=3;
const int q0=2;

void setup() {
pinMode(q5, OUTPUT);
pinMode(q4, OUTPUT);
pinMode(q3, OUTPUT);
pinMode(q2, OUTPUT);
pinMode(q1, OUTPUT);
pinMode(q0, OUTPUT);
}


void loop() { // Spin Clockwise
// Im using the table 3: AN885 application note.
// Sequence 1: q1 and q4 are high   

digitalWrite(q5, LOW);
digitalWrite(q4, HIGH);
digitalWrite(q3, LOW);
digitalWrite(q2, LOW);
digitalWrite(q1, HIGH);
digitalWrite(q0, LOW);
delay(10);

// Sequence 2: q1 and q2 are high
digitalWrite(q5, LOW);
digitalWrite(q4, LOW);
digitalWrite(q3, LOW);
digitalWrite(q2, HIGH);
digitalWrite(q1, HIGH);
digitalWrite(q0, LOW);
delay(10);

// Sequence 3: q5 + q2 are high
digitalWrite(q5, HIGH );
digitalWrite(q4, LOW);
digitalWrite(q3, LOW);
digitalWrite(q2, HIGH);
digitalWrite(q1, LOW);
digitalWrite(q0, LOW);
delay(10);

// Sequence 4: q5 and q0 are high
digitalWrite(q5, HIGH);
digitalWrite(q4, LOW );
digitalWrite(q3, LOW);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, HIGH);
delay(10);

// Sequence 5: q3 and q0 are high
digitalWrite(q5, LOW);
digitalWrite(q4, LOW);
digitalWrite(q3, HIGH);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, HIGH);
delay(10);

// Sequence 6: q3 and q4 are high
digitalWrite(q5, LOW);
digitalWrite(q4, HIGH);
digitalWrite(q3, HIGH);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, LOW);
delay(10);
 }

In addition, are there any inherent delays in between each new "digitalWrite" command? I want the transistors in each sequence to either be on/off all at the same time.
« Last Edit: August 03, 2012, 09:43:10 am by Clown_of_God » Logged

0
Offline Offline
Shannon Member
****
Karma: 217
Posts: 12583
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You must switch off the active devices before switching on new ones - otherwise you are shorting out the power supply directly through 2 FETs (this is called "shoot-through" and must be avoided at all costs).  Since digitalWrite takes several microseconds you will be creating these shorts for tens of microseconds - if the supply were powerful enough you might already have exploded your FETs !!

Your caution to test with LEDs and a low power PSU is commendable - power electronics goes wrong in a smoky and expensive manner!


Logged

[ I won't respond to messages, use the forum please ]

Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 512
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What value resistors are in series with the gates?
You have to also take into account the time it takes to charge and discharge the gate source capacitance
which will be indicated in the fets data specs.
Logged

0
Offline Offline
Shannon Member
****
Karma: 217
Posts: 12583
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You will want PWM control and the best solution to keeping the switching speed snappy (to allow faster PWM frequencies) is a FET driver - for 3-phase the FAN7388 is a nice chip (though only available surface-mount, and designed for n-channel top-side FETs).  For running at 5V though this may not be needed as the FET switching losses will be lower.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: