DIGITAL SPEED CONTROL HELP!! PLEASE

hello

i am trying to urgently control a digital RC speed control (SC) .
It is a Hitec SP-1801n which you can see here:
www.hitecrcd.com/Manuals/SpeedControls/Sp1801.pdf

I want to control the speed of the motor with an arduino.
I had a servo program running, with an ultra sound sensor controlling a servo, and I was told that the speed controll should use a similar PWM output as the servo.

Im not sure how to make this work, i;d like to test it with a simple PWM output program or something. I spoke to a guy from hi tec who said that the SC probably wants 900 - 2100 microseconds PWM... do you know how i can output this 'by hand' as it were to test the setup

thanks a lot

I have just tried this program which works.
Motor spins up for half a second then stops for 1000 ms
Does any one know how i can manually write a speed test script. So i can see how this motor and SC behave together.
Something like:

low speed delay 1000ms
nothing delay 1000ms
low speed + 10% delay 1000ms
nothing delay 1000ms
low speed + 20%, delay 1000ms
nothing delay 1000ms
low speed + 30%, delay 1000ms
nothing delay 1000ms
low speed + 40%, delay 1000ms

etc....

?

int servoPin = 7; // R/C Servo connected to digital pin
int myAngle; // angle of the servo (roughly in degrees) 0-180
int pulseWidth; // function variable

void servoPulse(int servoPin, int myAngle) {
pulseWidth = (myAngle * 11) + 500; // converts angle to microseconds
digitalWrite(servoPin, HIGH); // set servo high
delayMicroseconds(pulseWidth); // wait a very small amount
digitalWrite(servoPin, LOW); // set servo low
delay(20); // refresh cycle of typical servos (20 ms)
}

void setup() {
pinMode(servoPin, OUTPUT); // set servoPin pin as output
}

void loop() {
// cycle through every angle (rotate the servo 180 slowly)
for (myAngle=0; myAngle<=180; myAngle++) {
servoPulse(servoPin, myAngle);
}
delay(1000);
}

Most servos work from 1 to 2 ms with a 20ms pause between pulses. On a continous rotation servo or a speed controller with reverse 1.5ms is stop and less is reverse. Since this seems to be a one way controller I would send pulses to the controller and a message to the debug window to find out what values equate to what speeds.

Why not use the servo example sketch that is in the 0012 distribution. The sketch is called knob and uses a pot to control the servo pulse width.

eep.

thank you

how would i code a simple burst to the controller, and then how do i get the readout back?

thanks again
vahakn

I ran the SERVO POT sketch which worked,
except the speed control wasnt very comprehensive.
The motor rotates at a medium fast speed when I send angle command 122. The pot then speeds it up to angle command 160 or so, at which point it is very very fast.

It is a DC motor.. can these things not run slowly?

I then adapted this second sketch to send quick pulses (like a stepper motor) :

#include <Servo.h>

Servo myservo; // create servo object to control a servo

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
//open serial port:
Serial.begin(9600);
}

void loop()
{

myservo.write(122); // sets the servo position according to the scaled value
delay(1); // waits for the servo to get there
myservo.write(0);
delay(1000);

myservo.write(122); // sets the servo position according to the scaled value
delay(5); // waits for the servo to get there
myservo.write(0);
delay(1000);

myservo.write(122); // sets the servo position according to the scaled value
delay(10); // waits for the servo to get there
myservo.write(0);
delay(1000);

myservo.write(122); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
myservo.write(0);
delay(1000);

myservo.write(122); // sets the servo position according to the scaled value
delay(20); // waits for the servo to get there
myservo.write(0);
delay(1000);

myservo.write(122); // sets the servo position according to the scaled value
delay(30); // waits for the servo to get there
myservo.write(0);
delay(1000);

Serial.print(val);
Serial.println(" cm");
}

How slowly the motor can run depends on the motor, how much load it has to move as well as the ESC and the power supply voltage.

You didn't say what affect the code you posted has but speed controllers are designed to handle pulses that are spacd by 20ms or so. Not sure what it would make of the signal it gets from your sketch code.

If your are trying to get the output to turn more slowly, you may need to use a different motor (they vary greatly in how fast they turn for a given voltage) or try using a gearbox.

BTW, I posted some code in the other thread where asking about motor control. That code won't make your motor go any slower but it may be more intuitive to use. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226292633/9#9

i am basically sending little pulses to the motor with the values i am giving.
it is woking reliably and i have found the reliable parameters

I realise that I am basically treating the DC motor as a stepper motor.
Has anyone had much sucess wuth stepper motors. If so which ones
Ive seen a sketch about a floppy disk stepper motor, but i need something a bt beefier..

any ideas?

thanks