tisdag 6 mars 2012

Multiwii Airplane


How to setup a Multiwii Airplane and FlyingWing
                     updated 2014-10-18


Airplane uses same Hardware as a MultiWii copter.
Arduino PRO MINI. 5V 16MHz, ProMicro or Arduino  Mega.
- Gyro
- Accelerometer
- Mag (Optional)
- Baro (Optional)

Start with a trimmed suitable plane.
Dynam EZ-Hawk was my choice but any airplane will work.












Connect servos to the Arduino.
To use D7 on Mega boards you need to use MWii V2.4

And in Config.h comment
//#define MEGA_HW_PWM_SERVOS
Otherwise Servos will be on different pins look in config.h for pinnout info.















My Installation
Sensors work best if mounted as close to CG as possible.
I use multiple layers of double-sided foam tape.












This picture is old and need  to be Updated.

******************************************************************************** 
Setup Transmitter
Set TX channels to full rates it should reach between 1000-2000µs in the Gui.
Failsafe function will recognize it as abnormal input if Rates reach below 1000µs .

 If you push both sticks in upper right corner all channels should show 2000 in gui.
Correct the servo directions in the TX.
Results is the same in both Mode1 & Mode2










******************************************************************************** 
Setup Servos
Gyro or Acc assisted Mode.
Check if Gyro move servos in right directions.
Lift a wingtip and Aileron goes up.
Lift the tail and Elevator goes up.
Rudder moves in same direction as the tail.

 Use the Servo Tab in Gui to Change Servo directions.










The Servo Tab looks a little different for FlyingWings.
Servos connect to same Wing Servo pins as the Airplanes
Adjust Midpoint and the endpoints.
The elevons can be reversed for each function.











Setup in PassThru Mode.
Set all TX trims to zero and check the value when the sticks centers.
If it's not 1500 change #MIDRC to your Midrc in the code.
* Use the Servo Tab in Gui to adjust  Servo Offset to center the Control Surfaces.
   Adjust mechanically on the linkages to keep offsets as small as possible.
* Set the Servo Rates to maximum recommended for the model.

Remember to press Save button before exit!..







It's also possible to export the servo settings.
Press the Save to file button to save Servos.txt in
same folder as MultiWiiconfig.exe

This settings can be pasted in Config.h and you will not loose
the settings if you reset PID's.

******************************************************************************** 

Issues With Rudder


If you experience weird function on the rudder.
And the rudder "Drifts" and becomes offset in gyro and Level modes.

Rudder have a tendency to try to hold the heading during Aileron/Elevator turns.
It can make the plane fly Sideways and other strange phenomena.
The cure is to Set YAW_I = Zero.

******************************************************************************** 

The settings is done  in  Config.h .
=========================


#define MAXTHROTTLE 2000 
Because you  want Full Power sometimes!


Mwii uses 1850 for MultiCopters.


Flaps Settings
Conventional Flaps
Using servo[2]  (A2 on ProMini )
//#define FLAPS                         // Enable Flaps .

Select channel to control flaps
with the AUX buttons to the left.

Set endpoints and direction.




Flaperons
//#define FLAPPERONS          AUX4              // Use Aileroins as Flaps .
#define FLAPPERON_EP   { 1500, 1700 } // Endpooints for flaps on a 2 way switch
#define FLAPPERON_INVERT             { 1, -1 }       // Change flap direction

Make flaps move slow Higher value is Higher Speed. Effects Both types of flaps.
//#define FLAPSPEED     3            
********************************************************************************

Flaps (Flaperons)*
Select a channel to control your flaps with.
Endpoints is the preprogrammed positions for the flaperons 


Endpoints for flaps can also be programmed in the TX .
Then set FLAP_EP  { 1020, 2000} in the code.


Servos
Totally 8 servos is available.
Default mix uses.
2 Wing servos
1 Elevator
1 Rudder
1 Throttle servo or esc.

A0 & A1 can be used for a gimbal.
A2 Is used for conventional Flaps or Camera trigger.

Acc Calibration

Place the plane on a stable surface.
Vings Level with nose in expected Attack angle for level flight.
Normally a few degrees up.
Memorize the planes  attitude in flight this should be Level for Acc.


Passthru
Sends Rc commands direct to servos.
No influence from sensors.

Gyro Mode (Acro)
This is "Normal" mode when nothing else is selected.
The plane should compensate for movements. (Wind Gusts etc)
The plane feels stable and locked in but still able to loop & roll.
Stall speed is lower and it can be necessary to "Push" it down in landings.

Stable Modes
  With the sticks centered the plane will self stabilize.
  Returning to level flight from almost any situation.
  Provided there's enough Altitude for recovery.

Horizon Mode Allows rolls and loops. Levels with centered sticks
 This is a comfortable flight mode for FPV.

Angle Mode also limits how much the plane can tilt.
 Gives a Stiff feeling and is only recommended for beginners.

Preflight setup
After you have changed the servo Rates
you can set Dual rates and Expos in the Transmitter.
Engine must be Armed to prevent motorstart by accident..
It can be Armed from AXU-channel if it's setup in the gui . (recommended)
Or with stick combination min throttle & max rudder.


First Flight.
Take of in Passthru.
Switch mode on safe height.
Activate Assisted modes and feel the difference.

Level-P value will Reduce the maximum throw in Level-Mode.


GyroSmooting
If the gyros feels very sensitive (Hysteric).
Activate LPF filtering for the gyro. 42 Hz or lower is a enough for planes.

In bad cases use GYRO_SMOOTHING 
#define GYRO_SMOOTHING {20, 20, 3} // separate averaging ranges for roll, pitch, yaw.
Values must never be below 1.

(*)
Flaperons:
A mix where ailerons also works as flaps  for simpler models without separate flaps.

35 kommentarer:

Unknown sa...

Can you show how the gyro is mounted in the plane?

Thanks,

Steve
http://www.ilovefpv.com

Magatixa sa...

Thanks for the tips!

Worked fine with me!

Links:

http://www.multirotores.com.br/forum/topics/multiwii-para-aviao-e-helicoptero

and

http://www.e-voo.com/forum/viewtopic.php?t=136265&highlight=

Kai sa...

I am not shure about the connection of servo[0] to servo[3] as you write D34/44, D35/45, D33/46 and D37.

Normally (e.g. for octocopters) multiwii uses Pins 7, 8 9 and 10. (addtitionally to 2,3,5,6).

Thank you
Kai

Patrik sa...

@Kai
From def.h
pinouts for Mega
SERVO_1_PINMODE pinMode(34,OUTPUT);pinMode(44,OUTPUT);
SERVO_2_PINMODE pinMode(35,OUTPUT);pinMode(45,OUTPUT);
SERVO_3_PINMODE pinMode(33,OUTPUT); pinMode(46,OUTPUT);

Thats what i followed for the guide.

Frank sa...

Hey Patrick

I went to the complete story of the multiwii forum and would like to thank you for all the work you did !

1 question though..

Can you please give me a direct link to the version you advise to load as I see so many different version and am confused..

Cheers,
Frank NL

Patrik sa...

@Frank
I'm glad you like it..

Near the top of the page i link to the MWii downloadpage.
Use the latest ver.
At the moment V2.1.
If you use a MEGAboard you need to use the dev verion r1143 or newer.

http://code.google.com/p/multiwii/downloads/list

Unknown sa...

Hej Patrik

Jag har använt mig av dina guider när jag försökt montera MW i mitt Easystar 2.

Jag använder mig av en Pro mini med en GY-86 och i2c gps och FW_Nav_1140402.

Jag har haft problem med bla vibrationer men jag tror dom problemen försvann med hjälp av gyro smoothing/filters.

Planet ser ut att fungera som det ska när man testar på marken men i luften uteblir funktionen.

När jag slår på Horizon så vet man aldrig vad som händer, ibland s tvärdyker planer eller/och svänger kraftigt.

Ibland så flyger den rakt men när jag vänder med hjälp av rodret blir det samma sak när planet ska gå rakt igen.

Blir inte riktigt klok på av som kan vara fel och tar genvägen och frågar dig om råd.


M.V.H Richard Särenfors

Patrik sa...

Hej Rickard,
Skumma saker kan "Reparera" sig själv om man Rensar Eeprom när man Lägger in ny Version.

För mycket Smoothing kan ge långsamma reaktioner på servon.
På en Easystar borde du klara dej utan smoothing om propellern är balanserad.
LPF för MPU6050 på 42hz eller lägre brukar vara bra att starta med.

Om du aktiverar RTH så kommer liknande saker att hända när GPS tar över.
Med enbart HORIZON aktivt ska planet flyga rakt om Accelerometern är kalibrerad rätt och Sensorerna sitter fastmonterade i planet.

Patrik

Unknown sa...

Hej

Jag har märkt det du säger ang. EEPROM och har nu mera för vana att göra en rensning innan jag lägger in ny sketch.

Jag har stänkt av smootning efter jag skrev förra gången och har LPF på 10Hz för att inte få fladder i servona. Jag använder original proppen som jag inte tycker andas kvalité'.

Som det är nu så flyger den rätt bra men man vet aldrig hur den beter sig när man slår på eller svänger med horizon aktiverat.

Jag måste flyga rakt en stund (typ 5 sec) innan jag lår på horizon för att den ska fortsätta flyga rakt.
Svänger jag för snävt så den får för brant pitch så håller den kvar den och dyker tills jag inte vågar mer och slår av.

Slår jag på direkt igen dyker den direkt men om jag flyger rakt en stund så går det bra.

Går det att stänga av yaw direction när man använder horizon. Dom kraftiga svängar jag beskrev innan beror på att den försöker komma tillbaka till riktningen jag hade förra gången jag slog på horizon med kraftiga roderutslag som följd.

När den flyger som den ska kan jag göra kraftiga utslag på pitch och roll utan att planet dyker.

GPSen har jag bara provat på skoj men den har ingen prio i detta läget.

Richard

Patrik sa...

The result of the comments in Swedish.
Rudder have a tendency to try to hold the heading during Aileron/Elevator turns.

The cure is to Set YAW_I = Zero.

Unknown sa...

Hi,
it seems the download link ist not working. Can you please check and update it ?

THX

Patrik sa...

Official Download for MWii have been moved.

The link is now corrected.
Thanks.

Jonathan sa...

Hi, sorry I'm new to this purchase a MultiWii (HK_MultiWii_328P Also labeled "Hobbybro" on the back. ITG3205 + BMA180 NMC5583L + + + BMP085 Spektrum DSM2 Connector Satellite) and I can think of a problem, once and everything is connected, the engine does not react. Now check the config and MultiWii if it receives the signal from the radio, this only happens when the engine because the servos work correctly.
Might you help me or tell me I need to read; I'm not very good programming but if a bit.
In advance thank you have a nice day

Patrik sa...

There's a safety built in to prevent motor from starting.
You need to ARM it.
Use a AUX switch you select in Gui.
Or with Throttle Low + Yaw Right at same time.

Acc must be calibrated.
BaroMode must be off.

Unknown sa...

Hello Patrik,
i saw that you know more of all others users about airplane config of wii boards. I'am beginner in it...
I'am not programmer, but can understand and repeat algorithm of howto.
I understand the general principe. But I have no the same board (http://hobbyking.com/hobbyking/store/__27033__MultiWii_328P_Flight_Controller_w_FTDI_DSM2_Comp_Port.html) that you have and i have no file of config for airplane...
Can you help me to find the correct file of config for easystar (with 4 servos: 2 wings servos, pitch and yaw)and help to connect all the pins from Rx to board and from board to servos...
I will be really thankful for you help!

Patrik sa...

Hi Andrey
I don't have any ready configfile.. sorry.

But your FC should be define as
#define AIRPLANE
#define CRIUS_SE
The rest of the information can be found on this page.

If you use a RX with one cable /channel follow this diagram.
http://radio-commande.com/wp-content/uploads/2010/06/quadX.jpg

You can also find other generic info on MWii Wiki
http://www.multiwii.com/wiki/index.php?title=Main_Page

Dedy Hermanto sa...

Hi patrik,

I'm new using multiwii on fixed wing.
Did i correct had connection on my delta wing.
D12: Right Wing
D11:Left Wing
D9: throtlle
But i still confused till now, i only could use throtle when i actived althold, mangneto and level. And throttle only actived when i had move my throttle stick more than 50% and motor start spinning.
But when althold, level and magneto deactived my motor stop spin.

Patrik sa...

Hi,
You must ARM the FC to get the Motor to spin.

Althold, mangneto should never be used on airplanes!..
They are just for copters!

The functions is included in the GPS routines for planes.

Michael sa...

Hi! Can anybody say how to change throttle output pin?
I have FWing conf with throttle on D9
it is possible to change it on D10?
And maybe change CPPM input from D2 to D13 or some other pin from this side of PROMINI board is possible too?

Patrik sa...

Hi here is some hints..

In def.h
#elif defined(AIRPLANE)
......
change to 2 motors to make both D9 & D10 to work as motors.
#define NUMBER_MOTOR 1

In the mixer part in output.cpp

#elif defined( AIRPLANE )

Add the second motor output

motor[0] = servo[7];
motor[1] = servo[7];

You will loose the elevator servo output so you have to change the mixer.
// Assisted modes (gyro only or gyro+acc according to AUX configuration in Gui
servo[3] = (int32_t) axisPID[ROLL] * (500 - (axisPID[ROLL]<0 ? -flapperons[0]: flapperons[0])) / 500 + flapperons[0]; // Wing 1
servo[4] = (int32_t) axisPID[ROLL] * (500 - (axisPID[ROLL]<0 ? -flapperons[1]: flapperons[1])) / 500 + flapperons[1]; // Wing 2
servo[5] = axisPID[YAW]; // Rudder
servo[6] = axisPID[PITCH]; // Elevator

Remember to change in PASSTHRU_MODE too.
PPM is on a interupt pin so it's harder to move.

Good luck
/Patrik

Marian sa...

Hello.
Can you help me ...
I did this assembly but for the plane and I encounter the following problem ... the signal for ESC does not PPM and does not change depending on the acceleration ..

Thank you in advance..

Patrik sa...

Hi Marian,
The motor is in "Throttle Hold" to prevent start while handling it on ground.
Like the copter code the plane also need to be ARMED.
Otherwise the PWM signal to the motor is set to MinThrottle normally 1000ms.
Look at the Preflight setup part.

Marian sa...

Hi Patrick.
Thanks for the reply.
In the meantime, I managed to arm, after many attempts, only the check on AUX1-MID solved the arming, but ... it always remains armed. How can I mount a switch to arm - disarm ...!

Respectfully.

Patrik sa...

Hi Marian,

Normally i check the box for ARM on AUX1.
On my TX that's a 2 pos switch.
Before motor start you have to lower throttle to MIN.
Same to make it stop.
After AUX is switched the motor will be Amed/Disarmed until throttle is all the way down.<1100 as default i think

/Patrik

Marian sa...

Hello.
I read many of your posts on different forums and I learned.
Translating with google, maybe I wasn't so explicit..I started the project from here ... http: //electronoobs.com/eng_robotica_tut4_2.php ... in the files posted by him are not set AUX1-2-3- 4 and says nothing about arming-disarming.
The only position in which it is armed is AUX1, but it remains armed.
I found it in the MultiWii-Def.h settings, but the pins do not match what is in the project ..D3-YAU, D9-Throtle, D10-Pitch, D11 + D12-ROLL, I don't understand how they were set ...! , for reinforcement - disarm Arduino Nano is not, only Mega and others ...
I will try to configure in the Tx-Rx on which pins the switch must be mounted ... AUX1-4 ...

Patrik sa...

Hello,
The Radio code in the link only supports 4 channels.
You will have to expand it with more channels for AUX switches.

Then in the MWii Gui you set the modes for the AUX channels.

Or you can ARM by holding THR low and YAW right.
Disarm Yaw Left.

Marian sa...

Hello
In the meantime I modified the tx-rx for 8 channels, 4 analog, 4 digital.
The receiver outputs in PPM sum all 8 channels
Multiwii Gui still works ..analog-digital, but .... does not arm with trottle and yaw and ..physically Arduino MultiWii board, no AUX 1-4 output.
Note...
Throttle works from 1.2ms to 1.8ms, and Yaw the same ..
can it influence that it does not work from 1 to 2 ms?
It may not work arming-disarming, because of this ...?
Is there anything that can be done?

Marian sa...

I solved the problem with the disarm arming, the one with the pin setting for AUX 1-4 remains ...!

Patrik sa...

Hi Marian,
The code is written for a channel range 1000-2000.
your smaller range is absolutely a problem.

The AUX pins don't have any output pins for servos.
They are only input to the flight controller.

You can modify the code to address outputs.
It need add outputs in mixer in output.c

servo[3] = rcCommand[ROLL] + flapperons[0]; // Wing 1
servo[4] = rcCommand[ROLL] + flapperons[1]; // Wing 2
servo[5] = rcCommand[YAW]; // Rudder
servo[6] = rcCommand[PITCH]; // Elevator

For example.
servo[n] = rcCommand[AUX4];
You can also change the input to the other servos here ex if you use only one Aileron servo or no rudder.
Remember to add in Passthru mode to!..

/Patrik

Patrik sa...

I guess your 1.2ms to 1.8ms range depends on the joystick calibration in the TX code.

Marian sa...

Hi Patrick and respect.
Yes, the problem with arming-disarming, I solved it by changing the values in TX (as I suspected and you said in the post) now, to see how I solve it with AUX ... as you said ...
I studied through output.c but I didn't know how to modify ...
I am 65 years old, but ... the electronic passion and the stubbornness to solve ... does not let me give up. I made 4 cars with RC for my grandchildren according to the electronoobs site ...
Sorry if you don't understand everything ... Google Translate.

Thanks for your patience and ... lessons ...

Marian sa...

Hi Patrick
I don't think I explained well.
I want the Arduino Multiiwii board to output digital signal, not pwm,
Ex = D4-D5-D6-D7> 0v-5v
I have switches on Tx, MultiWii Gui sees them, on off.
Can it be set in Output.c?
A good day !

Patrik sa...

Hi Marian,

I think that will be difficult to do in the MWii code.
MWii only output PWM code for servos or ESC.
There are switches you can control with pwm.

But i would modify the RX module code to act on the AUX channels instead.
Something like this in void setPPMValuesFromData()..
if (data.AUX_1 < 128)
{digitalWrite(anyDigitalPin, LOW)}
else
{digitalWrite(anyDigitalPin, HIGH)};

Just remember the Arduino pin can only handle ~50mah or something.

/Patrik

Marian sa...

Hello.
Thanks for the reply.
After I posted, I came up with the idea of how to solve it much easier. The receiver outputs PPM sum, I put a decoder with CD 4017 at the output and I have all the 4analog + 4 digital signals there ... decoded ... so I can put there the outputs controlled by the switches in Tx.
If I have any further questions, I hope you will help me again.
Thank you again
A good day !

Marian.

Marian sa...

I forgot to say ... I measured the oscilloscope signal on Multiwii, at the input on D2 is PPM sum, at the output YAW, ROLL, PITCH is also PPM. Throttle can be PPM or PWM ... from the settings.
A good day !

Marian.