In recent years, more than a million UAVs (Unmanned Aerial Vehicles) have been sold, and new potential uses are dreamed up seemingly by the day. Traditional quad copters use an expensive dedicated flight controller, such as Ardu-Pilot, that comes with a bulky RC remote, making it complicated for enthusiastic beginners to grasp the technique of operating these machines. Moreover, in third world countries like Bangladesh, high cost of these UAVs play a vital role in satisfying the enthusiasm of increasing quad copter hobbyists. Therefore, the main objective of our project is to implement a cheaper design of a quad copter using a raspberry Pi as the sole flight controller and developing a free android app to introduce a simpler, user-friendly interface to control the quad copter.
The project was initiated with a brave assumption that the Raspberry Pi Model B Rev.2, which is a small computer coming at a price of $35, possessing far greater processing power than the dedicated flight controllers, will be able to handle the real-time computation required to serve as a feasible flight controller for the quad copter. In addition, it will also serve as the recipient of control signals input by the user from the android app over Wi-Fi.
To adhere to our own setup specifications and minimize cost, we built a quad copter from scratch. Only one sensor, 6 Degree of Freedom MPU6050 by Invensense, which comes with 3-axis gyroscope and 3-axis accelerometer, has been used to maintain the orientation of the quad copter. The sensor has been interfaced with the raspberry PI’s GPIO pins over I2C communication protocol to receive readings at a frequency of 450Hz. MPU6050 comes with a built-in DMP (Digital Motion Processing) library, which has been used to convert the raw data into sensible gyro and accelerometer readings. Richard Ghrist’s servoblaster library has been used to map the Raspberry PI’s GPIO pins to four electronic speed controllers (ESCs), which in turn generates PWM signals that are required to drive the brushless motors.
The trickiest part of the project was to implement a proportional–integral–derivative controller (PID controller), which is a control loop feedback mechanism (controller) commonly used in industrial control systems. Using simple C programming, we have implemented a cascaded PID loop, where Stabilize PID sits on top of Rate PID. In Rate mode, the user has to have control of the quad at all times to keep it stable. More experienced flyers usually prefer Rate Mode over Stabilize Mode. In Stabilize Mode, the user inputs the angle that quad should hold. If the user lets go of the control, the quad auto-levels itself.
To sum up, we now have a setup that responds in real-time without the implementation of any real-time kernel inside the raspberry pi. Turning on the hotspot of the smartphone allows the user to automatically connect to the raspberry pi through a static IP. The raspberry Pi is password protected to ensure only its owner can gain access to it. We have a functional android app that allows the user to do PID tuning in both Rate mode and Stabilize mode. In addition, the app has a very simple user interface that allows the user to increase throttle, roll and pitch. It has been difficult to implement yaw as the yaw axis of the gyro in the sensor drifts from time to time. The whole setup cost us about 30,000tk which is significantly cheaper. Due to lack of knowledge in PID tuning, it has been difficult for us to make the quad copter stable in air. However, as of the goal set in our project we have been successful in coming up with a cheaper flight controller that accepts control signals from an android app. Future plan includes further finer PID tuning and interfacing a webcam with raspberry pi for live streaming video.