Controlling a Brushless Motor with Arduino

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • 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.

Комментарии • 57

  • @SYED6304
    @SYED6304 Месяц назад

    Hi, can you please add the detail and specs about material used in description of video. Like Motor (voltage/current) rating, battery (voltage/current) rating, Type of Arduino used etc. Thanks.

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  Месяц назад

      The motor/ESC combo are in the description of the video. I used an 11.1v Lipo battery.

  • @not.farcraft
    @not.farcraft Год назад +1

    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  Год назад +1

      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

  • @MattExo-Dynamics
    @MattExo-Dynamics 3 года назад

    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  3 года назад +1

      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 3 года назад

      @@TheBoredRobotLLC thanks for the help!

  • @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  Год назад +1

      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.

  • @theekoahmed1376
    @theekoahmed1376 3 года назад +1

    can i know what kind of battery you are using

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 года назад +1

      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.

  • @accordv6er
    @accordv6er 2 года назад

    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 года назад +1

      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.

  • @kingkasma4660
    @kingkasma4660 Год назад

    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  Год назад

      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 Год назад

      @@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

  • @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.

  • @Chupria
    @Chupria 3 года назад

    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.

  • @derfanvontjc2209
    @derfanvontjc2209 8 месяцев назад

    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  8 месяцев назад

      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.

  • @kenjichanhkg
    @kenjichanhkg 3 года назад

    Would this setup work with a group of 18650 batteries?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 года назад

      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.

  • @farisabulkhoir9874
    @farisabulkhoir9874 3 года назад

    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 года назад +1

      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.

  • @lol-nb1ch
    @lol-nb1ch 9 месяцев назад

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

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  9 месяцев назад

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

  • @mazarnejad901
    @mazarnejad901 2 года назад

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

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  2 года назад

      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

  • @Mrfreshcucumber
    @Mrfreshcucumber 3 года назад

    This is so good thank you

  • @phamnguyennhatminh3698
    @phamnguyennhatminh3698 3 года назад +1

    hello sir. Can we reverse the motor by code ?

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 года назад +1

      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  Год назад +2

      @@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.

  • @mohamedaminehouij6968
    @mohamedaminehouij6968 3 года назад

    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).

  • @wannistelrooy
    @wannistelrooy 3 года назад

    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  3 года назад

      @@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.

  • @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.

  • @TheJavaSync
    @TheJavaSync 3 года назад

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

    • @TheBoredRobotLLC
      @TheBoredRobotLLC  3 года назад

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

  • @bazrazin1
    @bazrazin1 3 года назад

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