Posts

Showing posts from 2016

Custom Flight Controller Part 2.3: Getting the Orientation --- The Matlab Simulation

Image
This post records down the steps that I did to achieve the final matlab simulation as well as discusses limitations of this method and suggests future improvements.

From previous steps I was able to obtain the data from IMU sensors and implemented a quaternion Kalman Filter for orientation calculation in matlab. The final step is therefore to use matlab to perform orientation visualization so as to prove that this the proposed algorithm can successfully keep track of the device's orientation.
Matlab provides existing functions for serial communication. The official tutorial could be found here. Again,my script could be found in my Github. In this post, I will try to explain the essential parts of my code.
This screenshot below is from serial_func.m and it demonstrates how to initialize a serial communication in matlab and configure its relevant parameters. Note that I have added in a callback function for serial communication. The last two lines of the code shown above essentiall…

Custom Flight Controller Part 2.2: Getting the Orientation --- The Quaternion Kalman Filter

Image
Accelerometer measures the acceleration experienced, gyroscope measures the angular velocity and magnetometer measures the magnetic field. In order to calculate the orientation from these IMU measurements, sensor fusion needs to be performed. Although there are numerous algorithm to achieve sensor fusion, the underlying principle should be similar. Assuming the initial orientation is known, integrating the gyroscope measurement will indicate how much the device has rotated. Combining both information allows me to predict the current orientation. Furthermore, assuming that there is no external linear acceleration, the only acceleration the accelerometer should measure is gravity which is always pointing downward. With different orientation of the device gravity measured will give different xyz axis measurement while the magnitude is remained constant. Therefore, accelerometer measurement could be used to update the orientation predicted to give a better estimate. The same theory can b…

Custom Flight Controller Part 2.1: Getting the Orientation --- Get Data from MPU9250 Sensor Module

Image
Orientation is calculated from IMU readings. In this project, I aim to use a quaternion Kalman Filter to perform sensor fusion. To test the performance of the Kalman Filter, I intend to run a simulation on Matlab that receives sensor data from Arduino via serial communication. I will write down the detailed steps below.

Part 2.1 Get Data from MPU9250 Sensor Module.

As innovation is not the primary interest of this project, I choose the popular MPU9250 from Invensense as my 9DOF IMU to get the orientation of the quadcopter. The supposed way is to buy the sensor, solder it onto a PCB with your chosen Microcontroller and progarm from there. Since at current stage, I am more interested to testing the software instead of building the hardware, an existing sensor module is chosen.  I bought this sensor module from SeeedStudio. The connector on the module breaks out MPU9250's I2C interface, allowing it to communicate with most Microcontroller directly. I use Genuino 101 in this case.  Th…

Custom Flight Controller Part 1: A Simple Revision on Quadcopter Flying Principle

Image
My approach to designing a custom flight controller is to split the task into two parts: the hardware and the software. Since software is easier to debug and change, I jumped into software first. This might not be the best decision as other people say it is better to design hardware first. I hope I would not face serious problems by choosing to design software first. 

For software, I further split it into two major tasks: getting the orientation and controlling the actuators(motors), the reason being that orientation/attitude of the quadcopter is the core in quadcopter's movement and therefore controller design. I feel that getting a good orientation is extremely crucial and therefore I decide to make it an independent task instead of a part of controller design. 
Everything starts with the basic quadcopter flying principle. 

Quadcopter has four propellers, one pair spinning clockwise and the other spinning counter-clockwise. Each propeller, when spinning, will exert a lift force as …

Project 1: Custom Flight Controller Part 0: Overview

Image

Prologue

I am a undergraduate student from Nanyang Technological University Singapore Electrical and Electronic Engineering year 4 with specialization in Intelligent System and Control. It was until year 3 that I finally my lifelong passion in robotics. However, much time had been spent learning other knowledge and skills such as Dota2. Though I started late, what is most crucial is that I shall never stop from now on.  This blog will serve as a log of my journey in learning robotics as a newbie. It will mainly consist of detailed description and explanation of the projects that I do. Hope this blog will live to see the day when I truly achieve something meaningful. Furthermore, I would be more than satisfied if one day someone could find this blog helpful to his projects or learning journey.  So, let's start!