Arduino based copilot autostabilizer with Nintendo Wii component

[ Home ]




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


  • 19 Oct 2011
    • Look at the new quadricopter shop. There are a lot of item for building it!
  • 21 Jan 2011
    • First step in the UAV complete system with GPS, this is the first implementation of the DCM filtering with Wii components, and a MARG sensor array, this is really really fast way!
    • The BaronPilot name & project will be changed, the new SuperEconomical UAV will be main target for this project.
    • Founding a new company to project&build this vehicles, with no worry for users, cheap, and fast delivery. Target price will be under 180 euros.
  • 3 Nov 2010
    • Introduced the V60 with the new Multiwii compatible mode, you don't need to modify hardware between the two platform (and to test the GUI).
  • 1 Nov 2010
    • Removed old blog entry
    • Working on a Teensy version of the Multiwii.
    • GPS serial routine work!
  • 22 Oct 2010
    • FINALLY a GUI! new
    • Download V59 with GUI for Windows, Mac OS X, Linux.
    • Remember that Chan5 (Mode) is used to engage motors (keep until flashes), to switch off throttle min and rudder left.


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.


  • 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
  • 5 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:
    Quadcopter + config
    Quadcopter x config
    Hexacopter coaxial


  • 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.
  • Know the correct angle & direction?
    Take this image reference, red arrow are positive direction of the angles: new


All value are in this order Pitch Roll Yaw for the gyro, or x,y,z for the accelerometer


In order of priority:

  • Add GPS
  • Add magnetometer
  • Add ultrasonic finder


To start motors:

  • V58+
    • Have another approach, to engage motor, switch the mode channel on (stable mode) for 2 seconds (look at the flashing led), than put it in acro mode, now motors are engaged.
    • To switch off motors, put throttle to minimum and rudder to the left.


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.


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

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


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


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

Give you current angle (in 360°) accelerometer instantaneous, without the help of the gyro, not filtered from the centripetal forces, useful in stand still.
Angles are Pitch & Roll

Ex: AI

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

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

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

VS - Vertical set

Place vessel on a flat surface, give this command to write current vertical vector for the stable mode.

Ex: VS


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:

Baronpilot need only 5 channels radio

  • They are AIL (0), ELE (1), THR (2), RUD (3) and MODE (4) that is used as a security guard, So for example THROTTLE channel on your receiver need to be connected to D5 on arduino (using RXDIRECT mode).

Input channels:

  0 1 2 3 4
Arduino D2 D4 D5 D6 D7


B0 B1 B2 B3 B4

Output channels are:

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


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

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


Free Image Hosting at

  • Baronpilot (zip file for Arduino sketch, expand to the default dir of the environment )
    • V60 ALPHA with the new Multiwii compatile mode (Warning UNTESTED!, you can enable it in setup.h change the define).
    • V59 and GUI new Build 18 (graphical setup for Windows, Mac, Linux)
      These has been tested on Arduino Nano, Teensy++, Windows, Mac OS X!
  • Arduino Environment (free C compiler, and the driver for the USB on the nano)
  • FTDI Serial Driver(To connect GUI without Arduino Env)


This is my channels on youtube.

This is a very dangerous video of the stable mode, look at this instant reactions:



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:




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


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