Build Your Own Quadcopter Beginner Guide – Part 2


In the last post (part 1), I talked about the parts ordered and how to assemble them for the quadcopter. In this post I will cover the steps I followed to set up the quadcopter for its fist flight. These steps includes programming and calibrating the ESCs, binding the radio and setting up the KK2.0 flight controller board. I will also show you how to tune the quadcopter’s PI settings to optimize flying performance.

Programming the ESCs

BEC-Siginal-Wires11

The 30 amp Turnigy Plush ESCs are great but the bullet connectors must be soldered on. There are a lot of other ESCs around that are similar to the Plushes that can be programmed with the same programming card. I happened to have some compatible 25 amp Dynam Detrum ESCs that I used in this build until I can get the Multistars and they are working fine.

ESC-Programming-Card

I programmed my ESCs using the following procedure (with Propellers Off!):

  1. disconnected all of the ESC BEC/signal connector from the KK2.0 flight controller.
  2. connected the battery to the power harness.
  3. connected one of the ESC BEC/signal connectors to the programming card aligning the signal, ground, power wires as indicated on the card.
  4. used the arrows on the programming card to set the programmable values as seen in the picture above.
  5. pressed the OK button to save the programmable values to the ESC.
  6. repeated steps 3-5 for the remaining ESCs.
  7. reconnected all of the ESC BEC/Signal connectors to the KK2.0 flight controller in according to this picture from Part 2.

Here is my understanding of why quadcopter ESCs should be set this way:

  • Brake – OFF

The propellers are not stopped when the throttle is moved to zero.

  • Battery Type – Ni-xx
  • Cut Off Type – Soft-Cut
  • Cut Off Voltage – Low

Even though I use Lipo batteries, these setting keep the ESC from shutting down the motors if the battery gets low.

  • Start Mode – Normal

I believe the other modes are for large heavy props that need start up slowly which shouldn’t be an issue with a quad.

  • Timing Mode – Middle

This one may vary depending on the motor and how it sync with the ESC. I start with medium as recommended by rcexplorer. It worked fine with these motors.

  • Music/Li-Po Cells

I believe this plays different music when the ESC is armed based on how many Lipo cells are connected. I just leave it off.

  • Governor Mode – OFF

This is a setting used with helicopters and not needed for quadcopters.

Binding the Radio

Bind-Plug

The HobbyKing 4 channel radio transmitter and 6 channel receiver have to be bound together to be able to talk to each other. To bind them I followed these steps:

  1. placed the bind plug into the receiver pins labelled “BAT” as pictured above.
  2. connected the battery on the quad to the power harness.
  3. watched to see that the red light on the receiver was blinking, meaning it was in bind mode.
  4. turned on the transmitter while holding down the button labelled “Bind Range Test”.
  5. watched to see that the light on the receiver went from blinking to solid, meaning the bind was successful.
  6. turned off the transmitter.
  7. unplugged the battery on the quad.
  8. removed the bind plug from the receiver.
  9. again, I plugged in the battery on the quad to the power harness.
  10. verified that there was no light on the receiver, meaning my transmitter was off.
  11. turned my transmitter on and verified that the light on the receiver turned solid, meaning it was successfully bound.

Set Up KK2.0 Flight Controller Board

The KK2.0 board I received was loaded with the version 1.2 of the firmware. The most current version 1.6 of the firmware has better self levelling. The firmware can be upgraded as I described in this post, but to keep it simple I used what was already on the board. Here is an overview of the specific steps I followed to set-up this quad:

Sensor Test – I performed this test first to confirm that all the sensors on my board were working correctly.

  • powered up my Kk2.0 board by plugging in the battery (with Propellers Off!). The KK2.0 board displayed SAFE.
  • brought up the main menu by pressing the MENU button (4) from the SAFE display.
  • From the main menu, I pressed the DOWN button (3) until I got to Sensor Test.
  • pressed the ENTER button (4) to do the Sensor Test.
  • All of my sensors showed “OK”, so I knew I had a good board.
  • pressed BACK button (1) until I returned to the SAFE display.

Load Motor Layout – I configured the KK2.0 board to be a quadcopter in the X motor configuration.

  • brought up the main menu by pressing the MENU button (4) from the SAFE display.
  • From the main menu, I pressed the DOWN button (3) until I got to Load Motor Layout.
  • pressed the ENTER button (4) to see the different motor layouts available.
  • From the main menu, I pressed the DOWN button (3) until I got to Quadrocopter X mode.
  • pressed the ENTER button (4) to set the KK2.0 configuration to Quadcopter X mode.
  • The lcd asked me “Are you sure?” and I pressed the ENTER button (4) to say that I was sure.
  • The lcd then showed me the motor layout for a qaudcopter X with all the motors numbered and the prop roations shown.
  • pressed BACK button (1) until I returned to the SAFE display.

Receiver Test – I did this test to make sure my transmitter was configured so the correct stick movements controlled the rudder, throttle, elevator and ailerons of my quadcopter.

  • turned on my radio with the RUD, THR, ELE and AIL switches located on the radio all set to NOR(normal).
  • brought up the main menu by pressing the MENU button (4) from the SAFE display.
  • From the main menu, I pressed the DOWN button (3) to until I got to Receiver Test.
  • pressed ENTER button (4) to do a Receiver Test.
  • moved the left stick on my transmitter to verify that the throttle (up and down) was working correctly. The lcd panel displayed the throttle moving from a positive number when it was all the way down to zero when it was all the way up. It should have done the opposite. So, I switched the THR switch on the radio to REV to reverse the throttle. When I tested the throttle again it displayed “0″ and “idle” with the throttle down to a positive number as I moved the throttle up, which is correct. It was very important that I got this right. If I had armed the board with the throttle set incorrectly, it might have immediately flown away.
  • I moved the left stick on my transmitter to verify that the rudder (left and right) was working correctly. When I moved the stick to the right the lcd displayed “right” next to rudder. When I moved it left, it displayed “left”. This was correct, so I left the RUD switch on NOR.
  • moved the right stick on my transmitter to verify that the elevator(up and down) was working correctly. When I moved the stick to up the lcd displayed “forward” next to elevator. When I moved it down, it displayed “back”. This was correct, so I left the ELE switch on NOR.
  • moved the right stick on my transmitter to verify that the aileron (left and right) was working correctly. When I moved the stick to the right the lcd displayed “right” next to aileron. When I moved it left, it displayed “left”. This was correct, so I left the AIL switch on NOR.
  • I pressed BACK button (1) until I returned to the SAFE display.

Sensor Calibration – I performed this calibration to correctly calibrate the accelerometers and gyros on my quadcopter while the quad was level.

  • placed my quadcopter on a level surface.
  • brought up the main menu by pressing the MENU button (4) from the SAFE display.
  • From the main menu, I pressed the DOWN button (3) until I found the Sensor Calibration menu item.
  • pressed the ENTER button (4) to do Sensor calibration.
  • The lcd told me to put the quad on a level surface. Done!
  • pressed the CONTINUE button (4) to continue.
  • The lcd displayed various information about the calibration it is doing.
  • Finally, the gyros and accelerometers have some values and OK displayed next them.
  • pressed the CONTINUE button (4) a couple of times to confirm and take me back to the main menu.
  • pressed BACK button (1) until I returned to the SAFE display.

ESC Calibration – Props Off! – My props had been off the whole time, but I knew it was critical that they were off now, because ESC calibration can easily go wrong and I did not want to lose a finger! ESC calibration gives all of my ESCs a consistent calibration that matches the throttle range of my transmitter. It is done with the throttle wide open. If something went wrong and my throttle was wide open with the props on, all hell could break loose.

Again, I made sure my props were OFF! Ah yes, they were, and had been the whole time! Ha

  • unplugged the battery on the quad from the power harness.
  • turned on the power to my transmitter
  • moved the left stick which is the throttle all the way up on my transmitter
  • plugged the battery on my quad into the power harness and quickly pressed buttons 1 and 4 on the KK2.0 board.
  • continued to hold down buttons 1 and 4. The lcd displayed “Calibrating ESCs” and the ESCs made two short beeps signalling they were ready to be calibrated. These beeps are after the beeps that the KK2.0 board makes when powered up.
  • While holding down buttons 1 and 4, I steadily moved the throttle stick on my radio from full throttle all the way down to idle.
  • The ESCs made one long beep signalling that they had been calibrated.
  • released buttons 1 and 4 on the KK2.0 board and returned to the SAFE display.
  • armed the board with the props off by holding the left stick down and to the right.
  • The lcd displayed “ARMED”
  • moved the throttle up a bit to see that the motors turn consistently and appeared to be properly calibrated.
  • With the throttle partially up, I also moved the other sticks to see if I heard a proper response from the motors.
  • checked the ailerons by moving the right stick left which sped up the two motors on the right side, and then right which sped up the two left motors.
  • checked the elevators by moving the right stick up which sped up the two rear motors, and then down which sped up the two front motors.
  • decided to check the yaw on my first flight.
  • disarmed my quadcopter back into “Safe” mode by moving the left stick down and to the left.
  • The board went back in to safe mode and I disconnected the power.

First Flight

After doing all of the above stuff, I was ready to take the copter outside to an open space away from people to do an initial flight.

  • Once the copter was in a safe open area with the battery was disconnected, I put the props on the quad according to the picture above.
  • placed the quad on level ground.
  • connected the battery to the power harness and immediately stepped away form the quad.
  • stood at a safe distance from the quadcopter and again moved my throttle/yaw stick down and right to arm the board in gyro only “rate” mode.
  • checked to make sure the propellers were rotating correctly by applying a little bit of throttle, but not enough to lift the quad off the ground.

After taking note of all the incorrect propeller rotations, I disarmed the board and disconnected the power.

If a propeller was turning the wrong way, I corrected it by switching two of the motor phase wires and then went back to step 3.

Again, I checked that the correct motors were responding to my stick commands by applying a small amount of throttle while testing the aileron, elevator and rudder stick movements. With props on, the quad leaned and turned appropriately.

When all props and motors were spinning and responding correctly, I gave the quad enough throttle to lift off and it flew ok with no tuning, but it needed tuning. If I had any problems, I would have immediately lowered the throttle to idle and landed the copter.

I also flew it in self-level mode by moving the right stick all the way right when arming. It levelled fairly well, but tuning made it fly much better. Also, though I am not covering it in these posts, upgrading the firmware to version 1.5 greatly improves the self-levelling.

The above steps got the quadcopter in the air, but the controls are very loose. Also, the throttle is hard to control and the quad loses altitude when yawing. Tuning improved these issues greatly. I am not a talented pilot and can’t fly a quadcopter that hasn’t been tuned. I think beginners sometimes forget to tune their quads, which can lead to disaster.

24723-9(1)

KK2.0 Flight Controller PI Tuning

Tuning was the most important part of getting my quadcopter to fly right. Without tuning, the quadcopter is very hard to control. I chose to use the KK2.0 flight control board for my easy DIY quadcopter build. PI tuning is accomplished on this board by setting gain variables used by the firmware loaded on the board. The gain variables are set through the lcd menu system on the board. Correctly setting these variables helps the quad fly much better. This wiki is a good read for those interested in PI controller logic.

The creator of the the KK2.0 board and its firmware is Rolf Bakke aka KapteinKUK. This RCGroups forum thread is a great place to download the latest firmware for the board and communicate with others about the board. In KapteinKUK’s forum post he gives very specific directions on setting the gain variables to do PI tuning. I followed his directions to tune my quad. I am not a very good pilot and always fly in self-level, however, the tuning process was done with self-leveling off.

PI Gain Defaults

The default PI gain values that came on my board loaded with version 1.2 firmware were set as follows:

Roll/Pitch P-gain: 50
Roll/Pitch I-gain: 25
Yaw P-gain: 50
Yaw I-gain: 50
Self-level P-gain: 40

Before starting the tuning process, KapteinKUK suggests the following:

Set the gains and limits to the following values:
Roll/Pitch P-gain: 30 (For a small 25cm size set to 20)
Roll/Pitch P-limit: 100
Roll/Pitch I-gain: 0
Roll/Pitch I-limit: 20
Yaw P-gain: 50
Yaw P-limit: 20
Yaw I-gain: 0
Yaw I-limit: 10

So, according to his instructions, I went into the first menu item called “PI Editor” and changed all of the variables to the values above. I did not change any of the limit values during the tuning process.

Roll and Pitch Tuning

The right and left roll angle of the quadcopter is controlled by the radio’s aileron stick movement. This is done by moving the right stick on my Mode 2 radio right and left. The forward and back angle of the quadcopter is controlled by the radio’s elevator stick movement. This is done by moving the right stick up and down. By default the KK2.0 links the tuning for roll and pitch together and I left it that way for my quad.

Roll/Pitch P Gain Tuning

Here is what KapteinKUK has to say about tuning the P gain value:

Increase Roll/Pitch P-gain by 10 (5 or less for a small aircraft) at a time, and test your aircraft response by hovering and move the left stick in short and fast movements.

As you increase the gain you will notice:
1: The aircraft reacts faster and feels more connected to the stick movement and wander less on its own.
2: The aircraft may oscillate for a short time. Usually a few oscillations, but may be more if gain is high. If it oscillates continually the gain is too high.
3: The aircraft may be harder to land, it bounces back when touching down.
4: The aircraft may climb.
When the aircraft has a good response and does not oscillate or climb when testing, P-gain is good.

I believe when he says “left stick” above, he is using a Mode 1 radio, where the roll and pitch are set up on the left stick. I use a Mode 2 radio where the pitch and roll are on the right side. As I moved the P gain value up by 10 it became more responsive. When I got my P value up to 80 the quad was much more responsive to my stick movements so I left it there. Some folks recommend raising the P value until the quad oscillates and then backing it off a bit, but I just stopped when it felt dialled in after raising it to 80.

Roll/Pitch I Gain Tuning

Here is what KapteinKUK said about tuning the I gain value of the pitch and roll:

1: Trim it level.
2: Fly fast forward and center the stick.
If it level itself, increase I-gain.
If it stays in attitude, I-gain is good.
Alternatively setting I gain to 50-100% of P-gain does the trick.

Here, I started with an I gain of 40 which was 50% of the 80 I chose for the P gain. When I got to 60, I noticed it would hold the angle I set by moving the right stick from side to side or forward and back.

Yaw Tuning

The rotation of quadcopter is controlled by the radio’s rudder stick movement. The rudder is controlled by moving the left stick on my Mode 2 radio right and left.

Yaw P Gain Tuning

Here are KapteinKUK’s suggestion on tuning the P gain value for the yaw:

Increase Yaw P-gain by 10 (5 or less for a small aircraft) at a time, and test your aircraft response by hovering and move the Yaw control stick until it have yawed about a quarter of a circle, and then center it.

As you increase the gain you will notice:
1: The aircraft start and stops faster.
2: The aircraft overshoots less.
3: The aircraft may start to climb or descend.
When the aircraft has a good response, has a minimum of overshoot and does not climb or descend, P-gain is good.
Alternatively, set it to 100% of Roll/Pitch P-gain

I set the P gain to 60. This is where it stayed the most level while yawing.

Yaw I Gain Tuning

Finally, here is what KapteinKUK has to say about tuning the P gain value for the yaw:

Increase Yaw I-gain by 10 (5 or less for a small aircraft) at a time, do the same test as above.
When the aircraft overshoots even less, I-gain is good.
Alternatively, set it to 100% of Yaw P-gain.
If you have a small and not dangerous aircraft, you can disturb it around the yaw-axis and see if it returns. increase if not.

It is generally good to keep the gain values in the low range. Excessive gain may introduce vibration and control issues.

I also set the yaw I gain to to 60 to match the P gain.

Self-Level P Gain

Under the self-level settings menu there is another P Gain value that is specific to self-level mode. It defaulted to 40 with the version 1.2 firmware that shipped with my board. Version 1.5 of the firmware has an improved self-levelling algorithm. Since I prefer to fly in self-level mode, I upgraded my firmware. Though it is a little more advanced and not required, a USBasp AVR can be used to easily load newer versions of the KK2.0 firmware using the LazyZero KKMulticopter Flashtool. The later versions of the firmware have much better self-levelling capability, so I always upgrade my firmware. Here are the pins to connect the USBasp to the KK2.0.

The self-level P Gain was set to 100 after I changed the firmware to version 1.5. At 100 the quad leveled too quickly and became a little jerky. When I lowered it to 60 it behaved much better.

Final Tuned Settings

So, my final tuned PI gain settings were:

Roll/Pitch P-gain: 80
Roll/Pitch I-gain: 60
Yaw P-gain: 60
Yaw I-gain: 60
Self-level P-gain: 60

 

Conclusion

After tuning, my quadcopter flies much better. It is nimble and responds quickly to my controls, holds an angle and maintains altitude when yawing. After getting it dialled in with self-level mode off, I can now turn self-level mode on and it flies great! The advantage to self-level mode is that it stays level with the ground when the aileron/elevator stick is centred. While these setting work great for me, other pilots may have their own tuning values that work best for them.

Share Button

Leave a Reply