BaronPilot
Arduino based copilot autostabilizer with Nintendo Wii component

[ Home ]

Changelog
Forum
Features
HOWTO

TODO
CLI
Schematic
Download
Warning
Video
Image

FAQ
Links

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.
  • 13 Aug 2010
    • New TR command, separated from T command.
    • Testing V50, will be released when all source code will be cleared.
    • Found a bug in eeprom save parameters
    • Founding a way to switch the 2 operating mode with only one switch.
    • New incredible VIDEO of the stable mode.
  • 7 Aug 2010
    • Testing V46
    • Totally rewritten CLI , now I can add word as commands and not only letters.
    • Added in V46 3 new command af,ar,ai
    • V46 use 400Khz I2C bus, full feature cycle is now 1.4ms (over 700Hz!!!).
    • Sorry about lack of update, I have changed my job, but from now I'm restarting my experiment.
    • Added warning about programming skills.
    • If you want to help me you are welcome! Someone that write a PDF guide?
  • 5 Aug 2010
    • Corrected Pitch Roll swapped in CLI
  • 4 Aug 2010
    • 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.
    • Another successful story about a Baronpilot Tricopter Video by Katana13
    • 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
  • 15 July 2010
    • Easystar support.
    • 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.
    • There is a bug on Teensy/Tricopter config (rear servo is running at 500Hz), working on it.
    • Added reference table with input/output channels
    • Added images from a Arduino Nano & I/O Expansion board
    • Added a video with the Arduino Nano Quadricopter
  • 12 July 2010
    • Added a lot of images for Teensy++ board
    • I have now an Arduino Nano to test.
  • 11 July 2010
    • 3 new FAQ question
    • Added some info on warning about correct value to read in stable mode
    • Added link to parachute 36"
    • Some problem with internet line of the server. Sorry.
    • Added some warning about arming ESC.
    • Added some warning about Tricopter
    • Added and corrected some TODO about Multiplex Easystar.
    • Added some info on 'A' command line.
    • Added some warning about 500Hz with ESC
    • Added some warning about how to mount the sensors.
  • 10 July 2010
    • V41 out
    • QUAD X config supported.
    • HEXAcopter now are supported.
    • HEXAcopter coaxial supported.
    • Corrected ICR3 bug in nano section
  • 9 July 2010
    • FINALLY! First flight of the new baronpilot on teensy++ 2.0 and a quadricopter config! Video
    • V40 first version not beta!
    • 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.
  • 2 July 2010
    • Quadricopter Phoenix is born:
      Free Image Hosting at www.ImageShack.us
    • Received Teensy++ 2.0!!!!!
      Free Image Hosting at www.ImageShack.us
    • Received Arduino Nano, IO expansion Slot.
    • Corrected links section (Giantcod & ebay Thanks SupraGo).
  • 1 July 2010
    • Propellers arrived (Original APC 10x4.7) from Micron Radio Control (very good service) ! Waiting Nano & teensy!
      Free Image Hosting at www.ImageShack.us
  • 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).
    • New schematic with the new RXDIRECT 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)
    • Some new info on warning
    • 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.
    • Released version autostable V32
    • Currently in alpha version BaronConfig a program for Windows/Mac/Linux to configure graphically internal parameter.

 

 

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).
  • PID Control of the gyros
  • 7 channel IN
  • support of ANY R/C receiver
  • 6 channel OUT, mixed ESC/Servo from 50 to 500hz
    • D9,D10 16bit 50-500hz
      D3,D11 8bit 488hz
      D8,D12 8bit 50hz
    • Teensy++ support: 2groups of ESC/Servo channel 50/500hz full 16bitnew
  • Actually you can flight with:
    Tricopter
    Quadcopter + config
    Quadcopter x config
    Hexacopter
    Hexacopter coaxial

HOWTO

  • Buy parts
    Check links section. Buy:
    • motors KEDA/Turnigy 2217-20 860Kv
    • hobbywing/Turnigy 18A ESC
    • aluminium arm
    • plywood
    • Arduino Nano & I/O expansion board or a Teensy++ 2.0
    • UBEC 5V >1A
    • Receiver like Corona RP8D1 or better Multiplex RX7 IPD
    • Battery >= 2200Mah 3s1p LiPo
    • Radio with minimum 5 channel.
    • Wii Motion Plus
    • Wii Nunchuck
  • Build Vessels
    • 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 new

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 new

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 new

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 new

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.

Ex: VS
498.00;516.00;514.00

SCHEMATIC

Very simple connection, you don't need to solder a board, you can use a breadboard.
You need:

  • Arduino Nano 3.0 (or compatible but with the new ATMega328p) or Teensy++ 2.0
  • Wii Motion plus (wiimote isn't needed)
  • Wii Nunchuck (optional)
  • Some wire, 0.1" pins and a breadboard
  • A tricopter or a quadricopter as you like (don't ask me how to build it).

Follow the colors of your cable (change with different version of the hardware) look at this reference image:

newNormally Baronpilot need 5 channels in acro mode, and 7 in stable mode:

  • They are AIL (0), ELE (1), THR (2), RUD (3) and MODE (4) that is used as a security guard, connect it on a three state button
  • Modes are (check MODE channel with the 'T' commands):
    • value 500 disable all motors
    • value 0 acro mode, all motors engaged (using only WM+ gyros)
    • value -500 stable mode, all motors engaged (using WM+ AND nunchuck accelerometer for self-leveling)
  • So for example THROTTLE channel on your receiver need to be connected to D5 on arduino (using RXDIRECT mode).

Input channels using mode RXDIRECT:

  0 1 2 3 4
Arduino D2 D4 D5 D6 D7

Teensy++

B0 B1 B2 B3 B4

Input channels using sequential interpolation (normal mode):

  0 1 2 3 4 5 6
Arduino D2 NC D4 NC D5 NC D6

Teensy++

B0 NC B1 NC B2 NC B3

NC = Not connected, is derived from the near channels, you can use it only on simple sequential RX (old one).

Output channels are:

  0 1 2 3 4 5 Note
Arduino D9 D10 D3 D11 D8 D12 D9 D10 for ESC/Servo, D3 D11 ESC Only, D8 D12 Servo Only.

Teensy++

B5 B6 B7 C6 C5 C4 B5 B6 B7 ESC/Servo, C6 C5 C4 ESC/Servo, in 2 groups.

Look at the setup.h to know or modify input/ouput channels.

DOWNLOAD

  • Baronpilot (zip file for Arduino sketch, expand to the default dir of the environment
  • Arduino Software (IDE)

WARNING

  • 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.

VIDEO

This is my channels on youtube.

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 new 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. new

[ Home | Arduino ]

Please help me to correct this page.
Q&A: ferrara.levami-remove@libero.it