Using Arduino as an autopilot

crtleroy

New member
Hi every one,

I’m working on an octocopter that I would like to be auto-piloted. To do that, I’m considering to use my Arduino Mega 2560 to generate PWM signals to «*mimic*» a receiver.
I’m using a SP Racing F3 and cleanflight.

So more precisely, instead of using a RC command, I want the embedded arduino to send directly the PWM command to my SP-F3 input channels.

Then the first thing I need to know is the exact nature of the PWM signal that I found here : http://diydrones.com/forum/topics/pwm-output-waveforms-from-spektrum-receiver
So apparently the PWM range go from 1ms to 2ms above a general 20ms period signal. I am pretty much OK with that, knowing that cleanflight receiver range go from 1000 to 2000 (so 1000μs to 2000μs I guess).

So I try to use this very simple Arduino code to generate a PWM signal that is supposed to command a channel:

void setup()
{
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(13, HIGH);
delayMicroseconds(1300);
digitalWrite(13, LOW);
delayMicroseconds(20000 - 1300);
}

and I connect Arduino’s GND to SP F3’s ground, and pin 13 to any PWM channel: It absolutely doesn’t work ! On cleanflight I look to different channels and absolutely nothing changes.

So have anyone ever done that ? I’m wondering what is wrong in all of that. I know that there are better ways to generate PWM but I’m just using the simple way first. I’d love to have an oscilloscope to help me but I dont :(

Has anyone an idea ? Any suggestion is welcome :)

And to finish, excuse my grammar, I’m not a native speaker.

++