Talking to an R/C ESC

11 Dec 2009 . Edited: 11 Dec 2009

I have a HSP/Novatech 75A (#03307) brushless ESC, and I'm trying to control it with my mbed.

After a few hours of playing & researching, I've come up with the following code:

#include "mbed.h"

PwmOut motor(p21);

int main() {

    motor.period_ms (20); //50 Hz
    motor.pulsewidth_ms (1.5); //forwards?
    
    motor = 0;
    
    wait(2);
    
    for(float i = 0.0665; i < .07; i+=0.0001){
        motor = i;
        wait(.1);
    }
      
    wait(5);
    
    motor = 0;
    
}

I use the power from the ESC to the mbed, so when I turn it on, it turns the mbed on. It sets the motor output to 0 (to set neutral position?), waits 2 seconds and during this the ESC beeps, saying it's set & ready.

I increase the motor output from 0.665 (a figure from experiment) to 0.07 with 0.0001 steps, and somewhere in this the ESC beeps again (saying it's ready to go forwards?) and it slowly speeds up (clunky at first, to smooth at 0.07). (0.07 isn't the max speed, it's just a speed I thought was appropriate for inside & testing.)

It goes this speed for 5 seconds, then stops.

I've tried setting motor = 0.07 directly, but it doesn't move. The only way I've found that works is to slowly increment as the example above.

I have no clue how to go backwards (set the neutral position to 0.5 at start?). Why does it only work by incrementing?

 

Does anyone have any ideas? I couldn't find a datasheet or much useful information (any general info?). I still have the reciever handy, so I could somehow read how that sent signals to the ESC?

If I get it working to a decent degree I'll post the code in a cookbook (if allowed?)

11 Dec 2009

If the thing expects the same signal as a regular R/C servo, you might try talking to it with Servo instead of a bare PWMOut. I'm not at all sure that that will solve your problem, but it might make it a bit simpler.

 

R.

11 Dec 2009 . Edited: 11 Dec 2009

I have a feeling it might use PCM or PPM. link

I'll have a try with it as a servo - good idea :)

Edit: You're a bloody genius. I could kiss you. Why didn't I think of that?

11 Dec 2009 . Edited: 11 Dec 2009

Oops, it's connected to pin 22 in my main program (not my test one). Silly me :)

11 Dec 2009

Because I'm lazier than you, and so more inclined to look for cheap shortcuts ? :-)

 

What's the ESC going into ? It looks slightly terrifying...

11 Dec 2009

Autonomous 1:10 car

It's not that scary at the moment :)

11 Dec 2009

Ah, I see!

 

One of my long-term plans for the mbed and my camera code is to make an R/C tank kit autonomous, so I may be doing some very similar work in a month or two.