Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • EE Design News
    • DIY Reviews
    • Guest Post
    • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Controlling a BLDC Motor with an ESC

February 14, 2021 By Gurmeet Singh

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.

Prototype of AVR ATMega16 based Brushless DC Motor Controller

Project Setup

 

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

Image of Brushless DC Motor

BLDC Motor

Fig. 2: 

Image of Brushless DC Motor

Image of Electronic Speed Controller

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.

Project Source Code

#include

#include

 

void main()

{

      int value;

      ADCinit();

      TCNT1=0;

 

      TCCR1A|=(1<

      TCCR1B|=(1<

 

      DDRD|=(1<<5);

 

      ICR1=19999;

      OCR1A=1000;

 

      while(1)

      {

            value=read_adc(0);

            OCR1A=value+1000;

      }

}


Circuit Diagrams

Circuit-Diagram-AVR-ATMega16-Brushless-DC-Motor-Controller

Project Video

Related Articles Read More >

Raspberry Pi Server based Hotel/Restaurant Order Management System on IoT – IOT Part 46
Servo Control using Brain Wave (Part 12/13)
Raspberry Pi camera QR-code scanning
How to design an Arduino-based container shipment tracking system

Featured Tutorials

  • Gate Level Implementation – DE Part 8
  • Introduction to VHDL & Verilog – DE Part 9
  • Arithmetic Circuits – DE Part 10
  • Logic Gate Implementation of Arithmetic Circuits – DE Part 11
  • Building Code Convertors Using SN-7400 Series ICs – DE Part 12
  • Interfacing stepper motor with 8051(89c51,89c52 ) microcontroller

Stay Up To Date

Newsletter Signup

EE Training Center Classrooms

“ee

“ee

“ee

“ee

“ee

Recent Articles

  • What are the different types of temperature sensors and their applications?
  • Analog Devices and Stripe launching advanced computer science program
  • NXP expands its EdgeVerse portfolio with crossover application processors
  • Mobileye partners with ATS and Lohr to develop autonomous shuttles
  • Vishay releases compact, automotive-grade through-hole inductor
...

RSS EDABOARD.com Discussions

  • Understanding of RHCP or LHCP
  • Impedance Maching
  • What is the safe distance for RF antenna under 220KV high voltage equipment?
  • Will this RF power transistor work for RF power amp at 2.4 GHz?
  • Nport instance connection in cadence

RSS Electro-Tech-Online.com Discussions

  • Momentary push button DPDT switch with alternate action
  • Step-down switching regulator with 1MHz PWM. Schematic question.
  • HOW to buy online solar motion detector LED Lights with NO Lumens ratings?
  • Ideas for a power supply?
  • ST7066U 20x4 LCD problems
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2021 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • EE Design News
    • DIY Reviews
    • Guest Post
    • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering