Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Controlling a BLDC Motor with an ESC

By Gurmeet Singh February 14, 2021

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.

You may also like:


  • What are different types of industrial robots?

  • How to select drone motors

  • What types of motors are used in electric vehicles?

  • What is Wireless Electric Vehicle Charging System (WEVCS)?

  • What is the role of embedded software in electric vehicles?

  • What are the components of robotic arms and industrial robots?

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


Filed Under: AVR, Electronic Projects
Tagged With: avr, electric motor
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Identification of a 6 pin smd chip (sto-23-6) marked E2
  • Dynacord enter protect
  • IGBTs without negative gate drive
  • Need suggestions in task NI6363 retrigger (analog trigger)
  • Monte-Carlo simulation error on ADE-XL

RSS Electro-Tech-Online.com Discussions

  • Does US electric code allow branching ?
  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault
  • Fun with AI and swordfish basic
  • Sump pit water alarm - Kicad 9
  • turbo jet fan - feedback appreciated.

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • How IoT network topologies work
  • The top five AI startups to watch in 2025
  • STMicroelectronics unveils SoC based on secure MCU
  • Nexperia’s 48 V ESD diodes support higher data rates with ultra-low capacitance design
  • Taoglas releases Patriot antenna with 18 integrated elements covering 600 to 6000 MHz

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 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

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe