Help please! How to make to board know it's a tri not a quad, Multiwii

Saschafi

Junior Member
Hey guys so this is my first build and I am basing it on Davids tricopter build. I got a Multiwii from hobby king and I am confused on how to make it so it knows it's a tri not a quad. I have the Multiwii GUI but I seems I need something else because there are no options in the software to change type or layout.
http://www.hobbyking.com/mobile/viewproduct.asp?idproduct=27033 this is the board I have.
I downloaded Multiwii 2.3 and it recognizes the board and reacts to changes in position.
Please help. Thank you
 

mmeyer

Senior Member
You will have to open up the 2.3 firmware in the aruino environment and go to the file 'config.h'. In here nearish the top there should be a long list of define statements for what type of multicopter is set. All you have to do is take away the '//' in front of TRI and add '//' to QUAD-X. You will then have to reflash the board with this altered 'config.h' file. Don't know if i explained that very well but that is the process I went through to do it.
 

jhitesma

Some guy in the desert
Mentor
You'll also have to set the correct DEFINE's for the board you're running any any other options. I have no clue what the default firmware on a HK board would be set to but it's a good idea to go through the whole config.h file and make sure everything is setup the way you expect. It's a big file and somewhat intimidating - but thankfully mostly well commented.
 

jhitesma

Some guy in the desert
Mentor
You'll have to open the full "sketch" in the arduino environment, hook your board up through USB, select the correct board type and com port (the onbord FTDI will show up as a virtual com port) in arduino then use the upload function in arduino. Since that's a '328 based baord "Arduino Pro Mini" should work as the board type. But I have no experience with that exact board and don't know it's full details so I can't say 100% for sure which board type you'd need.
 

Saschafi

Junior Member
can someone please give me a step by step. Think total rc newb, I can find the programs but have no real idea what to do with them once i have them, I can find the config file in some versions of multiwii but not in others. The config application seems useless when it comes to changing the multiroter type. I am sorry for being useless but i am trying to get into the hobby and this is really frustrating. I would of gone with a KK board but they were all sold out and not even "backorderable"(bixlered that word). I dont know what most of the things in the config file even mean and it always says error when i try to verify it. Thank you so much for any help.
 

jhitesma

Some guy in the desert
Mentor
I'm not very good a step but step but I'll do my best.

The config is useless for changing copter type, that has to be done in the config file before uploading the firmware with multiwii. This is due to the number of things MW supports and the limits of the low end chips it can run on. So each firmware load has to be customized before being flashed to a board.

Finding config.h in the 2.3 version of MW can be a bit trickier because the code is spread across so many files it's no longer right there in the tabs when you open the sketch in the arduino IDE. However the info in the default MultiWii.ino file does say: "Maybe that tab is not visible in the list at the top, then you must use the drop down list at the right to access that tab." So the info is there if you read...just takes a lot of reading.

Anyway. My best attempt at a step by step assuming you've got the arduino software installed and working:

1) Double click on the MultiWii.ino file - it should have the arduino logo for an icon.

2) At the far right of the tab bar in the Arduino IDE is a little black arrow pointing down. Click on it and scroll down towards the bottom where you should find 'config.h' - select it.

3) Read through the entire config.h file. Don't change anything, just read it at this point. If something confuses you there's more info available in the MW wiki here: http://www.multiwii.com/wiki/index.php?title=Config.h

4) Once you've read through it and feel you have a good handle on it all give yourself a pat on the back - you earned it!

5) If you got stuck on 3&4 don't panic. 90% of the stuff in there you won't need to mess with. However some of the settings will require knowledge about your specific board. Thankfully however it looks like there is a default setting for your board so that should handle the most difficult bits. If you get overwhelmed take a look at all those other files in the multiwii 2.3 distribution, go ahead scroll through a few there are comments that try to explain what's going on. Crazy huh? Good news is you don't need to mess with any of those! That's all the hard work that's been done for you. So if you start to feel overwhelmed in the config.h file just think of all those others and what the guys maintaining this software deal with - I find it helps make the config.h feel a lot less intimidating having that to compare it to :D

6) ok, let's dig in. Basically in the config.h line any line starting with a // is a comment and will be ignored/disabled. So what you need to do is go through it line by line and find the options you need for your board and enable them by removing the //. The config.h is broken into several sections as explained at the top:

* 1 - BASIC SETUP - you must select an option in every block.
* this assumes you have 4 channels connected to your board with standard ESCs and servos.
* 2 - COPTER TYPE SPECIFIC OPTIONS - you likely want to check for options for your copter type
* 3 - RC SYSTEM SETUP
* 4 - ALTERNATE CPUs & BOARDS - if you have
* 5 - ALTERNATE SETUP - select alternate RX (SBUS, PPM, etc.), alternate ESC-range, etc. here
* 6 - OPTIONAL FEATURES - enable nice to have features here (FlightModes, LCD, telemetry, battery monitor etc.)
* 7 - TUNING & DEVELOPER - if you know what you are doing; you have been warned
* - (ESCs calibration, Dynamic Motor/Prop Balancing, Diagnostics,Memory savings.....)
* 8 - DEPRECATED - these features will be removed in some future release

More good news. You're probably not going to have to mess with section 5/6/7/8 at all and even section 3/4 will only need minor tweaks, section 1 may not need any and section 2 should just need two lines changed.

Side Note: There are actually two ways to make comments in this file that you'll see. There's the shorthand // which tells the compiler (the compiler is the program that takes this "human readable" code and turns it into code the chips on the board can understand) "everything after this point on this line is a comment and should be ignored". Then there are "block comments" which start with a /* and end with a */ For those they say "Everything between /* and */ should be ignored even if it's on multiple lines.

Now I don't know the details of your RC system so I'm going to assume you're running a simple 4 channel PWM setup for now. This is basically normal 4 channel RX with one wire for each channel. (PPM/CPPM/Sbus/spektrum sat are other options that let you run multiple channels on one wire for cleaner simpler wiring - but I'm assuming you're not using them.) Additional channels really help so you can change flight modes - but we can deal with those later once you're up and running.

Alright were were we...7? Something like that. Let's not stress over the numbers. There are enough numbers in the config.h for all of us so I'll just drop the formality at this point and try to help you through the config.h section by section.

Section 1 Basic Setup:

Hey, here's the bit you're most interested in right at the top. Copter type! The default is quad so the line that says "#define QUADX" is uncommented. But we don't want that. So go ahead and put // in front of it. If you're a stickler for formality then you can use spaces to make sure it lines up with the others. But arduino isn't a stickler for that kind of thing so you can just put the // right at the very beginning and it will have the same effect (and give you a visual clue as to what you changed when you look at this in the future.) But you do want it configured for Tri. So go back up two lines to the line that has " //#define TRI" on it and remove that // at the beginning leaving just " #define TRI"

Phew, we're done all changed for tri now right! Well... It is changed from quad to tri now but we've got to check out the rest of the config to make sure it matches your board and setup. So let's move on to the next section.

Motor minthrottle/maxthrottle/mincommand - these all depend on your ESC's and radio setup, the comments explain it better tan I can but you probably don't need to actually change anything here.

I2C settings. This is the protocol the processor on the MW board uses to talk to it's sensors and there are two things that may need to be changed. Speed I'm fairly sure you should have the "#define I2C_SPEED 400000L" line uncommented for the sensors on your board. If you get a bunch of I2C errors in the config program after flashing...then you may need to change it to 1000000L instead but I'm pretty sure only the old original WMP sensors from an actual Wii motion plus need that setting. The other setting is pullups, and again I don't now the specifics of your board but I'd be pretty shocked if it needed the internal pullups so that line should most likely be commented out. Again if you get a bunch of I2C errors after flashing you may want to try changing that - you won't hurt anything by changing it but trying to fly with a bunch of I2C errors won't work since it's a sign that the processor and the sensors can't talk to each other.

Next is where you set the type of board you have. For yours you want the line "#define HK_MultiWii_328P" uncommented and ALL other options commented. (i.e. only one choice should be uncommented)

The next section is for indepenent sensors. You don't have any. So you can make sure everything in this section is commented out.


Hey that's a whole major section done! Woo Hoo we're 1/8th of the way there! Let's move on to Section 2 "Copter Type"

Go ahead and read through this section but chances are you won't have to change anything. There's an option to use a new experimental PID controller...you don't want that so just leave it set to 1. YAW_DIRECTION isn't actually used anymore so you can ignore that. ONLYARMWHENFLAT is a good one to leave uncommented for safety, it does what it says and prevents you from arming the copter if it's not flat. You can disable it if you want to live dangerously and be able to arm while holding the copter crooked or something crazy like that.

The ARM/DISARM section you should make sure one section is uncommented, ALLOW_ARM_DISARM_VIA_TX_YAW is the most common and means you use zero throttle and full right YAW to arm and zero throttle full left YAW to disarm. You could use the other option and then it's the roll stick instead of the yaw stick if you like to roll that way.

Servos - ok, you're a tri so you've probably got some servos and will probably have to change somethign in this section. Unfortunately I can't help you here as I've yet to do a tri. I have setup a flying wing with MW though and it does have servos and I didn't need to enable anything here. But your tail servo is probably a bit more expensive than my 9g wing servos so you may want to read up on this and set some limits so the board can't try to push your servo too far and break something. Sorry I can't be of more help with this part.

The rest of this section is stuff for gimbals, planes and helis. You're not messing with any of that yet I hope so you can just ignore it or make sure it's all commented out if you really want to. (since it doesn't apply to a multi you don't have to comment out things that uncommented by default...but it doesn't hurt to.)

2 sections down and we're past the hardest parts! Let's tackle section 3 "RC System"

What's this note at the top? " /* note: no need to uncomment something in this section if you use a standard receiver */" Hmm, well I did say I'd be assuming you're runnign a standard 4ch setup with each channel on it's own wire so that's us! Cool, we can skip this entire section! If you're looking to use that DSM port on your board though you'll have a bit of reading to do. Again I don't have your exact board and don't have any spektrum stuff that would apply so I can't really help with that if you're looking to set it up - but the comments are pretty helpful and there's always the multiwii forum.

So...Section 4 "alternate CPUs and Boards". Well, your board counts as a promini since it's using the '328 chip. But you're not flying a hex so the first option doesn't matter, and I said I'm assuming you're not messing with extra channels yet so the Aux2 stuff we can ignore as well. (you may want to come back to it later...but I can't really help you too much since I don't now your board well, the comments/files on HK will be your friend here most likely when you are ready to setup aux channels. At at least for now you will be able to use AUX1 on ch5 if nothing else.)

The rest of Section four you can skip unless you know it applies to you. Halfway there and it just keeps getting easier! Section 5 "Alternate setup" Well...we're not doing anything fancy today so we can actually skip all of this as well and leave it as defaults. Easy Peasy!

Section 6 "Optional Features". Optional eh...sounds like we can skip it! Except...you should make sure "FAILSAFE" is uncommented or risk going through what I did and loosing your multi if your RF link goes crazy. Settings for failsafe are explained fairly well, basically it tells the board what to do if it suddenly stops getting a signal from your TX.

One other optional feature you may want (but probably don't) is DEADBAND if you want a deadband around the center of your sticks. If that's your cup of tea then go for it, but if you don't KNOW that you want it...skip it.

The rest of the optional features are just that "optional" and I'd say get up and flying before you start messing with things like buzzers and voltage monitoring if you're going to try and tackle them.

The rest of the file is all optional and development stuff that you don't need at this point so you can ignore it.


There you go, your config.h is setup! So let's save it "File->Save" or "Ctrl-S"

Now let's connect your board. Actually...you probably should have connected your board before starting arduino so it would be detected. Assuming your reading this before trying it do that. If not then you'll have to exit arduino and re-open the sketch after hooking your board up via USB. Now let's tell Arduino how to find your board. go to "Tools->Board" and select "Arduino Pro or Pro Mini (5v, 16mhz) w/ATmega328" That should be the right choice based on what's on your board...but again I don't that exact board so checking the comments/files on HK may be a good idea. Finally we'll tell Arduino where your board is connected. When you plugged your board in windows should have recognized the FTDI chip on it and set it up as a virtual COM port. If you don't know where it ended up then you can open your device manager and view view a list of COM ports - one should show up as FTDI something or other (or if HK went all out it may show up as a multiwii or hk something or other) Just note what COM port number it's listed as and then go to "Tools->Serial port" in Arduino and select it there. If you're on mac I can't really help you - but a bit of google searching for "ftdi mac arduino" or something similar should get you there. If you're on Linux...well, you probably already got board around step 3 and did it yourself already.

Now all you have to do is hit the button with an arrow pointing to the right and a tooltip saying "Upload" - it should be the second button from the left in the top toolbar right next to the check button. Doing so will first compile your code (same thing the check button does) and as long as you haven't messed anything up it should then upload (or flash) it to your board and report success. If it doesn't - then let me know what the error it gives is and I may need you to share one or more files (likely just config.h) on dropbox or pastebin or something so I can see what you did that's causing the error.


Hope that helps and my tone came across as playful rather than condescending as it really was intended to be playful and not condescending...but that can be easily confused in text so I apologize now if you took it the wrong way.

If you're still stuck keep asking questions. More details about your TX/RX setup would help me give more detailed answers but I can't help too much with board specific questions since I really don't have any experience with your exact board. There aren't a lot of MW users on here so asking on RCGroups or the MultiWii forum may get you more help...but if you don't search first and look to see if the questions have already been answered on those forums you may get some unfriendly responses instead.
 

Saschafi

Junior Member
So now I have another problem. Please help

I have everything I need now. I am having trouble getting it to arm and spin up please help. I think everything is connected properly but I don't know.
This is the video of me explaining it I thought that would be easier than trying to explain it when I don't know what it is supposed to do.
http://youtu.be/hQpmaLucPZA
 

tigert10

Member
First of all, at this point, please remove the props, if it does arm and something is not set right the motors could spin up and that would be BAD! Have you hooked it up to the computer and used Multiwii Config? That is a user interface that shows you what everything is doing. Looks like you need to calibrate the accelerometer and gyroscope as well as check that your ranges are set with the correct min/max values. All of this and more will be readily available in the Multiwii Config. Let me know if you have any questions on how to do this.
 

SGrog

New member
Good afternoon Saschafi!

I am working on my Multiwii board as well, and if I may share how I got to motors mostly working, something may pop out and be of use. I will try to skim the stuff previously mentioned, but we shall see! Also, as tigert10 suggestd, props can be bad on spin up! My first spin up could have led to a very bad situation had I not had my blades off.

For me, the first step was reading all the documentation on the board (I have the red Multiwii Pro with GPS) then I downloaded the Arduino IDE from the Arduino site, followed by the latest Multwii Code from the site (2.3 being the latest), I then downloaded the GUI and while that downloaded, I selected the Multirotor type, as well as the exact board I was using in the config.h. In one of the posts I had about multiwii, http://forum.flitetest.com/showthre...oding-then-a-bird-in-fog-over-the-ocean/page2, Craftydan had some good suggestions, especially towards the end. This forum was also useful: http://www.multiwii.com/forum/viewtopic.php?f=18&t=5154 , and I was able to test my motors by using a switch instead of the sticks, but I am working on fixing the code to allow for the stick activation. Together those two forums got me operational, and can hopefully be useful for your set up as well?

I would suggest the following as well (if you havent already):
Calibrating the accelerometer,
Calibrating the Magnetometer,
Calibrating the ESC's individually.
 
Last edited:

jhitesma

Some guy in the desert
Mentor
Yep, pretty much what those last two guys said :D

1) Get those props off. Until you're 100% ready to put it in the air keep them OFF.

2) Always turn your TX on BEFORE powering your craft.

3) Hook it up to the GUI and confirm that your RC values are responding correctly:
a) They all go in the correct direction
b) They all go from 1000 - 2000. NOTE: The stock GUI will only show values from 1000 to 2000 so if you're going lower than 1000 or 2000 then the GUI won't show you! There is a modified version of the GUI for MW 2.3 available in this thread on the MW forums that will go from 900-2100: http://www.multiwii.com/forum/viewtopic.php?f=18&t=5073#p50792
c) in config.h make sure your mincommand is set to 1000 if you're using the stock range of 1000-2000 (It should be unless you changed it)

4) If you have " #define ONLYARMWHENFLAT" enabled then make sure you calibrate your accelerometer and that the quad is sitting flat (ONLYARMWHENFLAT is a good safety measure IMHO and should be enabled unless you have a good reason to disable it.)

5) Make sure that ONLY ALLOW_ARM_DISARM_VIA_TX_YAW or ALLOW_ARM_DISARM_VIA_TX_ROLL is enabled and not both. If both are enabled neither will work.

6) If you have it setup to arm via an aux channel then it won't be able to arm by stick. So make sure in the GUI that you don't have arming setup on any aux channels if you want to arm by stick. Here's the thread on the MW forums where the head dev (alexinparis) explains that this is intentional (last post): http://www.multiwii.com/forum/viewtopic.php?f=16&t=2628

Don't forget - after any changes in config.h you have to save and flash to the board before they'll take effect.

The GUI is your friend when debugging this kind of thing. If you're getting values that look right in the GUI (double check with the extended range version I linked above) then it's probably your min command settings.
 

Craftydan

Hostage Taker of Quads
Staff member
Moderator
Mentor
Calibrating the ESC's individually.

If you've gotten to the point of editing the sketch (code) and flashing to the board, consider using the ESC calibration option in the Multiwii sketch.


- REMOVE THE PROPS -- THEY WILL GO LIVE, and FULL THROTTLE if the battery is plugged in while flashing -- ask me how I know :black_eyed:.
- near the bottom of config.h, uncomment "#define ESC_CALIB_CANNOT_FLY"
- upload and after it reboots, unplug the USB cable and plug in your flight battery.
- wait for the ESCs to go through their boot sequence and the should beep their "arm" tune.
- unplug the battery, re-comment the line you activated earlier, then plug in the USB and upload.
 

Saschafi

Junior Member
Thank you all for your help and concern. The props are loosely on the motors so they slowly start to move just based on the slight friction from the plastic on flat metal(thank you David w. For that tip). I will try the esc calibration and update on how that works tomorrow.
 

Craftydan

Hostage Taker of Quads
Staff member
Moderator
Mentor
um . . . I don't know how your props are connected to your motors, but many of these can self-tighten:

 

Saschafi

Junior Member
still having trouble

So I have read through about everything I can find on multiwii and my flight control board and I am still stuck...
I thought I would run through multiwii config.h again from scratch and I made sure I changed everything that needed it and nothing that didn't.

I am using gemfan props loosely sitting on dt750's without the spacer there is no way they will flyoff or even get going fast at all.

I just don't know how to get the motors to react to anything I do without plugging them into the rc throttle and spinning them up that way. I have the esc's calibrated(hobbyking blue 30A).

Again I don't know if it helps but I am a visual person so here is a video of the problem and set up.
https://www.youtube.com/watch?v=p0mIG_HfA44&feature=youtu.be
 

tigert10

Member
Have you hooked it up to your computer with the Multiwii GUI so you can see what inputs the control board is receiving?
 

Saschafi

Junior Member
Have you hooked it up to your computer with the Multiwii GUI so you can see what inputs the control board is receiving?

Yeah I did and everything looks good. I set it to arm with aux1 I don't know how well that works though. I tried yaw and roll before and neither of those worked.

And I got to say thank you to everyone who is helping me out and getting back to me so fast! You are helping me from giving up on this hobby.