A lot of people have been asking us about controlling a brushless motor using Arduino. So we thought about writing a post explaining everything about the working of the brushless motor, ECS, ECS configuration and rotating it using an Arduino Nano.
Components Required
Arduino Nano
ESC
Brushless Motor
12 V LIPO Battery
First let us get familiarized with the components.
Sponsor Link
This Project is Sponsored by UTSource. UTSource is a professional electronic components supplier.
Brushless Motor
In order to make the operation more reliable, more efficient and less noisy, the recent trend has been to use brushless DC motor.
The brushless motor is actually a three phased motor. They are also lighter when compared to the brushed motor with the same power output. The brushes of the conventional DC motor will wear out over time and may cause sparking. Due to that reason, the brushed DC motor should not be used for purposes that require long life and reliability.
Brushless Motor Working
You all might be familiar with the story of the Donkey and the carrot.
Here, when the donkey tries hard to reach the carrot, but the carrot keeps moving out of reach. This is exactly what is happening inside the Brushless Motor.
The working of the Brushless Motor is based on the simple force interaction between the permanent and the electromagnet. The rotor of a Brushless DC motor is a permanent magnet. The stator has a coil arrangement as shown in the below figure. By applying DC power to the coil, the coil will energize and become an electromagnet.
In this condition, when the first coil is energized, the opposite poles of the stator and the rotor are attracted to each other. As the rotor come close to the first coil, it reverses the polarity and the next coil is energized and the rotor will be attracted to that second coil.
This process is repeated and the rotor continues to rotate. This combined force also makes sure that the motor has a constant torque nature.
So how do we know when and which stator coils should be energized? In a Brushless Motor, we use an Electronic Controller for this purpose. A sensor determines the position of the motor and based on this information, the controller decides, which coils to energize. Most often, a hall effect sensor is used for this purpose.
ESC
In order to drive the Brushless Motor, the easiest way will be to use an ESC. Simply speaking, ESC is a small and compact electric circuit which is designed to control the speed as well as the direction of the brushless motor. It is even used as dynamic brakes in various situations.
What these ESCs do is, they convert DC power supply which is provided through a battery to three-phase AC power fed to the motor, which will energize the electromagnets inside the stator. ESC usually uses back EMF feedbacks to sense the position of the motor and are used to correct the phase of the AC voltage.
As mentioned earlier, the brushless motor is a three-phase motor and so there are three terminals as shown in the above picture. These three terminals are connected to the ESC(black yellow and red on the bottom).
The Red and Black wires (top) are for supplying power for driving the motor as well as for the functioning of the internal circuit of the ESC.
Here you can also see another cable that comes out on top of the ESC like you see on the Servo motor that can provide a +5V Out, Ground and the signal cable which is to be connected to the controller (in our case Arduino). The PWM signal that is provided on the signal wire will tell the ESC when and how to provide voltage to the three phases and drive the brushless motor.
ESC Configuration for Brushless Motor[AdSense-C]
ESC configuration process will differ for different ESCs. Here I will be showing the most common variant of the ESCs available in the market. Most of the ESCs follow these steps to configure the voltage levels. Here I will show you how I configured mine.
As mentioned in the above section, driving the brushless motor is all about providing the correct PWM signals to the ESC through the signal cable.
PWM (Pulse Width Modulation) is a method of obtaining analog outputs using the digital means. Wait… What?? Let me make that clear for you. Digital has only two states – 0 and 1, On and Off, 5V or 0V. Using Digital means, we can easily make square waves; a wave that switches between ON and OFF state. But this ON-OFF pattern can still be used to simulate an analog signal by manipulating the time period that the signal is On state and the time period the signal is in Off state. The time period the signal is the On state is called Pulse Width.
For that purpose, we will connect the PWM signal wire to one of the PWM pins of our Arduino Nano.
PWM Signal Generation
So we talked about providing PWM signals. How do we generate PWM signals using Arduino. Well, the easiest way to do is to make use of servo library. This library is mainly used for controlling a servo motor using PWM. One advantage of using this library is, you don’t have to enter the On-Off time manually. All you have to do is enter the value of the angle of rotation of the servo motor (between 0 and 180) and the library will take care of the rest of the hard work.
Configuration Explained
When we power on the ESC, it will make some beep sound and wait for the user enter the PWM signal that corresponds to the Maximum speed of rotation of the motor. We will input the waves with the pulse width (say PMax) that corresponds to the maximum speed using the PWM Pin of the Arduino. This value is stored in the ESC and then makes another beep sound and wait for the user to enter the PWM signal that corresponds to the minimum speed (0 speed). Just like in the previous case, we will input the waves with the pulse width (say PMin) corresponding to the minimum speed.[AdSense-C]
If everything is done correctly, ESC will make a long beep sound confirming the completion of the configuration process. Once the configuration is complete, when we provide a Wave of Pulse Width PMax, the motor will rotate in its maximum speed and when we provide a Wave of Pulse Width PMin, the motor will stop.
You can configure it manually usinga joystick or a potentiometer or you could configure it automatically using the Arduino Code. Here I will explain both.
Manually Configuring the ESC using Arduino and Joystick
Here we will be using a joystick for the configuration and the brushless motor control. The joystick you can see here on the right side is one of the most widely used controllers which designed to work with Arduino as well as raspberry pi easily. It consists of two potentiometers to read the vertical motion as well as horizontal movement. This analog reading (0-1023) is then converted to angle (0-180) which is used to generate our PWM signal and is then fed to the ESC using one of the PWM pins of our Arduino.
Connections
Connect the ESC as mentioned earlier.
Connect the X or Y output of the joystick to one of the Analog Input (A0 Pin).
Signal pin of ESC is connected to Pin 10 of Arduino Nano
The Code
Testing
First power on the ESC, it will create a “beeeeep beeeeep beeeeep” sound and then a long “beeeeeeeep” sound and it waits for our input. Means it is waiting for us to provide the voltage which corresponds to the full speed of the motor rotation. At this time pull the joystick to the topmost position. This voltage will be stored on the ESC. Once it is done, it will make another “beeeeeeep” and waits for our input. This time, we have to provide the voltage corresponding to the lowest speed. Keep the joystick on the neutral position (0-speed position). Once it is done, After that it makes a “beeeeeeeeeeeeeeeeeeeeeeeeeeeep” sound.
After this, the motor ESC will make the motor rotate at the speed depending upon the position of the joystick.
Automatically Configure using the Arduino Code
Here the connection part is similar to that of the above section. The only difference here is, the below code will automatically configure the ECU. You can straight away start using the motor once you hear the long beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep sound.
The Code
Once you upload the code, arduino will automatically do all configuration of your ESC and after the long beep, you will be able to control the brushless motor using your joystick.
If you have any doubts regarding Arduino Brushless Motor Control, need clarifications or you want help in modifying the codes, please let me know in the comments. If you find this useful share this project. If you have any doubts, need clarifications or you want help in modifying the codes, please let me know in the comments.
If you find it useful, check out the wireless version of this project where you can wirelessly control a brushless motor using Arduino and a simple wireless module.
Want to Build a RC Plane Controller With This? Check this Out!!
[AdSense-B]Rate the ProjectDid you find this page useful? Help us to improve by rating this page.
Line Follower… Well.. What else is new?? IR Sensors, motors, chassis, arduino/pic or any other microcontroller, simple pieces of codes.. They are all common right? How about building a cheap, basic and simple line follower without using arduino or pic? A line follower without microcontroller at all. No Coding ;). Here, we will build a…
Obstacle avoidance robot is a kind of intelligent machine which has the ability to sense obstacles or objects coming towards his path and has the ability to change its direction while any such object comes in his path. In this tutorial, we are going to demonstrate about the construction of this machine and the necessary…
Welcome to our new DIY series – Spinel Crux – A DIY Advanced Hand Gesture Control Robot using Raspberry Pi for Wireless Surveillance Project. Yes, of course, building and tinkering with a DIY robot is fun. In this series, we will build a Raspberry Pi Rover Robot which can travel through rough terrain and control…
Arduino Nano 33 BLE Sense Introduction Today, I am here with a new version of Arduino Nano – ARDUINO NANO 33 BLE SENSE, Nano with BLE connectivity focusing on IoT, which is packed with a wide variety of sensors such as 9 axis Inertial Measurement Unit, pressure, light, and even gestures sensors and a microphone….
Here is an awesome collection of the best Arduino projects for Science exhibitions and fairs as working models. This also includes complete step-by-step tutorials to all these Arduino Projects for beginners and kids.
A few days back we published an article “Home Automation using Arduino Nano” in our blog which was well-received among hobbyists. We also did a Home Automation System using NodeMCU. In this post, we are going to make our home SMARTER. We will be using the IoT features of Arduino Nano 33 IoT to water…