Thứ Sáu, 14 tháng 12, 2018

Controlling a BLDC Motor with an ESC

REQUIREMENTS:
1. Microcontroller (AtMega 16)
2. A Brushless DC motor (BLDC)
3. An Electronic Speed Controller (ESC)
4. Power source to drive the motor (LiPo battery)
 
DESCRIPTION:
Brushless motors have much more satisfying results as compared to brushed motors. The basic difference between them is that in a brushless motor, the rotor itself contains the permanent magnets and the electromagnets move to the stator which is quite opposite as seen in a brushed motors. It's more precise and can also factor the speed of the motor into the equation. This makes brushless motors more efficient as there is no sparking, less electrical noise and no brushes to wear out. With the electromagnets on the stator, they are very easy to cool. You can have a lot of electromagnets on the stator for more precise control. The only disadvantage of a brushless motor is its higher initial cost, but you can often recover that cost through the greater efficiency over the life of the motor.
 
Now when we talk about controlling these motors I would like to introduce a new term,  i.e. ESC which stands for Electronic Speed Controllers. As the name suggests, they control the speed of brushless DC motors using some electronic protocol. These ESCs need a command to work further. In this project I’m sending these commands using a microcontroller, AtMega 16. You might be thinking what these command could be? Don’t worry, if you have ever dealt with servo motors before, you’ll be able to control these BLDC motors very easily. Most of the ESCs need a 50Hz frequency i.e. a 20 ms cycle and the speed depends upon the duty cycle you provide. 1ms will reduce its speed to minimum or even stop it (it depend upon the ESC model) while a 2ms pulse will run the motor on its full speed. The values between them give you a variation in speed.
Project Setup

Fig. 1: Prototype of AVR ATMega16 based Brushless DC Motor Controller

BLDC Motor

Fig. 2:  Image of Brushless DC Motor

Electronic Speed Controller
Fig. 3: Image of Electronic Speed Controller
 
Let me tell you something about the connections involved here. An ESC needs a power source to work with (this source will also provide power to the motor). I have used a Lithium Polymer battery (11.1V) here. Now at the input side, apart from the battery need, it requires a signal which I have connected to the OC1A pin (PD5). This is the Timer1_A output; I’ll talk about it in the later part. Next comes the output section with 3 pins A, B and C. These pins correspond to the 3 pins of the BLDC motor. The motor  in use comes with three wires with  in colours: yellow, black and red. You need to connect A to yellow, B to black and C to the red one. In case you find your motor running in opposite direction of what you want, just interchange yellow and red wires.
 
Timer1 in AtMega 16 is a 16 bit timer i.e. it can count up to 65535 starting from zero. The reason I have used this timer and not timer0 or timer2 is that these are 8 bit timers and can count up to 255. When we want a 20 ms cycle we need a value of 20,000 counts (0-19999). As you can see this value cannot be accommodated in any 8 bit timer therefore I have switched over 16 bit one. One great thing about 16 bit timers is that you can set the  top value between 0-65535. Timer 1 is further divided into two individual 16 bit timers A and B. This project uses the ‘A’ part of timer 1. Also, values corresponding to 1ms and 2 ms  are 1000 and 2000 respectively.
 
When you’ll watch the video you’ll notice that I have controlled the speed using a potentiometer (10K pot). This potentiometer provides the analog value which is read by the PORTA_0 pin. This value then determines the value between 1000 and 2000, as discussed above.
 
On practically dealing with the motor that I have used; it was written in its datasheet that it requires a 1ms pulse for a duration of few seconds or until motor responds with a signal (you’ll understand it better when you’ll watch the video part). This indicates that the motor is now ready for those commands  discussed earlier.
 
 
APPLICATIONS:
• These motors play the most important role in making of any aerial vehicle like UAVs or quad copters etc.
• BLDC can also be seen in RC (remote control) cars and aircrafts.
.


Circuit:
Circuit Diagram of AVR ATMega16 based Brushless DC Motor Controller

Code:
#include<avr/io.h>
#include<adc_lib.h>

void main()
{
      int value;
      ADCinit();
      TCNT1=0;

      TCCR1A|=(1<<COM1A1)|(1<<WGM11);
      TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS10);

      DDRD|=(1<<5);

      ICR1=19999;
      OCR1A=1000;

      while(1)
      {
            value=read_adc(0);
            OCR1A=value+1000;
      }
}

Không có nhận xét nào:

Đăng nhận xét

Bài đăng mới nhất

Hướng dẫn sử dụng Cân điện tử Fujihatsu FTC-01

Hướng dẫn sử dụng Cân điện tử Fujihatsu FTC-01 # candientu ,  # fujihatsu ,  # candientufujihatsu  #candientu,  # candientufujhatsu , #fuji...

Bài đăng phổ biến