This is a program to stabilize a multicopter (copilot), runs on microcontroller like Arduino or Teensy++ and only a wii motion plus, no other electronics needed. These project started April, 2010. Supported are planes, tricopter, quadricopter (+ and x config), hexacopter (penta and coaxial). The self-leveling capability helps when doing FPV (first person view).
THIS PROJECT IS UNDER DEVELOPMENT.
YOU MUST HAVE PROGRAMMING SKILLS TO START!!! BE AWARE!!!
CHANGELOG
22 Aug 2010
Sorry about lack of news, V50 work perfectly, it is hard to adapt to all hardware & skills, I have changed a lot to adapt to my personal config, so it it a matter of time to generalize options to all taste. If you are skilled write to me to test this V50.
I have changed the way that enable motors, now you can switch mode & engage motors with only 4 channel
working on a way to trim ele&ail in stable mode in a simple way.
Sorry about delay, I have started a new work on a French Factory.
Tested with success 400Khz I2C transfer rate on a standard WM+ Using only one line of code: TWBR = 12 after Wire.Begin(); you can read WII gyros at a 2.5Khz rate!!! (only 400us).
27 July 2010
Software will be compatible also with Multipilot board, with the help of a second arduino to manage pwm to motor and RX.
Found a very good source about channel ordering for a lot of rx.
Found good way to use Barometer & compass sensor, very promising result.
25 July 2010
Very interesting thing, removing internal pull-up resistor (1.6KOhm between Vcc and SDA, SDL) you can place I2C bus to 400Khz (4x normal speed!)
23 July 2010
Got a digital oscilloscope! Some news about i2c, nunchuck have pull-up resistor!!! 1kohm between sda/scl and Vcc, this is a problem that an logic 1 is a very low level for the arduino.
21 July 2010
Some problem with power lines too much voltage from ubec (5.2v) and the use of a 3.3v voltage regulator, seem to cause i2c to not comunicate. Study continue. Maybe a new schematic soon.
19 July 2010
Arrived Multipilot board with barometric, accel & gyro sensors
Arrived 520Line Sony CCD 1/3" camera naked
Tomorrow first test with ADXL335
18 July 2010
ADXL335 work with a good frequency but with not a good resolution like wm+
HMC5843 work but it must tilt compensated
SRF02 ultrasonic sensor is very good but slow
16 July 2010
Arrived a lot of new sensor that will be supported on baronpilot (like the ADXL335 from sparkfun).
Testing with a Nunchuck with Bosch SMB363 triaxial accel
Tricopter/Teensy bug corrected (servo is running at 50Hz)
Added HOWTO section, also with some info on stable mode
13 July 2010
Please take some time to read WARNING about Gear/Mode Channel5, If you don't connect it to a three state button, BaronPilot don't work as supposed. Check all value with the command line WITHOUT connecting ESC motors or propellers.
Changed the 6 output numbering from teensy with schematic V40
8 July 2010
New Version V39, finally I have done some testing on RX routine, a lot of bug fixing. Teensy now supported with 5 channel RXDIRECT! Found a new channel, it is possibile to use also an HEXA configuration (Coaxial or not).
Teensy now have a separate schematic (to support also 6 ESC/Motors).
6 July 2010
New Version V38 This version is only a small corrections about receiver code, V37 output the raw data from RX not the correct one (very useful to test receivers).
5 July 2010
New Version V37 with support for Quadricopter, Teensy++2.0 (preliminary), Arduino Nano, Corona Receivers (only in RXDIRECT mode), You can also test it without Nunchuck!
Corrected Bug in RXDIRECT (rewritten)
Found a serious BUG in RXDIRECT (doesn't work with Corona Receivers)
BaronPilot support directly Teensy++ 2.0 and Quadricopter (need some time to test it).
4 July 2010
Arduino NANO arrived have some problem.
Teensy++ 2.0 successfully connected to a Wii Motion Plus, very very fast readings.
3 July 2010
Corrected the very confusing comment in setup.h (remove double slash to ENABLE a feature not disable). V35 out.
Propellers arrived (Original APC 10x4.7) from Micron Radio Control (very good service) ! Waiting Nano & teensy!
28 June 2010
V34 Beta is out, you can now use the RXDIRECT mode (change setup.h) to receive directly RX channels.
100% compatible with all receivers (but only 5 channels, you can't change vertical parameters in stable mode).
Motors (9!!!), ESCs, Sensors arrived, with your help, now I can build a tri AND a quadricopter!
Teensy++ 2.0 is arriving! A lot of memory, more speed! GPS is easy to do with it. Thanks Paul!
24 June 2010
I will have two type of motors, KDA 2217-20 and Turnigy SK 2830 750kv, two CPU Arduino NANO and 1 Teensy++ 2.0, ESC are the pentium hobbywing programmable 18A, building a quad now I have also a lot of pusher propeller 10x4.7 APC
Software will be compatible between Quad & Tri copter, so you don't have to worry about it.
23 June 2010
Bought motors, ESC, arduino, and pusher propellers from UK (before the new VAT!). Thanks Cameron! :)
22 June 2010
Thanks also to Enrico, Antonio & Michele for your support.
Quadricopter has begun. Some difficult to find the pusher propeller, waiting for the new equipment.
19 June 2010
Dear Umberto, Giuseppe, Fausto, Mauro, Peter, Giovanni, Pier Maria, Jussi, Michele, ActUponMail, DDrake, Paul
I want to express my appreciation for your generosity in support of BaronPilot. Your personal commitment was incredibly helpful and allowed me to continue. Your assistance means so much to me but even more to the curiosity and research. Thank you.
Sincerely,
Francesco Ferrara A.K.A. Ciskje
18 June 2010
New command to change Stable Mode PID parameters (SR,SW)
Thank you for all of your support !!! (sorry about Italian Donate paypal button, english friends!)
Please please please, help me with a small paypal donation :(
I have lost a lot of material in the explosion.
BAD News, yesterday my tricopter has died. :(
Don't flight near a high voltage line.
Sorry about that, but I need to rebuild now a new quadricopter maybe, stay tuned.
Don't worry about new version of BaronConfig, it is simple to adjust parameter with the command line, if you need to change sometihing. (wthout my Arduino it is impossible for me to code BaronConfig for now).
17 June 2010
Victory! BaronPilot is the cheapest platform 6DOF, with autostable feature!
A lot more easy to flight even in altitude, it is very very simple.
channel5 is the flight mode, channel 6&7 adjust the vertical to maintain the correct attitude.
FIRST autostable version WORK!!! It is really really fun to play with this alpha version (V30)! Now I'm working on a beta realease, this version use fully the nunchuck and its accels.
Added some info on channels in the features section
You can use this software also with a quadcopter simply assign channels to FRONT,REAR,LEFT,RIGHT (D9 D10 - D3 D11) and modify mixing routine like this: channelOut[FRONT] = limit(-500,thr+ele+rud,500);
channelOut[REAR] = limit(-500,thr-ele+rud,500);
channelOut[LEFT] = limit(-500,thr+ail-rud,500);
channelOut[RIGHT] = limit(-500,thr-ail-rud,500);
Change names of the channels in globals.h:
#define FRONT 0 // D9 16bit 50-500hz
#define REAR 1 // D10 16bit 50-500hz
#define LEFT 2 // D3 8bit 488hz
#define RIGHT 3 // D11 8bit 488hz
#define AUX1 4 // D8 8bit 50hz
Alpha test of the stab version. Very promising result from accel, but a low frequency of the refresh (2ms). Currently searching the working way to achieve a correct stabilization.
FOUND a serious bug in PID controller subroutine, you NEED to upgrade to V28
I have used "limit()" for the integral part of the routine, sometime after V24, but this routine use int 16bit not float! I have added now flimit that use float.
This is the BAD line of code: pid->integral=flimit(-500,pid->integral,500);
Signal from receiver are smoothed to cancel some error
490 Hz ESC PWM now (if your esc can't support this high speed change it to 250 or 100hz in setup)
Gyro sensors are now low pass filtered, so you can use higher gain to stabilize you vessel.
Correctly scaled gyro value deg/s (wiibrew info are now correct), fast & slow mode are now coherent.
3 June 2010
A lot of test yesterday, with a new method to smooth Wii Motion Plus sensor, add a lot better control.
Shortly follow a new version, after some test.
29 may 2010
GOOD News, nunchuck have the same sensor of the Mikrokopter so it is not a component fault.
WARNING! Schematic have some error.
Best is to use one of the internal BEC from ESC to alim other servo, and a separate UBEC 5V to alim ATMega.
ESC are connected directly to the main battery.
28 may 2010
Baronpilot V24 released!
A lot of bug fixed and very good commands via serial to know how to check and modify parameters.
CLI Command line interface to modify parameters guide
Some problem with the nunchuck, vibration cause incorrect data raw read, further investigation needed.
Currently alpha version software avaiable on request.
FORUM
If you want to discuss this project write to this forum RCgroups (English).
Se volete discuterne in italiano potete usare il bellissimo forum in italiano BaronRosso.
FEATURES
No external component, you can use also a breadboard
Only 3 main component, an Arduino Nano 3.0, a Wii nunchuck, and a Motion Plus controller (optionally a Nano IO Shield).
Take double site tape to eliminate vibration problem
Solder board
Follow schematic
Separate clearly +5V from Arduino/Teensy++ from Servo/Esc
Test single component
't' command give you the channel received
'm' command give you current motor output
'g' command give you current gyroscope read
'a' command give you current angle
Test acro mode
switch channel5 from disabled mode to acro mode (center position).
Test stable mode
Configure the vertical of your vessel with the 'v' command.
Place vessel on a stable flat surface
Give 'vs' command (vertical set)
Check with A command that the two angle pitch & roll (deg) value are near zero
Place vessel with nose up, you must read value like 90;0 (pitch roll).
give EW to save parameters on the eeprom.
TODO
In order of priority:
Added DEBUG single part defines
Add support for Channel5 double way.
Add a simpler way to adjust stable mode
Support Planes like Easystar
PC Software to change parameters
Add GPS
Add magnetometer
Add ultrasonic finder
COMMAND LINE INTERFACE
Baronpilot accept some commands via serial at 115200baud, you can use serial monitor on the Arduino IDE.
All of this command must be lowercase.
PRP,PRR,PRY - Pid Read Pitch, Roll, Yaw
Read the PID parameters of the Roll Pitch and Yaw axis.
They are 3 numbers.
The first one is proportional to the current error between stick and gyro, unit is us/deg/s tipical 2, reduce it if you found your vessel to wobbling.
The second one is the integral, that parameter can reduce the offset of the difference in the motors, unit is 1/sec, typical 4-8. Large values compensate faster the offset.
The third one is the derivative, correct the istant variation of the error, this is a pure number, typical 0.
Ex. PRR
1.2;0.28;0
PWP,PWR,PWY - Pid Write Pitch, Roll, Yaw
Write the PID parameters of the Roll Pitch Yaw axis, to the RAM memory, you must write to the EEPROM to test it.
Ex: PWY 3.6;0.17;0
ok
SRR,SRP - Stable Read Roll,Pitch
Read the 3 parameters about the PID that control the attitude (with the help of accelerometer on the nunchuck).
Ex: SRR
2.5;2.0;0
SWR,SWP - Stable Write Roll,Pitch
Write the 3 parameters about the PID that control the attitude (with the help of accelerometer on the nunchuck).
Ex: SWR 2.5;2.0;0
Ok
EE - EEPROM erase
Remove old parameters
ER - EEPROM read
Read from the EEPROM the PID parameters, if they are not found in the memory load the default.
EW - EEPROM write
write current RAM PID parameters to the EEPROM
T - Transmitter
Current channel input read from the receiver, centered to 0, the unit is microseconds (us). Range is [-500,500]
MODE must read 500 in disable mode (>=2000 raw).
Ex: 21.33;21.33;-500.00;-1.31;500.00;
TR - Transmitter RAW
Current channel input read from the receiver, the unit is microseconds (us). Range is [1000,2000]
MODE channel must read 500 in disable mode (>=2000 raw).
Ex: 1520;1520;944;1520;920;
R - Raw Data
Pitch,Roll,Yaw,x,y,z accel data from the nunchuck continuos print flag, to exit from this mode, send a 'X' Command.
Ex: 8141;8088;8301;1;1;1;498;516;514
M - Motor
Current motor commands, unit are microseconds, centered to 0. Range is -500,500 us.
Ex: 1;0;-1;-500;12;-500;
G - Gyro
Gyro data continuos print flag, to exit from this mode, send a 'X' Command. Pitch,Roll, Yaw deg/s, printed continuously.
X - Exit
Exit from all of the continuos print mode.
F - Free RAM
Print current free RAM and current allocated memory to the internal buffers.
Ex: 1380;170
I - Reset IMU
Perform a calibration on the gyro.
AI - Accel Instant
Give you current angle (in 360°) accelerometer instantaneous, without the help of the gyro, not filtered from the centripetal forces, useful in stand still.
Ex: AI
0.05;88.9
AF - Accel Filtered
Give you current angle (in 360°) accelerometer filtered with the help of the gyro. Check to see 90° in vertical situation.
Ex: AF
0.05;88.9
AR - Accel Raw
Give you current value read from the accelerometer centered to 0. Warning usefull only if you have correctly calibrated it with 'vs' command. Measured unit is not used, atan2 is used to calc angle so importance is only relative that all 3 value are the same scale.
Ex: AR
0.05;0.08;100.4
VR,VW - Vertical read/write
Write or read, the 3 accel zero value that determine the vertical vector (x,y,z), they are 0-1024 (10bit) value (normally near 512). You can adjust these value to find a corrected vertical and planar vessel.
Ex: VR
498.00;516.00;514.00
VS - Vertical set
Place vessel on a flat surface, give this command to write current vertical vector for the stable mode.
Channel5 must read 500 in disable mode, 0 in acro, and -500 in stable mode
To use the nunchuck data in stable mode you MUST found the vertical value (read 0deg pitch&roll) with the V commands. WM+ are centered automatically when you switch on microcontroller. (DON'T TOUCH your VESSEL!).
For the direction of the sensors (WM+ and nunchuck) follow the right hand rule looking to the 'A' command output, the first two numbers are pitch and roll degrees. With the nose up, pitch number must increase from 0. With ailerons right the roll (second number) must increase.
ESC Hobbywing Pentium 18A work Ok with a quadcopter, they support also fast PWM (also 500Hz). 8-9 Minute of flight with 1.3Kg, and a 3s1p 2200mah.
Take into account that it is better to give power BEFORE to the ESC, they play the 123 sound, and then the bip bip bip waiting for the signal. Now you can switch on microcontroller. If you switch Microcontroller AND esc together you can't arm ESC (silence sound after 123 tone).
Please use only RX with processing signal and Failsafe. (like IPD multiplex or Corona RP8D1).
If your receiver doesn't work, simply try the new RXDIRECT mode, 5 wire = 5 channels 100% compatible.
Some receiver interleave channels odd and even with 2 shift register not 1.
Multiplex RX-7SYNTH is one that use interleave with 660us.
Testing with a Futaba R137F show that interleave is zero. (1 shift register?).
Try to change this define in RX source code:
#define CHANINTERLEAVE 660 // 660 for multiplex, 0 for others
You must command Channel5, that is used as a security guard, best it to use a three position switch with your radio:
Position Up: DISABLE, motor disable, radio is not readed, you must notice some jitter to the yaw servo
Position Middle: READY TO TAKEOFF, motor enable, radio is readed, throttle is linear.
Position Down: NORMAL, motor enable, radio is readed, minimum throttle is applied, throttle is expo.
If you note, in the normal mode, that motor give strange accel/decel without giving throttle, vibration is the cause normally.
Default parameters about 5 PID are normaly loaded from the EEPROM (the arduino hard disk):
They are:
For acro Pitch,Roll:
1.2;0.28;0
For acro Yaw:
3.6;0.17;0
For Stable Pitch,Roll:
2.5;2;0
If EEPROM is empty (first installation) default parameters are loaded and saved to the eeprom.
This is a very dangerous video of the stable mode, look at this instant reactions:
First video of Baronpilot on Nano:
Second Video of Baronpilot Teensy++ & my new Quadricopter "phoenix"
V21 Beatyful landscape:
V32 Autostable feature:
IMAGE
These are images from Teensy++ board for V41 Baronpilot, for a quadricopter:
These are images from Arduino Nano and I/O Expansion board, for a quadricopter:
FAQ
Do I need a programmer for the Arduino?
No, you can program it with the embedded USB-Serial interface on the nano, you need only a USB cable and the driver.
Can I use other platform compatible?
Yes, you can use also other platform.
Do I need 3.3V?
No, wii motion plus and nunchuck can be used also with 5V
Do I need to solder a Board?
No, you can use a breadboard or a IO Nano Shield
Motors needed?
I'm using KEDA/Turnigy 2217/20 860kv 220W, but best overall are the Keda 20-22L 17A 924Kv Hacker Style
ESC?
Hobbywing/Turnigy 18A programmable. They support Fast PWM also at 500Hz.
structure is made with 10x10mm aluminium frame and plywood
Yaw mec.?
SG5010 servo
What are the correct values from G A T commands?
Gyro must be zero if you don't touch your vessels, A give you current roll&pitch value so they must be 0 when you have zeroed it with the 'V' commands. T give you number like 1000-2000 and then -500,500. They must react to the radio.
What to do if arduino reset in flight?
Don't power it with the same line of servo or esc.
LINKS
Hardware jzhaoket for Arduino Nano 3.0 and the Nano IO Shield Giantcod for R/C materials Micron Radio Control for pusher APC 10x4.7 propeller Modelfixing for the small piece that you don't have ElectronicaRC for video radio trasmitter (FPV First Person View) pjrc.com Teensy++ 2.0 (arduino compatible) microcontroller (more ram, more PWM output). Volarerc italian shop Parachutes Parachutes and deceleration devices for rockets, airplanes, helicopters, kite recovery, high altitude balloons, sea anchors
Software
Arduino Environment (free C compiler, and the driver for the USB on the nano)
How to build a tricopter (by Signguy)
A very simple project, with only 4 gyro, without a board, but you must have a radio that support heli & 120degrees.
KapteinKUKs Simple and Low Part Count Quad, Hex and Tricopter Flight Controller
simple from the software view, but complex for electronics & without self-leveling. Preferrable if you don't have programming skills.