TESTED - Arduino Automated Landing Gear

by Arno1978 | August 29, 2013 | (15) Posted in Projects

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    
      }       
    }
  }
}

COMMENTS

Billbo911 on August 29, 2013
I love seeing Arduinos being used in such a creative fashion.

A couple things to note when using Ultrasonics to determine distance:

Sound reflection needs to come from a fairly flat and perpendicular surface.

The landing area will need to be fairly smooth and firm. In other words, grass landings may not produce the response you are looking for.

BTW, a smaller Arduino, such as the Mini or Nano will be smaller and lighter, but just as functional.
Log In to reply
Arno1978 on August 29, 2013
Thanks for the advise, the field I fly at actually has a very smooth landing area, so I am holding thumbs that it will work.

As for using a Nano or Mini, I did buy one from a supplier I will not mention, but is was DOA , so I have no choice but to use the UNO for now. Will place another order from a more reliable supplier to get a Nano which should be able to handle this with ease.

Thanks for your advise once again.
Log In to reply
CStence on August 29, 2013
Very cool! I hope you'll share a video of it in action once it's installed in the plane. :)
Log In to reply
Arno1978 on August 30, 2013
It is actually for a 500 Scale Airwolf Helicopter, will try and get it installed this weekend, will upload here as soon as I am done.
Log In to reply
andy_spoo on August 31, 2013
I'd be tempted to put the sensors closer to the middle. Just incase you land more arse first, without modifying the board. If you remove one of the sensors and connect it via a fly-lead, to distant it more from the other, can you activate the servo at a higher height?
Log In to reply
Arno1978 on August 31, 2013
Good idea, I will do the test flight later today and then adjust the spacing as suggested. As for the servo, if you look at the code I only move from 0 degrees to 90 degrees, I think I will increase the 90 degrees to may be 105 degrees to ensure the gear is fully retracted.
Log In to reply
liveyourdreamsRC on August 31, 2013
Wow, thats really cool!
Log In to reply
sailorJohn on August 30, 2013
This guy makes me feel like I'm right out of the stone age. The technology is there ,it takes someone with imagination to use it.
Log In to reply
Arno1978 on August 31, 2013
Don't feel bad, I have only started using Arduino for a month now so I am still learning, the only advantage I have is that I am a full time software developer which makes the learning a bit easier, but I am sure once you get into it, it becomes easier as there are millions of examples our there, give it a try :)
Log In to reply
JustinTime on August 30, 2013
Looks to me like it should retrack and extend at a higher height. I think out in the field you will end up landing on your belly before the gears are out.
Log In to reply
Arno1978 on August 31, 2013
It is currently set to trigger the servo at 50cm, so this afternoon I will be doing a flitetest :) and determine if the 50cm is sufficient or not, but thanks for the feedback :)
Log In to reply
TacomaD on August 31, 2013
There's also the teensy that is or can be made Arduino compatible. :) If you really want to save mass and you don't need analogue in, you could try the digispark http://digistump.com/category/1

Note: I have not used any of these products.

@Sailor John - Don't feel too bad. The hobby electronics market kind of exploded in the last few years making this kind of thing easier and more accessible... kind of like the electric end of the R/C flying hobby. Up until recently, I thought it was too expensive to get into, but now I know it's not.
Log In to reply
Arno1978 on August 31, 2013
Hi TacomaD,

Thanks for the info , I only started play with Arduino a month ago, so any new info is welcome, I will definitely look into the Teensy platform as well as the digispark one too.
Log In to reply
Carmatious on August 29, 2013
Is this Java? Wait Arduino is programmable? That's awesome. I have quite a few things I would like to try out soon.
Log In to reply
Arno1978 on August 30, 2013
The Arduino language is based on C/C++ , so the possibilities are endless :)
Log In to reply
the nerdling on August 30, 2013
try out the arduino it is awesome i say: you don't think you will use it but once you have one you need more
Log In to reply
andy_spoo on August 31, 2013
As well as C++ , it you plan to use 'Eclipse' (my favourite programming environment) it's also Java. Example link here: http://playground.arduino.cc/Interfacing/Java
Log In to reply
tramsgar on September 2, 2013
Nice to see this implemented, have had this idea myself for quite a while (for multirotors though). Thanks!
Log In to reply
Crashpilot1000 on September 2, 2013
What a great project!!
You can also use the multiwii code for that, than it would be an interrupt driven sonar readout and PWM output. Speaking of that, you could also take the cheapest mwii board to run your project like this: http://www.hobbyking.com/hobbyking/store/__25094__multiwii_mini_flight_controller_w_ftdi_interface.html.
It also comes with a decent but outdated sensorset (Gyro/Acc) wich you don't need but you could use it to control a camera gimbal. It would also save some weight and space in your nice heli.
Anyway, keep up the good work
Cheers
Kraut Rob
Log In to reply
Billbo911 on August 29, 2013
I purchased a Nano a year or two back, and it too came in DOA. I was able to revive it by using one of my other Arduinos as an ISP and burning a new bootloader on it.

Log In to reply
dazza on August 30, 2013
great idea think I mait have ago for retracks on my Hexa
Log In to reply
rodgerroth on March 3, 2014
hello im very interested in your project for my quad copter and i dont know very much about programming arduino is that the complete code i would need , and were in code explains height activation i could really use some help to get started thank you
Log In to reply
skelator on January 12, 2015
would be nice if someone also need to adapt this code for controlling the servo using switch instead of Sonar
Log In to reply
paulham on February 17, 2015
Yes it would be great if we can have a pwm input from the radio RX so that it can be over-ridden.

Any possibility?
Log In to reply
linus26 on September 7, 2015
Beautifull job!
Log In to reply
churchpark on September 29, 2016
What if I add 2 BEC tagged from quadcopter battery.One for Arduino and one for landing gear, both are at 5V.
Log In to reply
Arno1978 on September 29, 2016
Power for Arduino comes form a BEC, power for servo comes from the RX, except the signal cable that goes into the Arduino
Log In to reply
churchpark on October 4, 2016
Or Nuno even!
Log In to reply
churchpark on October 15, 2016
Does not work with Nano. Plus not activating Tarot small retracts.
Log In to reply
churchpark on September 19, 2016
I like to acquire a sonar system like the one mention. I have no extra channel on my Yuneec Q500
ST10+. I already have the landing gear but need a system to a simple task as this. Can someone build me one with a charging fee for parts and labor? I see not mentioning of specific parts needed here. Please, please help!
Log In to reply
churchpark on September 29, 2016
Are you using power from the board to power your landing gear? Hello?
Log In to reply
churchpark on October 4, 2016
Just need wiring schematic for NANO,thats all?
Log In to reply
churchpark on September 27, 2016
Arduino NANO. Can you show me the wiring to use and how to load the script on the board for use?
Log In to reply

You need to log-in to comment on articles.


TESTED - Arduino Automated Landing Gear