Only produce wooden brushes since 2007

controlling brushless motor with arduino

by:Boom Home     2020-03-21
Greetings from readers, manufacturers, geeks, enthusiasts, electronics enthusiasts and beginners;
For a long time, I have been trying to build a wireless R/C car with a brushless motor and Arduino.
Now that I have finished my school exam, I decided to take it.
In the final determination process of the control method I am going to use in order to make an R/C car, I am having a problem: controlling the brushless motor with Arduino.
When control (Technically)
Arduino\'s AC motor seems a bit scary, don\'t worry, because in this manual I will show you how easy it is to control the DC motor using Arduino using any type of switch/potentiometer/joystick, basically, anything that can change the parameters in a way that Arduino can record, whether it\'s a direct voltage or a resistor.
To try this project yourself, you need something basic:
I provide international sourcing links for most of the products I have used)
You also need some basic tools: Let\'s start our project once you have the materials sorted out!
Before we start writing the code, let\'s first connect to ESC and motor from arduino.
The connection to this project is quite simple and direct.
According to the code I wrote, the connection is as follows: the output pin of the potentiometer/joystick is connected to the analog pin 0 on the Arduino.
A schematic diagram of the use of potentiometer and analog joystick is given. (
I used a homemade joystick and gave a schematic diagram of the joystick)
ESC to Arduino: black line (Ground)---
> Ground pin on ArduinoWhite wire (Signal)---
> Monthly line of the digital pin ArduinoRed (Power)--
> Vin on Arduino (
This is powering Arduino)
Connect ESC to the brushless motor: simply connect the three wires of the brushless motor to the ESC.
Orders are not important. (
If the motor does not rotate in the desired direction, simply switch either of the two wires in esc to the brushless motor)
After the hardware connection is complete, we can handle the Arduino code.
The code is fairly simple and I try to explain the functionality of each line with comments.
However, please feel free to contact me if you have any problems: hrithikbansal70 @ gmail.
Comhrithikbansal. comThe Code:(.
Also attached the ino file)
/* ESC calibrate the ESC data pin connected to the digital pin 10 on the arduino.
Potentiometer/joystick input connected to analog pin 0 on Arduino.
Compile and upload the code.
Then keep the joystick/potentiometer at its maximum position and connect the external power supply to ESC.
You will hear some beeps and put the potentiometer/joystick in the lowest position.
This will set the endpoint on ESC.
This sample code is in a public domain.
It was revised by Hrithik Bansal www on March 20, 2017. hrithikbansal.
Com */includes /includes a servo library for servo esc functions;
/Declare ESC as int input of servo object; void setup(){esc. attach(10);
/Connect ESC to the digital pin 10 serial. begin(9600);
Start reading/opening the serial monitorvoid loop(){
Input = analogRead (A0);
/The value of the input is the analog input on the pin 0 0 serial. print(
\"Original input value :\");
/Serial port print the original input value sequence. print(input); Serial. print(\" | \"); delay(1); input=map(analogRead(A0)
, 0,1023, 0,180);
/Map the input values of the joystick on analog pin 0 to the maximum and minimum values corresponding to the servo output: 180 and 0 serial. print(
\"Input value for mapping :\"); Serial. print(input);
/Serial prints the input value of the mapping Serial. print(\"\"); delay(1);
/Delay determines your resolution/smoothness and the motor\'s ability to respond to the movement of the Potwntiometer/joystick. esc. write(input);
The status of/ESC will be the same as the status/position of the joystick}
After uploading the code to arduino and re-checking all hardware connections, plug the battery into ESC and reset the arduino immediately (
Press the small reset button).
Then immediately place the potentiometer/joystick in either of the two extreme positions, which will be your high end point (
Where the motor will rotate at the highest speed).
You will hear some beeps again, after which the potentiometer/joystick is fully oriented towards the other end/the other end.
This will be your low end (
The motor will be stationery at this time).
Again, you will hear some beeps and the calibration work has been done. {
This has been demonstrated in the video
Project demo: video LinkNow, when you move the potentiometer knob/analog joystick to the upper/lower point, the brushless motor will accelerate/slow down accordingly.
Tip: During the test, due to the overall rotation of the motor (External rotor motor)
It\'s also dangerous that you can\'t hold it in your hands.
While testing it, the roll paper spinner accidentally flew out when the motor was spinning very fast: If you have any problems, please contact me: hrithikbansal70
Comhrithikbansal.
I hope this will solve your problem and you will learn something new today. Thank You!
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...