SUKKUR IBA UNIVERSITY Merit-Quality-Excellence DEPARTMENT OF ELECTRICAL ENGINEERING |
Introduction to Multiwii code: |
Coding is one of the most essential parts of our project. As mentioned before, at first we worked on NodeMCU, but due to lack of a proper code we quit it and moved to Multiwii open source platform. Multiwii code is, according to our experience, a little more arduous to understand than ESP open source code available on github. When we were working on ESP code, we found that it can not simply be downloaded and installed in any arduino based module, rather it shows a number of errors during compilation. So, first we needed to solve all the conundrums in the code to make it work, and obviously, it is not that easy. It requires a well understanding of code and skills to fix the errors. We tried multiple times to make it work, like we added several libraries, made some changes in code according to our understanding, but nothing worked. Finally we moved toward Multiwii code and found this open source platform remarkably perfect for our project. When we first downloaded the Multiwii code and tried to compile it in Arduino, it worked well. We then loaded the code successfully to Arduino Nano just by making a few changes in the codes — just uncommented a few lines in the code according to our requirements. This was, probably, a big leap in our project towards success. Multiwii code contains several files for different functions. We do not need to make any change in other files except ‘config.h’. This is a unique part where we choose quadcopter configuration, types of sensors and also the flight controller we are using_in our case we used ATmega328p microcontroller base flight controller that we have designed. Here is mentioned step by step explanation about ‘config.h’ code: |
For Multiwii code Click Here!
|
For our modified code Click Here!
|
Step 1: |
Choose the right configuration of quadcopter. In our case it is x-configuration, so here we have uncommented #define QUADX. Rest of the code will remain the same. |
/************************** The type of multicopter****************************/
|
Step 2: |
Next step is to choose the maximum and minimum throttle values. We chose '0' Min throttle because want that quadcopter should not rotate until we arm the transmitter. Also we have selected 2000 max so that we will get full thrust maximum throttle. |
/************************** * Min Motor minthrottle****************************/
|
Step 3: |
In this part we have to select which circuit board we are using. In our case we have ATmega328p based flight controller, so we chose NANOWII—this board is based on the same microcontroller . |
/*************************** Combined IMU Boards ********************************/
|
Step 4: |
Optionally disable stick combinations to arm/disarm the motors. In most cases one of the two options to arm/disarm via TX stick is sufficient, so we choose the first one. |
/************************** * ARM/DISARM****************************/
|
Step 5: |
The following lines apply only for specific receiver with only one PPM sum signal, on digital PIN 2. We need to select the right line depending on the radio brand we are using. As we were using the transmitter and receiver of FLY-SKY, so we chose the sencond option which matches the order of our receiver. |
/************************** * PPM Sum Reciver****************************/
|
Multiwii Code Explanation: |
Here in this video we have explained Multiwii code and described which parts need to be uncommented to run it on any flight controller based on ATmega328P microcontroller controller. |
Prev | Next |