Towards autonomous drones under $200

Mukut Mukherjee
5 min readDec 13, 2018

--

From mythical flying horses to Wright brothers, there has always been a special place for flying objects, identified and unidentified alike, in the human heart and mind. Thanks to science and technology, our fascination with angels have been replaced with that of autonomous drones, machines that are capable of flying by themselves.

Building autonomous drone, or even understanding them could be extremely taunting. So let’s break this down.

The Drone

We would first need to build a standard radio controlled drone. Starting with the frame, the f450 frame by DJI seems to be the most reliable. The DJI frame on my drone survived a 300 feet free fall, so it is quite durable. We would then need motors and some electronic speed controllers. Since we will be using the f450 frame which has a payload of about 2 kilograms, we need to be using brushless motors that have a rating of at least 920kV with some 10-inch propellers. Any 30A ESCs would suffice for this project. A 30C lithium polymer battery above 2300mAh would give the drone 10+ minutes of flight time. The most important part of this standard drone build is the flight controller. We could choose flight controllers that are made for autonomous missions, but that would defeat the very purpose of this post. Instead, we would be using some basic inexpensive flight controllers like the KK2.0 board or the CC3D by OpenPilot. Next up, we need a 6-channel radio controller like this one from FlySky to complete our basic build. Even though we would only be using four channels out of the six, the extra two could help interface some other control, controlling a gimbal for example.

CC3D connection diagram. Source: OpenPilot Wiki

Once everything is connected and the flight controller is set-up, we are ready for our first flight!

Getting rid of the radio

The first step towards the automation of our drone would be replacing the radio with an onboard computer. Speaking of onboard computers for the drone, I hope, that a Lenovo Thinkpad would not be the first thing that pops to mind. We can make good use of the Raspberry Pi here. Even an Arduino would perform in this situation, though it is not a computer, but a micro-controller. I have tried and tested both of them and the Pi, because of its greater computational power, would be best suited in this quest to make the drone autonomous. But, how does replacing the radio with the Pi help us achieve our goal? Well, with the Pi we can connect a wide range of external sensors and run different mapping, localization, and or image processing algorithms, do all the fun stuff basically. But first up, we need to mimic the radio transmitter signals that served as inputs for our flight controller.

In order to interface the Raspberry Pi with our flight controller, we need to use the PWM function of the gpIO pins on the Pi. Use the code here as a reference. Once done with the code, open up the latest LibrePilot (previously known as OpenPilot) Ground Control Station and configure the inputs from the Pi to different channels that correspond to throttle, pitch, yaw, and roll. Follow the normal Radio controller calibration procedure with the Pi. Once done, we should be all set to use our Pi for sending commands to the Flight Controller that controls the movement of our drone. The setup at hand could be expanded by using a mobile device that sends specific commands to our drone. I made this android app that sends specific commands to the drone, to take off, land, arm, disarm, etc. This enables the user to fly the drone in a more controlled and guided manner, increasing safety and stability. Documentation can be found along with the mobile application.

At this point, our drone can be controlled by a mobile application through Bluetooth and the onboard Raspberry Pi can now be used for all the “fun stuff”.

The fun stuff

In our model, the flight controller acts as a mere motor control unit that flies and balances the quadcopter. This means that the Raspberry Pi could be used as the brain of our drone, while the flight controller handles all the electronics. Using the Raspberry Pi, we can add a myriad of external sensors that aid our drone’s motion. A cheap ultrasonic sensor can be placed at the bottom of our drone to maintain a constant height at all times. With four more ultrasonic sensors at the front, back, and sides, our drone could avoid any obstacles in its way and even go over obstacles that are under its body, stairs for example.

Obstacle avoidance with Lidar

Like the one used in this video, a laser range finder could also be used instead of the ultrasonic sensors. The laser rangefinders might be costlier but are more accurate at the same time.

Advancing a step further from here, we could make good use of a webcam that is lying in our basements. Real-time image processing can be easily implemented on the Pi using OpenCV. OpenCV is a powerful tool that can be used for image recognition, object tracking, etcetera. Hence our model can also be used for advanced applications, rescue, or search missions for example, where a specific target needs to be followed or found. This could be achieved using OpenCV.

The Raspberry Pi can also run ROS which is an environment specially made for robotics applications. ROS has many important libraries that mainly target and improve autonomous navigation. Using Simultaneous Localization And Mapping, or SLAM, the drone could be made to navigate an unknown environment. This would require advanced LIDARs, which in principle are high-speed 360-degree laser scanners. Once equipped with the LIDARs, the drone could be used in any environment. Using SLAM algorithms, the Raspberry Pi would create a 2-D map of its environment and then navigate through it. This has huge applications in autonomous indoor flying where GPS data is not as precise.

2-D map generated using rpiLidar and SLAM

Excluding the LIDAR, everything else costs well under $200, which is about the price of a PlayStation. This model provides a great learning experience with the possibility of implementing advanced applications in contrast to the costlier ready-to-fly drones.

With the Raspberry Pi in place of the radio, applications targeting automation become easier with more stabilized control and safer flights.

And, that is it! Towards autonomous drones under $200!

--

--

Mukut Mukherjee

Artificial Intelligence Intern at Parabole.ai — looking to use Data Science to create a more sustainable future.