Pages: [1]   Go Down
Author Topic: using ESC to control motor speed  (Read 1736 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I have a basic question regarding the coding to use ESC's for motor speed control in Arduino UNO.

I have done some reading up and been scouring the web and the forums trying to find something that will help me solve my problems but I can't get my head around the issue.


What I am trying to do is to control the motor speed using a potentiometer. Ive connected a motor (MEDUSA 4300kv) to an ESC (picture attached) the ESC is connected to a regular 9V battery for power supply, the other end is connected to the Arduino ground (black wire from ESC) and a PWM pin for signal output (white wire from the ESC). NOTE I didnt know what to do with the red wire and from my understanding I didnt really need to connect it to the board. I used the following code which I got from the Arduino.cc example pages (the potentiometer is connected to A0 port, Ground, Arduino 5V pin):

Code:
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

The problem is that the motor doesn't go at full capacity or even close, I know this because it (motor and ESC) has been tested using a different control board that was controlled using a R/C transmitter-receiver set up with a variable power supply as source.

so basically: Help?



* IMG_2858.JPG (1807.64 KB, 2592x1936 - viewed 71 times.)

* IMG_2859.JPG (1397.24 KB, 2592x1936 - viewed 58 times.)
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are going to have to look up some data on the speed control. Most will list some sequence for ARMING the speed control like they must be set to low throttle for a short period of time and then advanced to half throttle and then back to low throttle. They will beep several times indicating that power has been applied and to signal that they are ARMED. If you don't go through the arming sequence they won't run the motor. Its for safety - Imagine attach the battery and your radio is at full throttle and you would have a real handfull...
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks to me that what you have got is a UBEC and not an ESC.

Anyway check your battery when it is under load to see if you have the voltage you are  expecting.

Quote
NOTE I didnt know what to do with the red wire[/quote]

You are right, don't use the read wire, on an ESC that is the positiv wire that deliver power to the receiver and servo's
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the ESC is connected to a regular 9V battery for power supply

Ah, you don't mean the little rectangular 9V "transistor" battery, do you?

There's not nearly enough current capacity there to run a motor as large as that one looks.

-j
Logged

0
Online Online
Shannon Member
****
Karma: 215
Posts: 12514
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ESC even for a small motor like that will probably take 2 to 5A peak to spin-up - a small battery is hopeless for RC brushless
motors - they are designed for extreme power density.  NiMH or lithium power pack as recommended by ESC manufacturer
is needed.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3080
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Running a brushless motor isn't really the same thing as running a servo.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Running a brushless motor isn't really the same thing as running a servo.

Yes it is. The ESC used to control and power a brushless motor expects a servo signal (a pulse between 1000 and 2000 microseconds every 20 mS).

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks guys a lot of new info for me to work on.

some questions though:

Quote
There's not nearly enough current capacity there to run a motor as large as that one looks.
what do you mean current capacity? how do i know what a batteries current capacity is?

Quote
a brushless motor expects a servo signal (a pulse between 1000 and 2000 microseconds every 20 mS.)
does that mean that i can't program a brushless (or a servo) without using the 'servo' library? for example if I send a 'HIGH' signal every 20ms and use the potentiometer to change a variable that pauses the HIGH signal between 1000-2000 microsec's?

suramu
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
for example if I send a 'HIGH' signal every 20ms and use the potentiometer to change a variable that pauses the HIGH signal between 1000-2000 microsec's?

This is exactly what the servo library do, no need to invent your own.

Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
what do you mean current capacity?
Voltage is only one component of the electrical power provided by a battery.  The other is current.

Quote
how do i know what a batteries current capacity is?
The only sure way is to read the datasheet.

Some chemistries provide more current than others. In general, larger batteries of the same chemistry provide more power than smaller batteries.

If your 9V battery is like this, it's a very small size of a lower powered chemistry, so you're only going to get a few tens of milliamps of current.

-j
Logged

Pages: [1]   Go Up
Jump to: