PDA

View Full Version : Teensy 3.0 as flight controller



cTn
01-05-2013, 11:40 PM
Hi guys, i just wanted to share and show what i am doing with my teensy.
I wrote a flight controller from scratch, which is now fully "hooked" into teensy internal hw timers, i also wrote a rather simple complementary based kinematics that i am using for stabilization.

Video demonstration showing my kinematics in action (real time)

http://www.youtube.com/watch?v=vWmyfUhEwGw

I also have an rather older video of my quad flying using teensy 3.0 as brain (i improved the stabilization since then quite significantly)
http://www.youtube.com/watch?v=wKqWw4nmVKk

My full source code can be found on github https://github.com/cTn-dev/Phoenix-FlightController
And also if there is anyone working on similar project and could use some help, just leave a message in this thread. I will be more then happy to help you.

hpyle
01-06-2013, 01:43 AM
Very impressive!

doctek
01-13-2013, 02:03 AM
I get a 404 from github??

cTn
01-13-2013, 09:12 AM
I get a 404 from github??

sorry, i fixed the url

roens
01-17-2013, 04:18 AM
Well this seems exciting. I was just thinking of figuring out how to implement a flight controller with the teensy 3, having just received one. Have you any plans/interest in adding support for a tricopter platform? I'm building one, and have just purchased a sensor board with: 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and atmospheric pressure.

cTn
01-17-2013, 09:19 AM
Well this seems exciting. I was just thinking of figuring out how to implement a flight controller with the teensy 3, having just received one. Have you any plans/interest in adding support for a tricopter platform? I'm building one, and have just purchased a sensor board with: 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and atmospheric pressure.

Sure, this shouldn't be a problem, would this be a tricopter with or without the yaw servo on the back ?

roens
01-17-2013, 07:53 PM
Sure, this shouldn't be a problem, would this be a tricopter with or without the yaw servo on the back ?

Yes, it'll have a servo in the rear, controlling louvers to adjust the vector of airflow exiting that rotor. The design is much like this (have continued to make tweaks since this version):
http://www.flickr.com/photos/roens/8367667795/

I began, last week, on fabricating parts. Hopefully this weekend I'll get at least the fiberglass ducts & electronics box (at the center of the body) made.. and perhaps the aluminum motor mounts.

cTn
01-17-2013, 10:12 PM
pretty cool, there is no support for tricopter (at the moment) but it can be added pretty easily

roens
01-17-2013, 11:05 PM
Yeah, I've already got an atmega 2560-based controller. (the "MultiWii Pro" board from HobbyKing) And will use that for now. But like the idea of separating the sensors from the MCU, for flexibility of firmware & both software and physical setup. Plus, it's cheaper to change the MCU if its not part of the sensor array.

Ectar
05-12-2013, 03:51 AM
Any progress lately ?

cTn
05-12-2013, 10:58 AM
Any progress lately ?
Well of course, one of the many highlights since my last post:

I got a crossplatform configurator utility
Flight software now supports accelerometer "Trimming" via transmitter
Fully dynamic channel assigning and fully dynamic aux functions assigning
Support for 16 channel receivers
Support for both PWM and PPM receivers
And many more...

Ectar
05-12-2013, 08:08 PM
That sounds good and promising, thank you for update.

Ectar
05-31-2013, 02:35 PM
You have only one PPM input, what transmitter/receiver are you using for controlling craft ?
I have Turnigy 9x and FrSky V8FR transmitter module don't think I can set it up that way......

Ectar
09-07-2013, 02:28 AM
Well of course, one of the many highlights since my last post:
Support for both PWM and PPM receivers
And many more...

What pins can I use for PWM setup?

And the main question about ESC, how they handle 3V logic levels, and how did you power your Receiver? 3.3V or 5V ?
If 5V, is Teensy Pin3 5V tolerable ?

Thank you

Surferjoe
09-11-2013, 03:48 PM
This is great! I have been looking at building a quad or a 6 blade R/C copter for aerial video. But, instead of using blades I was thinking of using electric ducted fan engines instead with a 100% carbon fiber body. I am a total novice in the design and electronics, but very experienced in PC/server and network systems design.
Could I use this to stabilize and control my project?

vikashshinge
10-21-2013, 09:49 AM
Its a remarkable software for flights. The aviation industry (http://www.epcworld.in/aviation.aspx) make high use of such software. I have read articles where many countries make use of this kind of software.

Ectar
01-21-2014, 04:31 AM
Hey cTn, any news on project? I got some of your shields printed, but I have trouble figuring out bills of materials, can you send me one ?

markus1234
01-30-2014, 02:30 PM
Hi cTn,
this project is great.
I've downloaded the software, ordered an got a teensy3.1. The code is compiled and downloaded.
But I did not manage to connect the configurator. The port-field is empty and no device can be selected.
I've tried this with chrom, chromium and firefox - no difference.
I use Ubuntu and linux mint.
lsusb shows "Bus 004 Device 005: ID 16c0:0483 VOTI Teensyduino Serial"
/dev/ttyACM0 exists.
I'm member of the dialout group.
Do you have any idea whats going wrong?

Edit: Chrome Version is 32. Using Windows vista brings the same results.
Edit2: The error in the js console is: "Uncaught TypeError: Cannot call method 'getBackgroundPage' of undefined "


Thank you

markus1234
02-01-2014, 07:00 AM
Well I've had to learn something about chrome Apps - now it is working well :o

markus1234
02-07-2014, 03:24 PM
The mini flies. PID's not changed. Graupner SUMD protocoll added :)
1394

tcmichals
03-06-2014, 05:15 PM
The mini flies. PID's not changed. Graupner SUMD protocoll added :)
1394

Good looking quad, is it possible to get a parts list? basic cost?

markus1234
03-07-2014, 04:54 PM
The parts are:
- Teensy3.1 flight controller
- Graupner Mx-12 with GR12SH+ (I've forked (https://github.com/CopterFail/Phoenix-FlightController) cTn's software for my experiments)
- ESC XP 3A 1S 0.7g
- HobbyKing AP-03 7000kv Brushless Micro Motor
- Frame: 1,5mm CFK (wood may also work)
- Sensor: GY-86
- LiPo: 1S, 750mAh
Please ask google for the price of the parts.
Wheigt is <70g (I've test 20g additional load). Size, motor to motor, is 10cm. Nice to fly inside the house, especialy when it is cold outside ;)

JohnDH
10-22-2014, 08:57 PM
I'm working on a similar project using Teensy 3.1, MPU9150, and MPL115A2, but cannot connect to the Baseflight configurator. Can you give some info on how to do this?

tcmichals
10-22-2014, 10:13 PM
I'm working on a similar project using Teensy 3.1, MPU9150, and MPL115A2, but cannot connect to the Baseflight configurator. Can you give some info on how to do this?

I ported baseflight firmware and had to a mod to baseflight-conifguration tool due to GPS not being installed. Which code base are you using

JohnDH
10-23-2014, 01:16 AM
I am currently working with MPU9250BasicAHRS.ino, but have not achieved a good compile for Teensy 3.1, and teensyduino

tcmichals
10-23-2014, 01:31 AM
Here is a working version of baseflight ported to Teensy3.1 (https://drive.google.com/file/d/0B0wXCQunUlRjZkRPUmRLeDNwcVk/view?usp=sharing)
couple of bad (https://drive.google.com/file/d/0B0wXCQunUlRjTEkzYUsxY05qbGM/view?usp=sharing) photos (https://drive.google.com/file/d/0B0wXCQunUlRjS0k2TWpKUUFKMTA/view?usp=sharing
https://drive.google.com/file/d/0B0wXCQunUlRjTEkzYUsxY05qbGM/view?usp=sharing)

JohnDH
10-23-2014, 01:50 AM
What tools did you use to compile your port?

tcmichals
10-23-2014, 02:18 AM
https://launchpad.net/gcc-arm-embedded But I think the standard gcc that is shipped with the install for Teensy patch will work also.

CrazyCoder
10-23-2014, 03:19 AM
Are there any benefits using baseflight on Teensy instead of something like Afro Mini (which is cheaper and already has sensors)?

Or is it mostly just for fun?

tcmichals
10-23-2014, 03:38 AM
Yes for fun; keeping up with HW/SW skills, but also using cheap receiver has only PWM outputs a PWM/PPM encoder is needed with Afro mini.

CrazyCoder
10-23-2014, 04:01 AM
Thanks. By the way, you can make a cheap frsky and flysky CPPM receiver yourself:
http://www.rcgroups.com/forums/showthread.php?t=2124647
http://www.rcgroups.com/forums/showthread.php?t=1798913

Or just use OrangeRX 100 which is ~$10.

JohnDH
10-23-2014, 10:38 AM
tcmichale
I'm looking to transfer position by using quaternions and avoid gimble lock problems
http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/
As a first step, I want to duplicate what is shown in this link

tcmichals
10-23-2014, 01:35 PM
tcmichale
I'm looking to transfer position by using quaternions and avoid gimble lock problems
http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/
As a first step, I want to duplicate what is shown in this link

OK, if you have some source code I can help out.

DeveloperPaul
09-15-2015, 12:18 PM
Hello, first off great job on your project. I'd like to get some input from you on my current project as well. I'm working on a micro H-quad based on the carbon h frame from micro motor warehouse and the chaoli brushed 08-15 motors. I'm also using an MPU 6050 and a bluetooth module for my rc control. I've also written an android app that I use to control the quad with. Do you have any suggestions on making the serial communication faster, or atleast sending commands to the quads faster? Currently it reads the Bluetooth serial channel every loop and reads one byte. My app is sending a string like this: T50Y20P10R0E, so that means throttle at 50, yaw at 20, pitch at 10 and roll at 0, E is the end command. So my quad parses that one character at a time, so once it sees the T, everything after it is added to char buffer array for the throttle, then it reads Y and addes the 2 and the 0 to a yaw char buffer array and so on. Once it reads the E, the char arrays are converted to numbers (atoi or atod functions) and then the control inputs are updated. This works ok for small changes and for slow changes, but when I change things rapidly it seems to miss commands and it will change the throttle to 0 so in mid flight my quad will cut the motors. Any suggestions on this? I see in your code you have an optimization for the serial communication (SerialCommunication.h), would something like that work for me?

Also, how did you tune your PID values? I'm currently only using the gyro to try and get acro mode working and it flys for maybe 3-10 seconds before I can't really control it. Part of the problem is the issue I described above where I can't really control it, but it is also not as stable as I would like. I'm going to implement auto level mode as well but would like to get gyro only working as well. Currently I only have P values set and 1 or 2 I values are done, but these haven't been well tuned.

I'm also running on a single cell lipo (490 mAh) and the parrot rolling spider props.

Also, do you think that increasing the resolution of the PWM (Teensy supports up to 16 bit PWM) would allow for finer control of the motors? (I'm using PWM and mosfets to control the micro brushed motors)

JohnDH
01-06-2017, 09:08 PM
Compiling the Phoenix Flight Controller code I get a "mpu6050_10DOF_stick_px01.h" not found. I can find that file, but I am not sure of what to do with it. Is there a library that includes the file that should be installed?

markus1234
01-08-2017, 08:28 PM
Long time ago...
The library folders of the project has to the copied to the lib folder of arduino. "mpu6050_10DOF_stick_px01.h" is found in the "p6dof" folder.

theking451212
04-21-2019, 02:46 AM
I'm unable to use the phoenix configurator, when I open it up theres no information in the COM box and nothing seems to do anything. Is there some special way its meant to run?