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

Autonomous Indoor Navigation with AR.Drone

AR Drone

In the above video, a modified Parrot AR.Drone is reprogrammed to perform autonomous behaviors. The drone pilots itself into a simulated hallway and stops when it detects the end of the hallway. The goal of the project is to achieve autonomous hallway navigation using low-cost IR sensors. To achieve autonomous flight, the AR.Drone was retrofitted with five IR rangefinders. The readings from the rangefinders were A-D converted by an Arduino Micro and sent via serial communications to the BusyBox Linux OS running on the AR.Drone’s ARM A8 processor. I integrated the two hardware systems and programmed the drone to navigate a hallway based on the sensor readings. To achieve this, I implemented a PD controller whose inputs were sensor readings and whose outputs were desired [roll, pitch’ yaw] settings for the drone. Unlike my other projects, this is academic work. As a result, I can’t share source code like I usually do, but I hope you enjoy the results nonetheless.