Watch the last (4th) video for the actual flight at the filed, must say it went well.

I had to make a plan to find a way to deploy my landing gear of my 500 scale Airwolf with only a 6 channel DX6i radio.
I recently started to play with Arduino and I also got my hands on a sonar sensor. This would allow me to determine the Airwolf's altitude and then automatically deploy and retract the landing gear based on altitude.
Below is a short video demonstrating the prototype I have built.
Here is a test inside the Airwolf
Here is the final Product, installed in the Airwolf
And here is the actual test flight at the field today, must increase the hight at which the landing gear responds, but for the first flight it went very well. Currently it's at 40cm, might increase to 60m



Here is also a copy of the code that runs on the Arduino
#define trigPin 12
#define echoPin 13
#include <Servo.h>
Servo myservo;
int ServoPos = 0;
boolean IsGearDown = false;
void setup() {
myservo.attach(11);
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
int duration, distance, pitch;
digitalWrite(trigPin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if(distance != 0)
{
pitch = map(distance, 0, 150, 3000, 1000);
Serial.print(distance);
Serial.println(" cm");
tone(8,pitch);
delay(10);
noTone(8);
if(distance > 50) // In the Air
{
if(IsGearDown)
{
ServoPos = 0;
do{
myservo.write(ServoPos);
delay(10);
ServoPos ++;
}while(ServoPos < 91);
IsGearDown = false;//Gear is Up - Flying
}
}
else
{
if(!IsGearDown)
{
ServoPos = 90;
do{
myservo.write(ServoPos);
delay(10);
ServoPos --;
}while(ServoPos > 1);
IsGearDown = true;//Gear is Out - Landing
}
}
}
}
0 comments