Arduino Quadcopter 2: GPS Integration

The current state of my Arduino Quadcopter 2 prototype is shown above. The DJI Naza can be bought with a GPS attachment that allows the flight controller to achieve very good position control outdoors. In the resulting behavior shown above, the quadcopter hovers in place unless the user sends non-zero flight commands that are filtered and then relayed by the Arduino. The hovering behavior above is a good example of high quality position control. However, in order to achieve autonomous behaviors outdoors via Arduino, it is crucial for the Arduino to have access to the GPS data that the Naza is using to hover. One very useful application is waypoint following. My plan to achieve waypoint following is to send a GPS location to the Arduino and to program the Arduino to send the flight commands appropriate for moving the quadcopter from its current GPS location to the target GPS location. This forum post explores the possibility of tapping into the serial communications between the Naza GPS device and the Naza flight controller itself.  Because Arduino can interpret serial communications, simply plugging the GPS receiver cord into a breadboard allows one to add an additional wire that leads from the Naza GPS device’s serial TX port to one of the the Arduino Mega’s RX ports. The Naza flight controller can then be allowed to use the GPS data as usual by adding wires leading from the breadboard connections to the Naza flight controller (i.e. the Naza flight controller “feels” as though the Naza GPS device is plugged in normally). The figure below shows how this is implemented with the on-board control circuitry:

Quadcopter Electronics

With this arrangement, the Naza flight controller can use GPS to hold position given non-zero flight commands, and the Arduino can use GPS to send non-zero flight commands that direct the quadcopter to follow a GPS waypoint. The forum user pawlesky wrote an excellent tutorial and C++ library that makes it relatively easy for Arduino to interface with the Naza GPS device. My integration of pawlesky’s library into the Arduino code in the Receiver10 file is here; version 10 is still very experimental. Below is an image of the GPS data reported by the Arduino Mega that is running the new receiver code. Note how the heading estimate from the magnetometer updates much more frequently than the latitude and longitude estimates. With access to GPS data, the Arduino Quadcopter can be programmed to fully autonomously follow waypoints, which is a huge step forward.

Data Stream

11 thoughts on “Arduino Quadcopter 2: GPS Integration

  1. Hi mind sharing the circuit diagram for the controller part, we’re currently making a quadcopter for undergrad project and our main basis is your prototype thanks in advance!

      1. Alex great project, please can you help me up with the receiver code for NRf24…how to receive PWM ????.im using nrf for my transmitter with arduino

  2. does the controller should be calibrated through dji naza software support ( issue motors does not start even though it is armed)

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