Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • 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
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Controlling a BLDC Motor with an ESC

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


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

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



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

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!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What is a loop calibrator? 
  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • What was before microcontrollers ?
  • Measure AC current accurateley (100mA to 10A)
  • 74HC595 creating Fake output
  • NEED HELP FOR OP-AMP IN BGR
  • Check undesired substrate mode...

RSS Electro-Tech-Online.com Discussions

  • Control Bare LCD With ATmega328p
  • Need a ducted soldering fan for solder smoke extraction
  • Sla ir li ion
  • Question about ultrasonic mist maker
  • Best way to reduce voltage in higher wattage system?
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 © 2022 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
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • 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
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering