No video

Controlling a Brushless Motor with Arduino

This is an example that demonstrates how to control a brushless motor with a potentiometer and the Arduino Uno.
👉Subscribe for more robotics and engineering tips:
/ @theboredrobotllc
Share this video with a friend:
• Video
Affiliate Links:
Brushless In-Runner and ESC Combo: amzn.to/3omstPS
Flyfun Brushless ESC: amzn.to/3olVDOV
Emax Brushless Out-Runner: amzn.to/3afyRn4
Arduino Starter Kit - amzn.to/3oi0LEq
Disclaimer: This video contains affiliate links, meaning that if you make a purchase from one of the product links, I'll receive a small commission.

Пікірлер: 55

  • @not.farcraft
    @not.farcraft Жыл бұрын

    Can we use a usb cable in some way to power the ESC or do we need to use a battery if yes link the battery that you used with the blue motor pls

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    USB cables won't work to power an ESC. You'll need a battery. Here's a link to the battery that I used in the video: amzn.to/3YO5vUC It's a NiMH battery, since I happened to have one around. A Lipo battery would also work better and has a better mass to power capacity ratio. Here's an example of one: amzn.to/3XNWxpg

  • @not.farcraft

    @not.farcraft

    Жыл бұрын

    @@TheBoredRobotLLC ok thanks

  • @Lucasnalii_treinador
    @Lucasnalii_treinador Жыл бұрын

    Hi,, excelent video ! a problem here, with low values of potentiometer, i have high speed of my motor controlled by ESC, cant understand that..can you help me ?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    I would check to see how you're mapping the potentiometer values to the ESC output values in your code. Use some print statements to debug what those values are.

  • @accordv6er
    @accordv6er2 жыл бұрын

    So... Could I use an analog 5v signal as an input instead of the pot? Program a cutoff for the 0.5v/4.5v range. Control the ESC, which gives me 12v+ output for... A stupid cheap and capable PWM fuel pump setup. Could also add MAP sensor, temp, and relays, to have a fallback of wide open off the fuel pump relay if the fuel pumps don't like playing below 50% DC

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    Using an analog signal instead of a pot is essentially the same thing, so it should work. For the ESC and motor/pump, I would have to know more about the specs to answer the question of whether it would work or not. But fundamentally, I don't see why it wouldn't work as well.

  • @derfanvontjc2209
    @derfanvontjc22096 ай бұрын

    In the serial monitor it spits out numbers acording to the Potentiometer but my esc doesent do anything I am completly new to this topic. Can you help me ?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    6 ай бұрын

    The first steps to debug this would to write a simple sketch to run the motor only with hard coded values. Then you can see if it's something with how your setting up your motor movement. After that, then you can incorporate the analog read code to control the speed.

  • @theekoahmed1376
    @theekoahmed13762 жыл бұрын

    can i know what kind of battery you are using

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    I used a 6 cell NiMh battery, in the video, but you can also use a Lipo battery. Just check the voltage rating of your speed controller.

  • @Mrfreshcucumber
    @Mrfreshcucumber3 жыл бұрын

    This is so good thank you

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    Thank you!

  • @m.i1343
    @m.i1343 Жыл бұрын

    hmmm , would it be possible to wire an encoder to use this kind of setup for a robotics project i am working on? o-drive seem like the only solution but they are WAY TO EXPENSIVE

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    Using a rotary encoder does seem like it would be possible. I believe there are several inexpensive options. You would also have to figure out a way to couple the output shaft of the motor to the encoder.

  • @MattExo-Dynamics
    @MattExo-Dynamics2 жыл бұрын

    Hello, great video, im wanting to use force resistance sensors to activate the motor, 1 for forwards 1 for reverse. Code wise do i need to have 2 servo/pot readings 1 off each sensor, 1 at 0-90 and the other at 90-180? Tia And ofcourse the correct esc

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    If I understand your problem correctly, you want to have one sensor control the speed in the forward direction and the other in reverse. You'll only need one servo output to the ESC. If sensor 1 is reading a force, then send a "forward" servo value to the pin, and if sensor 2 is reading a force, then send a "reverse" servo value to the same pin.

  • @MattExo-Dynamics

    @MattExo-Dynamics

    2 жыл бұрын

    @@TheBoredRobotLLC thanks for the help!

  • @farisabulkhoir9874
    @farisabulkhoir98743 жыл бұрын

    hello sir, my motor does not respond to potentiometer. then i adjust the potentiometer to 90 as you suggest, but i dont hear the beep and the motor still does not respond to the potentiometer. i am using the built-in esc from the rc off road car. how should i do to solve this problem ?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    It may not be 90 that initializes your particular ESC. If it was me, I would first double check that I am receiving or sending the appropriate signals to/from the Arduino. Then I would slowly adjust the pot until I see or hear something happen. Or, if you have have an RC transmitter and receiver, you can try getting the motor running without the Arduino first. Then you can measure the signal coming from the RC receiver using the pulsein command. That should give you an idea of the pulse width that the ESC is expecting.

  • @kingkasma4660
    @kingkasma466010 ай бұрын

    How do you power your motor? I want to use it for a stationary project so i dont want to use lipos i read online that powering a motor via a power supply is a bad idea, so i wonder how manufacturers are doing it.

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    10 ай бұрын

    I don't see a problem with powering a motor with a power supply, as long as you set the correct voltage and current. You just need to make sure the power supply is capable of delivering enough current for your application.

  • @kingkasma4660

    @kingkasma4660

    10 ай бұрын

    @@TheBoredRobotLLC My Problem is the Powerspike when the motor is slowing down. With a battery it seems to be no issue but i read that power supplys can shut off or even blowup/Break

  • @mazarnejad901
    @mazarnejad901 Жыл бұрын

    I really need help. How can i control the brushless motor with Arduino code and app inventor via wifi?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    I've never used app inventor before, but I'd happy to discuss the project with you in further detail. Feel free to contact me here: www.theboredrobot.com/contact

  • @lol-nb1ch
    @lol-nb1ch7 ай бұрын

    Is it possible to use brushed motor esc? For brushless motor?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    7 ай бұрын

    No, you are going to want to use a brushed ESC with a brushed motor, and a brushless ESC with a brushless motor.

  • @kenjichanhkg
    @kenjichanhkg2 жыл бұрын

    Would this setup work with a group of 18650 batteries?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    I've never tried it with those types of batteries, but I wouldn't expect any problems. Just make sure the battery voltage doesn't exceed the maximum voltage and the ESC.

  • @phamnguyennhatminh3698
    @phamnguyennhatminh36983 жыл бұрын

    hello sir. Can we reverse the motor by code ?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    If you have an electronic speed controller that can go in reverse (usually the ones for RC cars), then you should be able make the motor spin in reverse from the code.

  • @jirivchi

    @jirivchi

    Жыл бұрын

    @@TheBoredRobotLLC great video! how should we change the code to reverse the motor? thanks

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    @@jirivchi In this video, I used the servo library. Assuming that you have a reversible ESC, the "90 degree" output should be a zero speed. Sending a "0 degree" signal will spin the motor full speed in one direction and "180 degrees" will move the motor full speed in the other direction. Anything in between will be a speed less than full speed in the respective direction.

  • @Chupria
    @Chupria3 жыл бұрын

    Great video, how do you initialize yours to 90? Do you say int speed=90 instead of int speed =0?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    It depends on the electronic speed controller. If you use an ESC that's generally used for drones, then you'll have to initialize it to 0, since it doesn't go in reverse. If you're using an ESC that is usually used for RC cars, you'll initialize to 90. It really can depend from one ESC to another. I recommend testing out with a potentiometer and listening to hear when the ESC sends out the initialization beeps.

  • @Chupria

    @Chupria

    3 жыл бұрын

    ​@@TheBoredRobotLLC Interesting...when i use a potetiomter everything works fine, but if i add speed values by hand into the software it won't reverse...maybe i broke my arduino...lol

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    @@Chupria Keep in mind that the ESC starts by waiting for a "zero speed" condition when it first gets power. Then you can move it to a specific speed. If you're simply changing a number and re-uploading the Arduino every time, it may not work. You sometimes need to initialize to a zero speed with every upload to the Arduino, even if you didn't cut power to the ESC. Start by sending the zero speed signal in the setup(), delay it for about a second, then in the loop(), write your desired motor speed.

  • @Chupria

    @Chupria

    3 жыл бұрын

    @@TheBoredRobotLLC Yup, apperannly the ESC needs a constant stream of data, this is why the potentiometer worked in changeing the direction. If you want flip the direction only using Arduino IDE, you need to send values constanly in a loop to the ESC and then it will reverse it just like with the potentiometer.

  • @mohamedaminehouij6968
    @mohamedaminehouij69683 жыл бұрын

    Hi can we add a reverse button ?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    For the motor to go in reverse, you need to make sure your electronic speed controller is capable of changing the direction. To use a button to control the direction, you can wire up the Arduino to read if a button is pushed or not from one of the digital pins. Then from this you can decide if you want to send servo values between 0 and 90 (reverse) or 90 and 180 (forward).

  • @TheJavaSync
    @TheJavaSync2 жыл бұрын

    More visible on expalining code pls, it's hard to see from my phone cell '(

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    I apologize for that. In my later videos, I made the font larger.

  • @scooterboom4157
    @scooterboom4157 Жыл бұрын

    😃 you are grait at teaching

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    Thank you!

  • @scooterboom4157

    @scooterboom4157

    Жыл бұрын

    can I use the do the same thing with bigger brushless motors?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    @@scooterboom4157 Yes, this can be done with bigger motors, assuming that you have the proper ESC to power them.

  • @scooterboom4157

    @scooterboom4157

    Жыл бұрын

    @@TheBoredRobotLLC so you mean that I can use the same motor driver?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    Жыл бұрын

    ESC is short for electronic speed controller, or what you're referring to as the motor driver. You need to make sure the ESC/motor driver can handle the bigger motor.

  • @wannistelrooy
    @wannistelrooy3 жыл бұрын

    Can 2 esc plug into arduino?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    Yes, you can connect two ESC's to the Arduino. Just make sure they are getting power from an external source.

  • @wannistelrooy

    @wannistelrooy

    3 жыл бұрын

    @@TheBoredRobotLLC can you make a video 2 esc connecting to arduino?

  • @wannistelrooy

    @wannistelrooy

    3 жыл бұрын

    @@TheBoredRobotLLC by the way..where should I plug the 2nd esc?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 жыл бұрын

    @@wannistelrooy You can plug the signal wire of the ESC into another digital output on your Arduino. The power and ground can be from the same source as your other ESC.

  • @bazrazin1
    @bazrazin13 жыл бұрын

    no body's telling the value of the pot. 10k, 50k , 100k on ytube.

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 жыл бұрын

    For this example, I used a 10k pot.