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

  Рет қаралды 35,813

Blue Robotics

Blue Robotics

2 жыл бұрын

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.com/learn/guide-...
Check out the T200 product page here: bluerobotics.com/store/thrust...

Пікірлер: 71
@pramodnishant1
@pramodnishant1 9 ай бұрын
Awesome simplified explanation. First time using ESC, it does not say which wire is what. Your video helped me understand that and more. :)
@ohnonotthevampire7191
@ohnonotthevampire7191 2 жыл бұрын
Fully technical and to the point. Wish all robotic tutorials were like your channel man. Keep it up!
@viktorkarlsohn3705
@viktorkarlsohn3705 Жыл бұрын
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.
@electroctgon7008
@electroctgon7008 6 ай бұрын
Thank you so much! This is the first tutorial that helped me :)
@joeturner3970
@joeturner3970 Жыл бұрын
thank-you
@TRAZExYT
@TRAZExYT Жыл бұрын
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?
@underlecht
@underlecht 2 жыл бұрын
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 жыл бұрын
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.
@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 жыл бұрын
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/
@tomjoad1060
@tomjoad1060 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@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.
@nickdavis3711
@nickdavis3711 Жыл бұрын
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
@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!
@davidhyland3833
@davidhyland3833 Жыл бұрын
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.
@nightleo5331
@nightleo5331 Жыл бұрын
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
@jodrafting
@jodrafting 11 ай бұрын
is this doing forward and reverse or do I have to split the reading and map accordingly
@BlueRobotics
@BlueRobotics 11 ай бұрын
This tutorial does both forward and reverse, but requires a speed controller that is compatible with that!
@fredbarnes196
@fredbarnes196 7 ай бұрын
How do you know what the thruster min/max values are for the map function?
@BlueRobotics
@BlueRobotics 7 ай бұрын
Hi Fred! This is easier to explain via email - please get in touch with our team at support@bluerobotics.com! Thanks!
@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
@StolenPopcatBen
@StolenPopcatBen 5 ай бұрын
how could i power this without a battery
@user-tx5ue8sz5j
@user-tx5ue8sz5j 4 ай бұрын
How to control only use ecs and servo controler
@th30c0der3
@th30c0der3 5 ай бұрын
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 5 ай бұрын
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 Жыл бұрын
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!
@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 жыл бұрын
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 Жыл бұрын
Like 185 ❤
@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?
@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 жыл бұрын
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 жыл бұрын
@@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 жыл бұрын
Just use a simple "servo tester"....simple and cheap
@brsrc759
@brsrc759 2 жыл бұрын
@@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 жыл бұрын
@@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
@zeiadahmedmadbouly8866
@zeiadahmedmadbouly8866 Жыл бұрын
how can i replace the potentiometer with a joystick
@BlueRobotics
@BlueRobotics Жыл бұрын
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
@Hazar-bt6nf
@Hazar-bt6nf 23 күн бұрын
Can it be run by raspberry pi5?
@BlueRobotics
@BlueRobotics 18 күн бұрын
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 18 күн бұрын
@@BlueRobotics I have raspberry pi5, can't I run it directly by connecting the motors to digital pins?
@BlueRobotics
@BlueRobotics 17 күн бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
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 9 ай бұрын
#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 9 ай бұрын
Hi there, the library file "Servo.h" must start with a capital "S".
@Elektrotechnik_EDV_Techniker
@Elektrotechnik_EDV_Techniker 9 ай бұрын
@@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
New Product: The T500 Thruster!
4:29
Blue Robotics
Рет қаралды 20 М.
УГАДАЙ ГДЕ ПРАВИЛЬНЫЙ ЦВЕТ?😱
00:14
МЯТНАЯ ФАНТА
Рет қаралды 4,1 МЛН
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 738 М.
How Brushless Motor and ESC Work and How To Control them using Arduino
12:45
How To Mechatronics
Рет қаралды 1,2 МЛН
BlueROV 2 build guide - most advanced amateur submersible!
20:33
Reading PWM Values from an RC Receiver using Arduino
4:06
The Bored Robot
Рет қаралды 51 М.
HYDRAULIC PRESS VS ARMOR, USA AND RUSSIA
10:16
Crazy Hydraulic Press
Рет қаралды 66 М.
Blue Robotics Tutorial: Using the Thruster Commander
8:28
Blue Robotics
Рет қаралды 6 М.
Underwater Thrusters with Brushless Motors for Drones!
4:12
Proto G Engineering
Рет қаралды 23 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
Controlling a Brushless Motor with Arduino
2:50
The Bored Robot
Рет қаралды 28 М.
Arduino Controlled ESC (Easy+ No Potentiometer!)
7:11
Black Falcon Electronics
Рет қаралды 30 М.
New Product: The Navigator Flight Controller
5:11
Blue Robotics
Рет қаралды 86 М.
Лазер против камеры смартфона
1:01
NEWTONLABS
Рет қаралды 710 М.
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 2,2 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 2,3 МЛН
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 3,5 МЛН
Looks very comfortable. #leddisplay #ledscreen #ledwall #eagerled
0:19
LED Screen Factory-EagerLED
Рет қаралды 2,8 МЛН