Close
0%
0%

Project hΕli

A quadcopter flight controller based on the Arduino nano

Similar projects worth following
I’m a second year student at the University of Manchester, studying Mechatronics Engineering. I’m also part of the Robotics Society at the uni and with the guidance of the PhD students running the society I decided to do a side-project throughout the year to help me put into practice what I’ve been learning as well as to learn new skills, so I decided to build a quadcopter from scratch.
I’m writing this blog in order to document what I’ve been doing and hopefully help anyone who wants to do a similar project. However I won’t be going into too much detail about how it all works but you can comment if you need any help . I hope you enjoy it!

UPDATE: I've put this project on hold for a while. I managed to tune on axis but I found it too difficult to tune the other. This might be due to a hardware issue. I don't have any time to finish it now. I'll probably swap the nano for a teensy when I have time to finish it.

This project is part of a larger project I’m working on with one of my classmates. He will be working on making a raspberry pi detect a red/blue ball and get the quadcopter to hover over it and I’m going to be working on making the quadcopter fly, check it out here!. We will then combine the two together to make an autonomous quadcopter which can scan an area and find the ball.

We will also be entering this project at a competition held at the University by the Robotics Soc.

  • 1 × potentiometer used as to control the throttle
  • 1 × joystick
  • 1 × MPU6050 gyro+accelerometer
  • 4 × ESC
  • 4 × 1100Kv motors

View all 10 components

  • Updates

    francesco.fum04/01/2016 at 22:30 0 comments

    Update 1: I'll be adding all the code, eagle and solidworks files once I'm done with project

    Update 2: tuning videos/pics will be up soon ✓✓

    Preview (terrible quality):

  • Project Logs

    francesco.fum04/01/2016 at 22:28 0 comments

    Log 1: Hardware info

    Instead of buying all the mechanical parts to make a quadcopter I was given a frame with the motors, props etc. (however if this works ill use much nicer hardware and make a new one) but no flight controller or remote. For the flight controller I used an MPU6050 accelerometer + gyro and and nRF24L01+ radio all hooked up to an Arduino Nano which would do all the magic. For the transmitter another nRF24L01+ radio a joystick and for the throttle a pot again all centred around the Arduino Nano.

    Log 2: How a quadcopter works

    The basics of a quadcopter are really easy. A simple way to think about it is this: A quadcopter works by getting two inputs, one from the user and one from itself. The user tells the quadcopter where it wants it to be (move forward/backwards etc) the quadcopter then figures out where it is and changes the speed of the motors in order to achieve this. The following logs explain this in a bit more depth.

    Log 3: Transceiver

    The two radios are very simple to use with the nRF library (link the library) however it took me about 3 weeks to get them to work because I fried all four of them and then couldn’t figure out why they weren’t working. The Arduino reads the analog values from the joystick maps them to a range of -20˚ à 20˚ and sends them to the quadcopter, same as the pot (but with a different range). At first I got everything working on breadboard and then I made a PCB for them.

    The receiver simply reads an array sent by the transmitter where each element of the array represents a different parameter eg.data[1] = throttle, data[2] = roll and so on.

    Artistic shot of the transmitter prototype

    And heres a video of us trying making sure everything works (nothing broke ✓)


    Log 4: MPU6050

    The MPU6050 is a simple 3axis IMU and it works really well. Its got both an accelerometer and a gyroscope and 3 ADC so it can capture all three axes at the same time. There is also a lot of information on how to use them, as well as many well documented libraries, so it seemed like a good choice. In order to get an accurate reading form the IMU both accel + gyro data need to be used. There are two ways of combining them:

    • Kalman filter
    • Complementary filter

    I decided to go with the complementary filter because it’s much easier to implement and it works surprisingly well! I also advise that you calibrate the IMU from time to time and add offsets.

    The complementary filter I used is the following:

    where data_g = gyro is the raw gyro data and data_a is the angle calculated only from the accelerometer using the equations below

    However once everything works I’ll swap it for a Kalman filter (mainly so I can learn how to implement it for other projects).

    Then to get the roll and pitch I used these equations:

    ** this equation doesn’t take gimbal lock into account but the quadcopter will never go more than 20 ˚ so it doesn’t matter.

    [2] and [3] are then substituted into [1] and we get a very accurate angle!

    Log 5: PCB

    Just to make everything look neater, I made a small PCB for the flight controller. I’ve used headers for everything so I can easily change anything that breaks, or needs updating. I made a mistake when judging how much space the IMU would need and completely forgot it has 8 pins since I’m only using 4, but ill fix all that and add a switch when I print version2.

    Flight controller PCB

    I also made a PCB for the controller, and it turned out to be terrible because its tiny. I'll definitely remake this into a proper controller which I can actually hold with two hands but I haven't done it yet since I don't really need it for now.

    Log 6: Control system

    PID, which stands for Proportional Integral Derivative is the standard control system used to control quadcopters. Basically, PID takes two inputs one from the user aka the setpoint – where I want the quad to be (from the radio – in degrees) and and compares it with the angle its actually at (from the IMU, again in degrees) it then calculates an error and outputs a value which it thinks will bring...

    Read more »

View all 2 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates