Blue Robotics Tutorial: Controlling an ESC with an Arduino and a Potentiometer

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • In this tutorial, we'll show you how to use an Arduino and potentiometer to control the speed of a brushless motor like our T200 Thruster.
    Written tutorial: bluerobotics.c...
    Check out the T200 product page here: bluerobotics.c...

КОМЕНТАРІ • 71

  • @ohnonotthevampire7191
    @ohnonotthevampire7191 2 роки тому +6

    Fully technical and to the point. Wish all robotic tutorials were like your channel man. Keep it up!

  • @viktorkarlsohn3705
    @viktorkarlsohn3705 Рік тому +3

    Mine did not work. I kept going over the wiring and code. Really made me scratch my head. This morning thought that I would try again. As I was staring at it, I heard a noise that made me jump out of my chair. It was WORKING! I was not waiting the full 7 second delay. Thank you! OBTW: One can discard the pot by connecting 3.3V pin directly to the A0 pin.

  • @pramodnishant1
    @pramodnishant1 10 місяців тому +2

    Awesome simplified explanation. First time using ESC, it does not say which wire is what. Your video helped me understand that and more. :)

  • @electroctgon7008
    @electroctgon7008 7 місяців тому

    Thank you so much! This is the first tutorial that helped me :)

  • @underlecht
    @underlecht 2 роки тому +3

    Perfect explanation, thanks. I like your setup of connecting things, so you can plug-&-play with peripherals (no need to solder the battery). I wonder, could such setup be used in real device? Or all these intermediate things add noise/resistance, and can only be used in building proof of concept?

    • @BlueRobotics
      @BlueRobotics  2 роки тому +2

      Hi Mantas, you can absolutely use connections like this in a real device. The connectors we chose here are all rated for the appropriate voltage and current so they don't have a big impact on the system performance.

  • @tomjoad1060
    @tomjoad1060 Рік тому +1

    thank you for the video. I am trying to make nRF24 controlled boat (drone), and need a "reverse" function on the motor, controlled through ESC. I think I may get an idea of how to do it from your video.

    • @hazzchah
      @hazzchah Рік тому

      Hii! Were you able to do a reverse function on through a regular ESC? How did you manage to do so via code without swapping 2 of 3 ESC to Motor connections? Thanks in advance.

    • @tomjoad1060
      @tomjoad1060 Рік тому +1

      @@hazzchah I used a bi-directional ESC. Look at the code and you will understand how it reverses direction. I believe it's not possible to do the same through regular ESC. Essentially when joystick is in the middle, it reads as 0. But when I start to move joystick up or down, throttle rotates, either clockwise or counterclockwise. Again look at the code... And good luck!

    • @hazzchah
      @hazzchah Рік тому +2

      @@tomjoad1060 Thank you very much! I spent a whole day just trying to figure out how to reverse the direction via code without adding any additional circuitry or manually swapping 2 of the 3 phase junctions. I'll go find a bi-directional esc now. Thank you again.

  • @TRAZExYT
    @TRAZExYT Рік тому +1

    Can i power up an ardiuno using bec(gnd and +ve to ardiuno 5v and gnd) and also connect a 11.1v 2.6ah battery into ardiuno vin and gnd at the same time or is it bad for the ardiuno like burning up?

  • @davidhyland3833
    @davidhyland3833 Рік тому +1

    How would you change this code to make the thruster be able to reverse?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi David, this code already supports having the thruster run in forward and reverse. Note that you do have to have a speed controller (ESC) capable of doing that, and many of them are designed for just one direction. The "Basic ESC" we use here can do both.

  • @user-tx5ue8sz5j
    @user-tx5ue8sz5j 6 місяців тому

    How to control only use ecs and servo controler

  • @nightleo5331
    @nightleo5331 Рік тому +1

    I've tried connecting 2 thrusters to an arduino, but they don't spin. If I tell the arduino to only spin one of the two motors, it spins, but as soon as I try to spin them simultaneously, it doesn't work. Is it even possible for multiple thrusters to spin simultaneously? If so, how do we do it?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi NightLeo, you can absolutely do this! Can't really say what's wrong without seeing you code and setup. If you make a post on our forums here, we'll be happy to help! discuss.bluerobotics.com/c/blue-robotics-products/escs/29

  • @joeturner3970
    @joeturner3970 Рік тому

    thank-you

  • @nickdavis3711
    @nickdavis3711 Рік тому +1

    Could I have more precision speed control of I go to a 20k, multi turn pot instead of the 10k? I'm trying to find my EDFs lowest point of operation.

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi Nick, that wouldn't give you any more precision here. If you want to test your EDFs precisely, we'd recommend adjusting the Arduino program to step up a bit at a time until it starts. That way you'll know exactly when it starts as well! If you're not comfortable with Arduino, that would be a great project to get started with. This page has some good examples to start from: makersportal.com/blog/2020/3/14/arduino-servo-motor-control

  • @StolenPopcatBen
    @StolenPopcatBen 7 місяців тому

    how could i power this without a battery

  • @th30c0der3
    @th30c0der3 6 місяців тому

    I Have a question about values you passed in function map()
    Why did you pass ,0,1023,1100,1900 i mean why these values and is these values can be determine by brushless motor kv or by esc because if i have different motor and different esc how can i put a values are compitable with mine

    • @BlueRobotics
      @BlueRobotics  6 місяців тому

      Hi there! We used 0-1023 as the input range because that is the range measured by the potentiometer with the analogRead function. We used 1100-1900 as the output range because that is the signal range that the ESC accepts as a valid signal. These values should work for the vast majority of ESCs!

  • @Alexisger
    @Alexisger Рік тому

    What are the specs of the battery? Also there is no need for battery protection? And how you power Arduino? I mean when not connect it to usb

    • @BlueRobotics
      @BlueRobotics  Рік тому +1

      Hi there! It’s a 4S battery with a 230Wh capacity, and it doesn’t have a BMS (battery system management).
      Arduino boards have five options in which they can be powered:
      * Powering via USB connector
      * Powering via the onboard barrel jack connector (if available on the board)
      * Powering via the onboard battery connector (if available on the board)
      * Powering via the VIN (Voltage In) pin
      * Powering via the 3V3/5V pin*
      If you have other questions, please reach out to our team at support@bluerobotics.com!

  • @fredbarnes196
    @fredbarnes196 9 місяців тому

    How do you know what the thruster min/max values are for the map function?

    • @BlueRobotics
      @BlueRobotics  8 місяців тому

      Hi Fred! This is easier to explain via email - please get in touch with our team at support@bluerobotics.com! Thanks!

  • @hanselhermawan4596
    @hanselhermawan4596 Рік тому

    why is this not working with my esc ? after i ran the code, the motor run for a second then it stopped. I tried to recompile and give the input to the esc, but its not working anymore

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi, it should work continuously. Issues like this are typically from insufficient power that causes the voltage to drop and reset the Arduino. Are you powering from a battery?

  • @mehmetumitack5594
    @mehmetumitack5594 Рік тому

    The motor only increases to the speed we entered momentarily, then turns slowly at a constant speed again. It repeats this in short periods. What would be the reason?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi Mehmet, can you share the exact code you are using on our forums? I'm sure there's a reason, but it's hard to know without seeing the code. discuss.bluerobotics.com

  • @brsrc759
    @brsrc759 2 роки тому

    How do I wire a regular RC ESC to work with the transmitter and potentiometer feedback like a small servo controller? Basically I want to use an ESC to control a large motor for a custom servo.

    • @BlueRobotics
      @BlueRobotics  2 роки тому +1

      Hi, you can use this technique with any ESC, but you'd have to change the code on the Arduino to start at 1100 and go up to 1900 microseconds signal. The example in this video is for bidirectional ESCs and starts at 1500 microseconds, going to 1100 and 1900 in each direction. Here's the written version as well: bluerobotics.com/learn/guide-for-controlling-the-basic-esc-with-a-potentiometer/

  • @Mi78
    @Mi78 2 роки тому

    I get why you obviously have to connect a signal wire between arduino and esc, but why ground (and then why not 5v)?

    • @BlueRobotics
      @BlueRobotics  2 роки тому +1

      Hi Milo, the ground connection is required to complete the circuit so that the Arduino can properly measure the signal. With a single wire, there wouldn't be any flow of electricity, just like any electrical circuit. You don't have to connect the 5v wire because that only provides power to each device and they are separately powered (ESC by battery and Arduino through USB port).

  • @arduinomaquinas
    @arduinomaquinas Рік тому +2

    Like 185 ❤

  • @jodrafting
    @jodrafting Рік тому

    is this doing forward and reverse or do I have to split the reading and map accordingly

    • @BlueRobotics
      @BlueRobotics  Рік тому

      This tutorial does both forward and reverse, but requires a speed controller that is compatible with that!

  • @adamjacobmoro4657
    @adamjacobmoro4657 Рік тому

    Great vid! One question, why do the values that the arduino reads from the pot range from zero to 1023? Is this dependent on the value of the pot?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi Adam, the reason is because the analog to digital converter (ADC) on the Arduino is a "10-bit ADC". 10 bits means it has 2^10 = 1024 possible readings. So, when reading a voltage between 0 to 5V, it maps that reading to one of those values from 0-1023, which is 1024 possible measurements. Google can probably tell you a lot more about the Arduino ADC!

    • @adamjacobmoro4657
      @adamjacobmoro4657 Рік тому

      @@BlueRobotics great that clears it up, thank you much!

  • @zeiadahmedmadbouly8866
    @zeiadahmedmadbouly8866 Рік тому

    how can i replace the potentiometer with a joystick

    • @BlueRobotics
      @BlueRobotics  Рік тому +1

      Hi there, you can use a joystick that has the same type of analog output as a potentiometer, like this one: www.adafruit.com/product/512?gclid=CjwKCAjwuqiiBhBtEiwATgvixDMCx7IXv09zDqk0-3Tk3Z5XYOJqd3f1fsJoWF0q7Cb-WYmNeeP7PhoCTwUQAvD_BwE

  • @brsrc759
    @brsrc759 2 роки тому

    why is the Arduino needed? Wouldn't the speed control work with the potentiometer if you just plug the potentiometer directly into the three prong that would normally go to a receiver?

    • @BlueRobotics
      @BlueRobotics  2 роки тому +2

      Unfortunately, not. ESCs listen to "servo-style PWM signals" which is a short pulse that indicates the speed. Potentiometers just output an analog voltage that varies as you rotate the knob, but the ESCs typically won't take that as an input. The Arduino is just there to translate from the analog voltage to a PWM signal.

    • @brsrc759
      @brsrc759 2 роки тому +1

      @@BlueRobotics oh now I get it! That really clears it up for me. So is there some way that maybe I can tap into the pwm signal on a small servo circuit board with the ESC 3 wire connector? Thank you so much for your time. I really appreciate it. 🤙

    • @TheWingnut58
      @TheWingnut58 2 роки тому +3

      Just use a simple "servo tester"....simple and cheap

    • @brsrc759
      @brsrc759 2 роки тому +1

      @@TheWingnut58 yeah that's a good point. I wonder if that will work, using a servo tester as a potentiometer connected to the steering. That would be a heck of a lot easier and cheaper than messing with all that Arduino stuff

    • @TheWingnut58
      @TheWingnut58 2 роки тому +2

      @@brsrc759 yes, it will absolutely work.....I've been into R/C 40+ years and have used servo testers on everything from micro servos all the way up to the giant scale stuff as well as for testing motor/ESC combinations on drones.
      You could use a large servo on the rudder and rig some sort of spring system to "self center" the servo tester as well as using one to controll the motor speed....

  • @jasonho6040
    @jasonho6040 Рік тому

    is there a limit to how many thrusters an arduino can control?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      You can use any digital pin to control a thruster speed controller with an Arduino using the Servo library, so it's quite a few! If you want the thrusters to all behave the same, then you can connect one signal to multiple speed controllers.

  • @christosvasiliou219
    @christosvasiliou219 Рік тому

    can you use a similar script for rsapberry pi ?

    • @DigBipper188
      @DigBipper188 Рік тому

      should be possible. the GPIO on a RasPi should be fast enough to handle firing a PWM signal to an ESC

  • @Hazar-bt6nf
    @Hazar-bt6nf 2 місяці тому

    Can it be run by raspberry pi5?

    • @BlueRobotics
      @BlueRobotics  2 місяці тому

      To control thrusters with a Raspberry Pi, we recommend a PWM Hat like the one from Adafruit: www.adafruit.com/product/2327. You can follow tutorials on controlling the servo motor, which should also work with the ESCs!

    • @Hazar-bt6nf
      @Hazar-bt6nf 2 місяці тому

      @@BlueRobotics I have raspberry pi5, can't I run it directly by connecting the motors to digital pins?

    • @BlueRobotics
      @BlueRobotics  2 місяці тому

      @@Hazar-bt6nf please reach out to our team at support@bluerobotics.com to continue this conversation!

  • @ahmeddiab9778ytr
    @ahmeddiab9778ytr Рік тому

    can i use 50k potentiometer?

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi there, yes, that should work fine as well.

    • @ahmeddiab9778ytr
      @ahmeddiab9778ytr Рік тому

      that should i change pwm value or the same?

    • @BlueRobotics
      @BlueRobotics  Рік тому +1

      @@ahmeddiab9778ytr It should result in the same PWM output value.

    • @ahmeddiab9778ytr
      @ahmeddiab9778ytr Рік тому

      thank you 😊 i want ask you about something i made robot arm using bruchless motor but I can't know how to control it with arduino or another board

    • @BlueRobotics
      @BlueRobotics  Рік тому +1

      @@ahmeddiab9778ytr Cool! That's not something we're familiar with but I'm sure you can find some others online doing robotic arms with Arduinos!

  • @nicker3115
    @nicker3115 Рік тому +1

    230$???? A PIECE OF PLASTIC WITH A 10$ MOTOR?
    WTF IS THE "T200 THruster" WTF

    • @BlueRobotics
      @BlueRobotics  Рік тому

      Hi there! Please send us a message at sos@bluerobotics.com if you have any issues with your thrusters and we'd be happy to help you there!

  • @Elektrotechnik_EDV_Techniker
    @Elektrotechnik_EDV_Techniker 11 місяців тому +1

    #include
    byte servoPin = 9;
    byte potentiometerPin = A0;
    Servo servo;
    void setup() {
    Servo.attach(servoPin);
    Servo.writeMicroseconds(1500);
    delay(7000)
    }
    void loop() {
    int potVal = analogRead(potentiometerpin);
    int pwmval = map(potval,0, 1023, 1100, 1900);
    servo.writeMicroseconds(pwmval);
    }C:\Users\jakob\AppData\Local\Temp\.arduinoIDE-unsaved2023911-21968-4mb429.ejflx\sketch_oct11a\sketch_oct11a.ino:1:10: fatal error: servo: No such file or directory
    #include
    ^~~~~~~
    compilation terminated.
    exit status 1
    Compilation error: servo: No such file or directory
    help mi

    • @BlueRobotics
      @BlueRobotics  11 місяців тому +1

      Hi there, the library file "Servo.h" must start with a capital "S".

    • @Elektrotechnik_EDV_Techniker
      @Elektrotechnik_EDV_Techniker 11 місяців тому

      @@BlueRobotics C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino: In function 'void setup()':
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:10:6: error: expected unqualified-id before '.' token
      Servo.attach(servoPin);
      ^
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:11:6: error: expected unqualified-id before '.' token
      Servo.writeMicroseconds(1500);
      ^
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:14:1: error: expected ';' before '}' token
      }
      ^
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino: In function 'void loop()':
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:17:27: error: 'potentiometerpin' was not declared in this scope
      int potVal = analogRead(potentiometerpin);
      ^~~~~~~~~~~~~~~~
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:17:27: note: suggested alternative: 'potentiometerPin'
      int potVal = analogRead(potentiometerpin);
      ^~~~~~~~~~~~~~~~
      potentiometerPin
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:19:20: error: 'potval' was not declared in this scope
      int pwmval = map(potval,0, 1023, 1100, 1900);
      ^~~~~~
      C:\Users\jakob\OneDrive\Dokumente\Arduino\sketch_oct11a\sketch_oct11a.ino:19:20: note: suggested alternative: 'potVal'
      int pwmval = map(potval,0, 1023, 1100, 1900);
      ^~~~~~
      potVal
      exit status 1
      Compilation error: expected unqualified-id before '.' token
      #include
      byte servoPin = 9;
      byte potentiometerPin = A0;
      Servo servo;
      void setup() {
      Servo.attach(servoPin);
      Servo.writeMicroseconds(1500);
      delay(7000)
      }
      void loop() {
      int potVal = analogRead(potentiometerpin);
      int pwmval = map(potval,0, 1023, 1100, 1900);
      servo.writeMicroseconds(pwmval);
      }
      weis nicht weiter