Arduino Quadcopter 2: Intro

Quadcopter splash page

I’m really happy to finally show this new prototype. In the last few months, I’ve completely rebuilt my autonomous, Arduino-based quadcopter and made significant software and hardware improvements over the previous version. This new version merges the programmatic ease of Arduino with the stability and robustness of the DJI Naza flight controller. People who follow my build instructions or otherwise use my design will be able to start writing their own flight programs inside my simple Arduino script that provides access to the same controls a human pilot would manipulate: aileron, elevator, rudder, and throttle. The beauty of this design is that, although DJI Naza is a closed-source product, I’ve made an open-source Arduino interface that makes it easy to achieve autonomy. I really want to stress the word easy. To make the craft move forward, all you have to do is type the following in your program:


That’s it. My implementation just uses functions in the well documented Arduino servo library to control motion. Here’s a demonstration of the possibilities:

Here are Receiver8 and Transmitter8, the work-in-progress versions of the code files used to control the quadcopter. The essence of this system is that an Arduino Uno in the handheld controller accepts joystick inputs and then sends control signals via RF communications to the Arduino Mega on board the quadcopter. The Arduino Mega then sends those controls to the DJI Naza by way of Arduino Servo functions. An arming/disarming system is implemented in the handheld controller. Stay tuned for future posts with updated code, circuit diagrams, and parts lists. Below is a video I sent to my collaborators during the re-construction of the quadcopter. It demonstrates the ability to control the DJI Naza using a combination of an Arduino Uno handheld controller and on-board Arduino Mega:

21 thoughts on “Arduino Quadcopter 2: Intro

  1. Really nice job! I was trying to do the same using my old KK board and an Anduino micro board that I have. Hope we can exchange some ideias. I am planning to put some additional sensors and transmit real time data to the ground and in the future to build a full autonomous quadcopter using GPS and be able to send quad to specific coordinates and then back home. I know that there are some boards that already do that, but come one, what is the fun if you are not programming that. 🙂

  2. Thanks! The KK board is cheap, but proved to be very problematic for me, so I switched to DJI Naza-M Lite. Naza is much more expensive ($170), but provides really stable control and is easier to work with. Sending GPS location data to Arduino is something that I’m actively trying to achieve as well.

  3. Alex;

    This stuff is great. I am working with my F450 with Naza M V2 and Spektrum Radio and Arduino UNO . Due to my own carelessness I will have limited mobility in my neck. Problem : I used to fly high 400 -500′ so I had no problems with Autonomous flight. Now I fly low 25′ – 50′ Where there are trees and other obstacles. Well to fly like this I want to set a flight path but with unknown obstacles. In other words not a straight path but to be able to zig and zag around obstacles to my destination. I can do this manually as most of us can but I want to program a system that would fly from point A-B-C-A but not necessarily in a straight line. The system would have to keep in mind (?) the destination while adjusting for random obstacles. Your code and examples are a great starting place, oh btw right now I am using Ultrasonic sensors, but am willing to change to anything else if preferable.

    Any advice or tutoring would be greatly appreciated. I am retired individual and this is just a hobby so there is no objective of any sort toward commercialization of this tech.

    1. Hi Ron,

      Thanks for your interest in my work. Your question is not an easy one to answer. The technology to plan a flight path and command a drone to follow it at high altitude (~400ft) exists commercially: see I also believe that with some effort, you would be able to write an Arduino program that could achieve this behavior using the hardware setup I describe on my website.

      However, the technology to reliably do autonomous navigation outdoors at a low altitude (~25 ft) is still not really here yet in my opinion. Companies like Google and Amazon are actively working to conquer this problem. One big issue is that non-planar obstacles such as trees and power lines are difficult to perceive using cheap sensors such as the ultrasonics that we hobbyists often use. The only real alternative that’s light enough to be carried by a drone is a camera. However, you need a powerful processor (e.g. Intel Core i3) and fairly complex computer vision algorithms (e.g. to make sense of what the camera sees. This is the direction that Google and others are following.

      So what can you do with just an Arduino and some ultrasonics? Here’s a high level recipe off of the top of my head:
      1. Mount a lot of ultrasonic sensors (~12 ) on a drone, to get a very course indication of the presence of obstacles in the drone’s vicinity.
      2. In the drone’s memory, represent the area you want to explore as a grid with 5m x 5m cells.
      3. If you have any prior information, mark each cell in the grid as “open” or “obstacle”.
      4. Figure out your current GPS location and the GPS location of the square you want to reach.
      5. Use an algorithm like Dijkstra’s algorithm ( to compute a path to the goal.
      6. Slowly execute the path with the drone using your GPS position to measure your progress and estimate your position in the grid.
      7. If the drone detects an obstacle in its path in a square that you originally thought was open, mark that square as “obstacle,” and recompute Dijkstra’s algorithm given this new information about the grid.
      8. Repeat 5,6,7 until you reach the goal.

      Hope that helps; this would be a pretty big project!

      1. Alex

        Yep it figures, I have never been known to take the easy route. So here is my game plan :

        1 get your code and hardware configuration working with the hardware I have
        2 test and more testing
        3 I am now considering a more expensive approach by using A laser scanner instead
        4 I am 68 yrs old now and hope to have this working at the hobbiest level before I am 90 LOL 😱

        I agree with your notes and will be actively working through them. You confirmed my suspicion about low level flight.
        The ability to execute changes in flight while checking the current flight plan and making subtle adjustments based on environmental factors such as trees, bears, etc on a random basic will require a lot of processing power. The new 32 bit Arduino or other boards may be the answer.

        Thanks for your response


  4. Can you explain why you used an arduno due board ?

    Do you think that the mega 2560 speed is sufficient… ?

    Because for me the speed is sufficient and I don’t understand why use a more expensive board if the power is sufficient…

    Thanks in advance


      1. Thanks for your reply,

        Can you give the fix time of the naza with the naza library… ?

        In order to know if the speed refresh time is relevant to have the real time speed and consequently regulate speed of the drone…

      2. Hi, how you get the gps latitude and longitude after kalman filter processing… ?

        I see this line :

        Serial.print(i);Serial.print(“,”);Serial.print(Xstate[0][0]);Serial.print(“,”);Serial.print(Xstate[1][0]);Serial.print(“,”);Serial.print(Xstate[2][0]);Serial.print(“,”);Serial.print(Xstate[3][0]);Serial.print(“,”);Serial.print(ZkTranspose[0][0]);Serial.print(“,”);Serial.print(ZkTranspose[1][0]);Serial.print(“,”);Serial.print((int32_t) GPS_data[0][0]);Serial.print(“,”);Serial.print((int32_t) GPS_data[0][1]);Serial.print(“,”);Serial.println((int32_t) GPS_data[0][2]);

        But if this line print the post kalman filter result, where are latitude, longitude, altitude, datetime… ?

        Thanks in advance

  5. Hello,
    I think you did a really amazing job getting the arduino to communicate with the naza.
    Is it possible to get the arduino code you used to communicate with the naza with please?
    The link that’s on this site is currently disabled.

    Thank you

  6. Hi, would it be possible to reestablish the connection to the example code for controlling the Naza with the Arduino under “Receiver8” and “Transmitter8”? The Dropbox connections seem to have been terminated. I would really appreciate this, as it would greatly help to work off an example. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s