This article is now hosted on its own site:
The TriWiiCopter is a tricopter that uses Nintendo Wii console gyroscopes and/or accelerometers. We find these sensors in the extensions of the Nintendo WiiMote . This tricopter was an opportunity to develop my own software on an Arduino platform. The achieved stability is excellent for FPV and allows any kind of acrobatics.
The software can also be used to control a quadricopter or a hexacopter.
The tricopter mentioned in this article is mainly a project of electronics and programming. The structure of my first tricopter was reused and reinforced with carbon/kevlar fiber. Some LEDs were also added for a better flying visibility.
Wii Motion Plus
A Wii game controller is composed of three accelerometers to determine an angular position, and measure lateral accelerations.
It is enough for most games, but an accelerometer is not very accurate for measuring small variations. For the most demanding games, Nintendo developed the Wii Motion Plus (WMP) extension which uses three gyroscopes and plugs at the extremity of the game controller. These three gyroscopes coupled with three accelerometers can determine more precisely the attitude of the controller.
There is extensive information on all the extensions here:
On a multicopter, the use of accelerometers is a plus but not necessary if you do not want to keep strictly to its angular position in space.
The measurement of angular velocity is sufficient to ensure good stability.
The extension Wii Motion Plus has numerous advantages compared to other gyroscope sensors:
1) its cost
Invensense is a manufacturer of electronic components, particularly gyroscopes.
Usually, these components are distributed independently and are relatively expensive.
Example from Sparkfun:
Invensense manufactures (at least 1 of 2) gyroscopes of the Wii Motion Plus: IDG600 or IDG650. They seem to have been designed specifically with a probably very low wholesale price.
We benefit directly from this situation in the cost of the extension, especially since there are many Chinese copies that can be found for $10 or $15
2) its dimensions
The Wii Motion Plus extension is made up of two pairs of 2-axis gyroscopes, (only one axis being used on one gysroscope). Finally, once the PCB is extracted from the WMP case, there is a set of 3-axis gyroscopes in a small space. More importantly, they are all mounted on a plane surface without additional PCB. Copies are not all identical, but the dimensions remain the same.
3) its integrated ADC
When we want to interpret the value of sensors, we use an analog input and then convert it into a digital format usable by a program. Wii Motion Plus extension includes a 14-bit analog-digital converter.
4) its communication protocol
This extension communicates with the controller on a I2C bus in fast mode at 400kbit/s. It’s interesting because this bus coupled to the integrated ADC allows for performing conversion that will not be addressed later by the micro controller.
Moreover this bus uses only 2 data wires.
4) its performance
At that price, performances are not the best among the existing modern gyroscope. Noise (spurious signals in the absence of movement) is important, but we can find 3 MEMS sensors that outperform the piezo gyros still found in many RC gyroscopes.
Properly filtered, the signal is pretty accurate.
FYI, the must have gyro seems to be the ADXRS610, and at that price it has only one axis :
The Nunchuk (NK) is an extension of a WiiMote which is is composed of three accelerometers to determine an angular position, and measure lateral accelerations.
On a multicopter, the use of accelerometers allows to know precisely the angular position of the model.
With some mathematic used to associate gyroscopic sensors (DCM or Kalman like), it is possible to determine very quickly a PITCH and a ROLL angle.
This feature is used to have an auto stable mode which keeps the model in a horizontal attitude.
Like the Wii Motion Plus, the Nunchuk has also numerous advantages:
1) its cost
It is even cheaper than a Wii Motion Plus extension. We can find the NK extension for around $10 on ebay.
2) its dimensions
The PCB size of a Nunchuk is a little bit more important than a Wii Motion Plus one. But the component are still mounted is a flat position.
On some versions, it is also possible to cut the button circuit (unused for this project)
4) its I2C bypass mode
When a Wii Motion Plus is already connected to a WiiMote, the Nunchuk can be directly connected to the Wii Motion Plus in a « half bypass mode ».
It also communicates with WMP via a I2C bus.
In this mode, the Wii Motion Plus handles the communication and supply sensor values (from gyroscopes and from accelerometers) in an interleaving alternate way.
One benefit: the arduino has to handle only one extension, the Wii Motion Plus.
Arduino Pro Mini
Arduino Pro Mini card is a very small version of the well known classic Duemilanove Arduino. However, all possibilities remain the same. It now integrates an Atmel 328p and exists in several versions 3.3V/5V and 8MHz/16MHz. I chose the most convenient and powerful version : 5V / 16MHz
There is no more the USB connection for injecting a program, but it’s always possible to program it with a small USB-Serial adapter sold separately.
This board is the heart of the multicopter. It runs the software and interacts with everything: RC, ESCs, sensors.
Note that is is also possible to use other Arduino cards if they include an Atmel 328p running at 16MHz: Arduino nano , Arduino pro, Arduino Duemilanove.
Most Arduino clones should also work.
Arduino Pro Mini + Wii Motion Plus
Dimensions of the Wii Motion Plus are quite similar to Arduino Pro Mini card’s one.
This is useful for designing a small and homogeneous card.
The 2 PCBs are simply connected by four wires.
Wii Motion Plus extension is powered by the regulated 5V of the Arduino Pro Mini.
Digital PIN 12 of the Arduino is connected to VCC Wii Motion Plus.
This PIN is commuted just after the Arduino boot sequence in order to fiabilize the WMP initialization and in order to fast reboot the WMP in case of a blocking state.
(This power option is mandatory for some WMP which enter sometimes in a blocking state. It is still unexplained for the moment.)
The analog inputs A4 and A5 are connected via the I2C pins SDA and SCL.
(the photo describes the old way to power WMP via VCC and not PIN 12)
Arduino Pro Mini + Wii Motion Plus+ Nunchuk
Note that it is not mandatory to use a Nunchuk to operate the Multicopter described in this article.
It is mandatory only if you want to have an autolevel feature.
The software recognizes automatically the presence of a nunchuk connected.
Only 4 wires need to be connected between the WMP and the NK.
The relative orientation of the 2 PCB must be respected.
The WMP is connected to the Arduino exactly as described above.
The software is now able to handle also quad+ and quadX.
The configuration has just to be define by changing a line in the Arduino sketch (see source&code part)
Pure stabilized gimbal system
Orientation of the card must be respected (blue arrow)
To build a powerful multicopter, it’s best to feed the controllers in a star delivery configuration from the battery with wires of the same section and same length. Otherwise, they might not be fed uniformly, especially in case of high amperage.
A simple 4-channel receiver (no mixing) can be used for a gyro-only multicopter. The code is robust enough to support all brands.
(thanks to Berkely)
more information on Berkely blog here: http://www.rcgroups.com/forums/showthread.php?t=1340771
Configurable flight parameters
Once downloaded in the Arduino board, the software set the default settings during the initial start.
These settings are appropriate for a configuration similar to mine (motors / ESCs / propellers / weight)
However, another configuration will probably require other parameters to be optimal.
For instance, if you want to use a larger tricopter for FPV.
The multicopter uses a closed controlled loop to ensure its stability and manoeuvrability.
Like most multirotors, it is a Proportional-Integral-Derivative (PID) regulator.
This controller is translated into software code lines in the Arduino and tries to correct the error calculated between a measurement at the controller output (measured by the gyros) and an input set point (position of the stick), using appropriate action to adjust the output of the process (command to motors).
PID controller involves three separate parameters: the term Proportional, the term Integral and the term Derivative. The variation of each of these parameters alters the effectiveness of the stabilization.
Applied to a multirotor, the coefficients of these parameters can be translated by their behaviour:
- Proportional coefficient: alone, it may achieve stabilization. This coefficient determines the importance of action on the engines in relation with the values measured by the gyroscopes. The higher the coefficient, the higher the tricopter seems more « rigid » versus angular deviation. If it is too low, the multicopter will appear soft and will be harder to keep steady. One can « feel » this setting by handling the tricopter and trying to change its orientation: the higher the parameter, the higher the opposition is important. In practice, this parameter must be set alone and increased up to be the limit for obtaining small oscillations. If too high, the system becomes unstable by amplifying the oscillations.
- Integral coefficient : this coefficient can increase the precision of the angular position. In practice, when the tricopter is disturbed and its angle changes, the term Integral remembers the disruption and apply a correction to the engines to get the right angle. We can see this term as an heading hold factor. Typically if you take handfuls the multicopter and try to force it into a position, the engines will continue for some time to counteract the action. Without this term, the opposition does not last as long. This way, the angular position can be steady and accurate even with irregular wind, or during ground effect. However, the increase of this ratio often involves a reaction speed decrease and a decrease of the Proportional coefficient as a consequence. Compared to the conventional PID algorithm, I decided to cancel this term in the presence of strong angular variations. This strategy allows a safer behaviour in case of looping or hard shaking.
- Derivative coefficient: this coefficient allows the tricopter to reach more quickly the requested attitude. In practice it will amplify the reaction speed of the system, and in certain cases an increase of the Proportional term. By cons, this parameters induces more noise.
By default, at the first startup, the tricopter is initialized with coefficient values that should be quite ok:
The multicopter uses 3 PID loop with their own P I D coeeficients.
There are 2 ways to modify the values:
- The use of a specific combination of stick movements allows a sequential reconfiguration of these parameters with the help of a small LCD display. With this method, it is possible to quickly reconfigure the settings on the field, without even having to turn off the tricopter.To see the modified values, a small LCD screen can be connected.http://www.sparkfun.com/commerce/product_info.php?products_id=9394The LCD is not necessary when you know (and memorize) exactly what you are doing (advanced users only)
- With a GUI running on a computer and a conventional USB connection between the multicopter and the computer.
operating the multicopter
The following explanations are agnostic to the mode used. So it is relevant for both mode 1 and mode 2, the most commons.
Starting the multicopter
The engine launch is done by tilting the yaw stick right while having the throttle stick in minimum position.
For security reasons, the throttle stick must be set to minimum.
Now motors turn at an idle rate and the tricopter is ready for flight.
It is not necessary for the multicopter to be positioned flat, the angle does not matter.
Motor shutdown is done by tilting the yaw stick left while having the throttle stick in minimum position.
Gyroscopes and accelerometers calibration
To calibrate the neutral of sensors, you must tilt the yaw stick left, tilt the pitch stick back while having the throttle stick in minimal position.
The multicopter should not move during this stage. However its inclination has no influence if you have only a WMP (no ACC)
If you have a Nunchuk (ACC), the multicopter inclination should be as horizontal as possible during this step. This step must be realized at least once, the acc calibration is then stored in the EEPROM.
Start the LCD configuration mode
Tilt the yaw stick right + tilt the pitch stick forward.
This initializes the LCD if present, the LED flashes and the parameter P is then ready to be configured.
In setup mode, tilt the pitch stick back.
The selected parameter then changed sequentially and the number of blinking LED indicates which parameter is pointed.
1 blink = parameter P
2 blinks = parameter I
3 blinks = parameter D
The choice of parameter is indicated on the LCD by a highlighted character.
Change the value of one parameter:
In setup mode, tilt the roll stick right (increment) or left (decrement).
For the P parameter: the variation is in steps of 0.1, with a minimum value set to 0.
For the I parameter: the variation is in steps of 0.005, with a minimum value set to 0.
For the D parameter: the variation is in steps of 1, with a maximum value set to 0.
At each change the LED blinks
If we « count » operations, we can know the value of the parameter settings without LCD connected..
But we can quickly be lost if we made too many changes.
End of configuration mode
Tilt the yaw stick left + tilt the pitch stick forward.
The LED blinks again and tricopter returns in a state ready to fly.
It is now possible to configure and visualize main parameters with a GUI.
1) You must connect the arduino board to your PC via the USB connection (the same used to inject the software via Arduino IDE)
2) Once it’s done, you can launch the GUI, and then select the good PORT COM (the same used by arduino IDE).
3) Once it’s done, you have to wait some seconds to let the arduino boot and run the soft.
4) once the status led is OK (it should blink), you can press the STARTbutton to see the evolution of values.
5) you must READ the current parameters in the arduino before configuring it. Default values are set at the beginning.
For a very stable multicopter with a solid attitude, the PID settings must be set high. But if you want to do some acrobatics with these settings, the multi starts to wobble in fast translation or when you decide to shake it to much. One solution is to decrease the PID, but it is to the detriment of static stability.
So instead of implementing a switch between 2 PID settings, there are now 2 options in the GUI to define the way we should decrease PID, depending on ROLL/PITCH/YAW stick deviation
- The first boxes defines the rate of cancellation of the nominal PID (the one which is used on neutral ROLL/PITCH/YAW stick position) in relation with ROLL/STICK/YAW deviation. In fact only P and D parameters are impacted in the transformation. The purpose of this curve is not really to gain more stability, but to gain more maneuverability. 0 = soft rate (for FPV or beginners); 0.4 = soft acro ; 0.7 = fast acro ; 1 = insane rate
- The second curve is defined by 3 segment: [1400;1600] [1600-1800] and [1800;2000] and defines the rate of cancellation of the nominal PID (the one which is used on neutral ROLL/PITCH stick position) in relation with Throttle stick. The purpose of this curve is to gain more stability when you are in a situation to use more throttle than needed to just maintain a lift. This is typically the case in fast translation.
If you are not familiar with this, just keep the default values.
Some pictures of the first TriWiiCopter
|Motor||3x Hobbycity Turnigy 3020 Brushless Outrunner Motor 1200kv|
|– alternative motor||3x Hobbycity Turnigy 2204-14T 19g Outrunner|
|controller||3x Hobbycity Hobbyking SS Series 8-10A ESC|
|– alternative controller||3x Hobbycity Turnigy Plush 10amp 9gram Speed Controller|
|LED||1x Hobbycity Turnigy High Density R/C LED Flexible Strip-Green|
|Propeller||3x Hobbycity GWS EP Propeller (DD-7035 178x89mm)|
|Servo||1x Hobbycity Turnigy MG90S Metal Gear Servo 1.8kg|
|Battery||1x Hobbycity Turnigy 1300mAh 3S 25C Lipo Pack|
We can of course take a different configuration for a larger tricopter.
Internet is full of examples.
One example of several working setup: http://warthox.bplaced.net/?page_id=76
Here is a consumption/thrust measurement realized by Joël on the current setup:
Source Code & GUI
MultiWiiCopter Arduino code and GUI (source + exe):MultiWiiV1_5
One directory contains the Arduino sketch, and the other contains the GUI.
This code won’t compile, you have to uncomment first one of this two lines depending of your ESC type:
//#define MINTHROTTLE 1310 // for Turnigy Plush ESCs 10A //#define MINTHROTTLE 1120 // for Super Simple ESCs 10A
The servo correction can also be reverted for tricopters by editing this line:
#define SERVO_DIRECTION 1 // if you want to reverse the gyro yaw servo direction //#define SERVO_DIRECTION -1
Compatibility between options/setups:
Thanks to numerous examples found on the Internet, I developed this app.
To my knowledge, there are some new and reusable parts (radio interface, LCD interface, the servo control).
I would like to share this code and spread it under the GPL licence so that it serves other, directly or indirectly in a tricopter or for other projects.
It’s thank to this approach that the open source community Arduino has developed so fast.
The limits of memory and power the Arduino used here are not reached, and the number of I/O remains large enough to integrate a lot of other sensors, magnetometer, accelerometers, GPS, altimeter, ultrasonic sensor, …
My goal here was to make a minimalist tricopter, acrobatic oriented.
I also hope that one day someone will publish an algorithm that is able to adjust the optimal settings automatically. I know it already exists, but it’s not in public domain.
Where to find the components
The arduino pro mini, USB interface card and the LCD are available at sparkfun.
Wii Motion Plus extensions are widely available on ebay.
The RC elements are all available at hobbycity.
1) Some times, the gyros seem to be inefficient or erratic
There are a lot of copies of WMP in circulation on ebay. (at least 4 different types) They are working pretty well, however the electronic used to handle Invensense gyros differs.
There are several things that can be done to decrease bad inits:
- add pull up resistances on the I2C wires. There are already pull up resistances in the atmel 328p, but in some case (long distance, noisy environment) they are not low enough.
- decrease the voltage. WMP are normally powered under 3.3V. 5V is ok because there is an internal regulator, but at 3.3V, it seems to work better
- WMP uses fast I2C mode at 400kHz. In some cases, especially for original WMP, this increase the rate of bad inits. A corrective way is to leave I2C rate in normal mode: comment/uncomment the line in the sketch dealing with I2C speed.
Hopefully, in many cases, there is no problem at all regarding the WMP initialization.
2) Why it is important to define the minimum running value for the ESCs
The motors should always run whatever the situation in flight:
- ESCs and motors are not perfect and does not synchronize every time at the beginning. If this happens in the air, one motor won’t be able to spin and I let you imagine the situation 😉
- Gyro-induced corrections can put a ESC in a situation where it is under its running limit (motor stop). It should not be important because it lasts a fraction of second and propellers have some inertia. But I observed a very annoying behavior with Turnigy Plush ESCs: once it is below the running limit, the ESC reaction time to return into the running range is very high, causing crashing oscillations.
If you choose another ESC, you have to tune this “minimum spinning value”. Once armed, if tricopter motors are not running, this value must be changed.
This parameter is very important and has to be edited to compile arduino code.
3) I can’t arm the motors
Each channel on the TX should be configured to have a full range (for a PPM signal, that is to say [1000;2000] miccro seconds). For Graupner/JR radio, it implies an ATV of 125% for all channels. If this value is too low, the arming level value can’t be reached on the yaw channel, and it’s not possible to arm the tricopter.
4) Be sure your ESC can support PPM with 490Hz refresh rate.
It is the case for low cost SuperSimple and Turnigy Plus ESCs. Note the refresh rate is not tied to the cost of ESCs 😉
5) Choosing another ESC/motor/propeller
- the propeller should be are light as it can be. GWS SF is a good choice in every dimension
- for a given consumption, the proportion pitch/diameter should be the lowest (10×3.8 is better than 10×4.7. And 10×4.7 is better than 8×6)
- motors KV should be low. It’s better for the efficiency and for the spinning resolution.
6) Arduino seems to operate well (LED blinking), but impossible to connect the GUI
If you are using windows, the port COM needs something to be reconfigure to run at 115200Hz.
7) Nothing happen at all
It is maybe because you are using an Arduino clone which does not have exactly the same characteristics as the pro mini.
8) One motor stops suddenly in a flight
It may occur if your are using Turnigy Plush ESCs in soft mode. These ESCs must be set in MEDIUM or HIGH mode.
9) I’m not a programmer nor an electronics. Is it difficult to build and setup ?
My job is not related to this too.
If you have a PC, you can do it and understand the main things in few hours.
Arduino is very documented, especially for people who are not specialists at all.
You can first read this page to begin in this environment and learn how to upload a code in a board.
I advice every beginner to read the excellent blob of kinderkram here:
It’s a « step by step » construction approach
10) There is a post on rcgroups forum here:
Don’t be shy, your MultiWii video are welcome 😉
You can also read the MultiWii addtional FAQ’s wrote by berkely: