Pyboard based Quadrotor

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
Post Reply
Insekto!
Posts: 2
Joined: Wed Feb 25, 2015 1:04 pm

Pyboard based Quadrotor

Post by Insekto! » Thu Jul 30, 2015 3:56 pm

Hello to everyone!
I'm new to pyboard and almost telecommunications engineer, and I say almost because I chose to build a quadcopter using the pyboard.
I'm using the module mpu9150.py and a MPU 9150 of course. I got to control the motors by using the timers, but I'm stuck now on calculating the pitch and roll. I got to get the angle between 90 and -90 for both pitch and roll from the accelerometer but I wasn't so succesful on getting them from the gyro. Since it gives a rate per axis, I've been trying to integrate this by performing an addition with the previous calculated angle and the current rate times dt (something like actual time - previous time + 1/sample_rate) among other things, and I can't seem to understand what I'm doing wrong, and it seems it happens to lot of people since in my research through hundreds of forums, I found out this is many people's problem. So this is a cry for help since I've been stuck at this point for a long time and I still need to calculate yaw and altitude. The project consists on implementing a code that allows the quadrotor to fly steady and stationary without falling down :roll:
I'll leave you a github repository in case you fancy to take a look at my code.
https://github.com/insekto87/Pyboard-Quadcopter

Any help would be really appreciated!! Thank you in advance!!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Pyboard based Quadrotor

Post by pythoncoder » Fri Jul 31, 2015 9:49 am

A standard way of doing this is the Madgwick algorithm which uses quaternions to compute heading, pitch and roll. I've posted a MicroPython implementation of this here https://github.com/micropython-IMU/micr ... fusion.git. I've tested this on the bench but as far as I know nobody has flown it yet ;)
Peter Hinch
Index to my micropython libraries.

Insekto!
Posts: 2
Joined: Wed Feb 25, 2015 1:04 pm

Re: Pyboard based Quadrotor

Post by Insekto! » Wed Aug 12, 2015 5:15 pm

Thank you so much pythoncoder!! I'll look into it as soon as possible and I'll post here from time to time my progress. Let's hope it ends up flying :D
Thanks again!!

Post Reply