Brushless Dc Motor with potentionmeter and ESC

hi , i need a code to control my brushless Dc motor with potentiometer using ESC and arduino uno borad .
actually im beginner and tried many codes but motor didnat work , i think the problem about maping using , potentiometer min. and max are 0 to 1023 , but motor input or PWM i dont know the values and i don`t think it will be 0 & 179 like servo motor

Well - first off, you might want to supply us with more info about exactly -which- ESC you are using; most ESCs have a method of "arming" them that must be followed before they will recognize any input to control speed or direction (it's a safety feature). Do you know what this arming method is for your ESC? Does the instructions for the ESC say what it is? Can you tell -us- what it is? Also - are you using the Servo library to interface with the ESC? Nothing else will work (PWM -will not- work), short of something that is basically a rewrite of the Servo library...

Also there is an example sketch in the arduino IDE in the servo section called knob that is the basics of what you are trying to do, read a pot and control a servo (which is what a ESC emulates). That does not perform the 'arming sequence' your ESC may require which you would have to add to the setup function.

Lefty
Knob sketch:

// 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 ESC type is volcano-25(07E03) ( 30 A )
and i tried the servo library and it doesn't work , i thought that the problem in mapping ( the value 179 )

ESC reading material.

http://www.google.com/search?hl=en&as_q=esc++site%3Ahttp%3A%2F%2Farduino.cc%2Fforum&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

kero0zero:
the ESC type is volcano-25(07E03) ( 30 A )
and i tried the servo library and it doesn't work , i thought that the problem in mapping ( the value 179 )

It could very well be, the default servo pulse widths the servo library uses (when using degree arguments) is quite wide (544usec to 2400usec and could cause problem when using 0-179 degree arguments.

I have come to always using writeMicroseconds(xxxx) commands where I will restrict the pulse width arguments to 1000 to 2000usec as was always the R/C worlds default values, unless specific servo device proves to be able to handle wider usec ranges.

A typical ESC should respond to the following usec widths as stated:

myservo.writeMicroseconds(1000); // set ESC to stop
myservo.writeMicroseconds(1500); // set ESC to 50% speed
myservo.writeMicroseconds(2000); // set ESC to 100% of rated speed

Lefty

I think RC receivers may just use a +-45 deg range from a neutral point (at least that is the deal with a servo tester I bought). You might try using 45 deg for the low and 135 deg for the high.

zoomkat:
I think RC receivers may just use a +-45 deg range from a neutral point (at least that is the deal with a servo tester I bought). You might try using 45 deg for the low and 135 deg for the high.

]

Well the main point is that servos and ESCs respond to the electrical pulse width of the applied signal. The whole degree thing is a human friendly abstraction and as I said the default pulse widths the arduino servo library uses has caused damage to some servos causing them to jam into there travel gear stops.

There is no 'standard' R/C degrees of travel for servos, the arduino library does a disservice in assuming all servos are capable of 180 degrees of travel, and as stated that can be harmful to some models of servos. Sticking to 1000 to 2000 usec will always safely fall within any standard servo's range, no matter how much or little 'over travel' that specific servo might be capable of.

Lefty

There is no 'standard' R/C degrees of travel for servos, the arduino library does a disservice in assuming all servos are capable of 180 degrees of travel, and as stated that can be harmful to some models of servos. Sticking to 1000 to 2000 usec will always safely fall within any standard servo's range, no matter how much or little 'over travel' that specific servo might be capable of.

As well as there is generally no standard of what range of usec a servo will respond to. Although most servos can rotate ~180 deg., the makers usually don't spec the servos beyond 90 deg. of rotation and associated usec values. An ESC is not a servo, so it may have its own usec specs.

zoomkat:

There is no 'standard' R/C degrees of travel for servos, the arduino library does a disservice in assuming all servos are capable of 180 degrees of travel, and as stated that can be harmful to some models of servos. Sticking to 1000 to 2000 usec will always safely fall within any standard servo's range, no matter how much or little 'over travel' that specific servo might be capable of.

As well as there is generally no standard of what range of usec a servo will respond to. Although most servos can rotate ~180 deg., the makers usually don't spec the servos beyond 90 deg. of rotation and associated usec values. An ESC is not a servo, so it may have its own usec specs.

Well I will again restate. Al hobby type servos and ESCs will respond to and have no problems or damage possiblity responding to the R/C standard of 1000 usec = 0% or travel and 2000 usec = 100% of travel, you might say they are guaranteed to be able to respond to pulse widths in that range. Any movement below or beyond 1000 to 2000 usec is said to be 'overtravel' in the servo world.

So while most all servos do have some 'overtravel' above and below those 'standard' pulse widths, but just not to any fixed standard, and they may or may not state the min and max pulse width allowed in their datasheet. The R/C world never relayed on specific degrees of travel for their servos usually as they used adjustable bell-cranks and adjustable linkages to set travel ranges for things like rudder, throttle, etc.

Lefty