MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino...

15
22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 1/15 MicroduinoQuadcopter Tutorial Contents 1 Outline 2 Principle 2.1 System Structure 2.2 Flying Principle 2.2.1 Vertical Motion 2.2.2 Front & Lateral Motion 2.2.3 Yawing Motion 2.2.4 Pitch and Roll Motion 2.3 Control Procedure 3 Buildup and Debugging 3.1 Bill of Materials 4 Program Download 5 Programming 6 Operating Instructions 6.1 Guidance of Correcting the Four Axes 6.1.1 Autocorrection Recommend6.1.2 Manual Correction 6.2 Guidance of Joypad Remote Controller 6.2.1 Joypad unlock the four axes 6.2.2 Joypad Controls the Quadcopter 7 Program Description 8 Attention Outline Quadcopter is one kind of aircraft that is equipped with four propellers. Similar to the helicopter, it can finish the action of hover and flight. A traditional helicopter uses a main rotor to generate thrust and a tail rotor to offset the torque from the main rotor, namely, locking the tail. While the quadcopter adopts positive and negative propeller design and therefore, needs no extra structure to lock the tail. Four propellers distribute symmetrically in the shape of a cross. The No. 1 and No. 2 propellers rotate anticlockwise while the No.3 and No.4 rotate clockwise. When the four propellers generate the same thrust, the antitorque imposed on the body by the two groups offset, balancing in the vertical direction and making sure flight stability. According to the userdefined fore and aft direction of the aircraft, the quadcopter can be divided into the cross mode and X mode. The cross mode means that the fore and aft direction points to a certain propeller and the X mode refers to that the fore and aft direction points to the middle of two propellers. For most aircraft adopting X mode, the X mode is harder to control but more flexible.

Transcript of MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino...

Page 1: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

1/15

Microduino­Quadcopter Tutorial

Contents

1 Outline2 Principle

2.1 System Structure2.2 Flying Principle

2.2.1 Vertical Motion2.2.2 Front & Lateral Motion2.2.3 Yawing Motion2.2.4 Pitch and Roll Motion

2.3 Control Procedure3 Buildup and Debugging

3.1 Bill of Materials4 Program Download5 Programming6 Operating Instructions

6.1 Guidance of Correcting the Four Axes6.1.1 Autocorrection(Recommend)6.1.2 Manual Correction

6.2 Guidance of Joypad Remote Controller6.2.1 Joypad unlock the four axes6.2.2 Joypad Controls the Quadcopter

7 Program Description8 Attention

Outline

Quadcopter is one kind of aircraft that is equipped with four propellers. Similar to the helicopter, it can finish the action of hover andflight. A traditional helicopter uses a main rotor to generate thrust and a tail rotor to offset the torque from the main rotor, namely,locking the tail. While the quadcopter adopts positive and negative propeller design and therefore, needs no extra structure to lockthe tail. Four propellers distribute symmetrically in the shape of a cross. The No. 1 and No. 2 propellers rotate anticlockwise whilethe No.3 and No.4 rotateclockwise. When the four propellers generate the same thrust, the anti­torque imposed on the body by the two groups offset,balancing in the vertical directionand making sure flight stability.  

According to the user­defined fore and aft direction of the aircraft, the quadcopter can be divided into the cross mode and X mode.The cross mode means that the fore and aft direction points toa certain propeller and the X mode refers to that the fore and aft direction points to the middle of two propellers.

For most aircraft adopting X mode, the X mode is harder to control but more flexible.

Page 2: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

2/15

Principle

System Structure

As the picture shows, the Quadopcter consists of a remote controller, a flight controller and four motors. And for the flight controllerincludes a microcontroller, a remote control signal receiving module, a motor driving module and sensor modules (A gyroscope, anaccelerator, an electronic compass and a GPS module).  

Flying Principle

Vertical Motion

Vertical motion includes rising or falling vertically. As the text mentioned previously, the quadcopter can keep balance horizontally byfour motors maintaining the same rotation rate. As you can see from picture 2.2.1, if the four motors increase to the same speed, thegenerated thrust will be large enough to overcome the quadcopter weight and rise, and vice versa. Under the condition of nosurrounding interruption, the four motors can generate enough thrust to overcome the weight and therefore, the quadcopter cansuspend in the air. 

The quadcopter can fly steadily in the vertical direction as long as the four motors maintain the same speed.

Page 3: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

3/15

Front & Lateral Motion

The motor 1 is the head of the aircraft and the motor 2 is the rear. How does the quadcopter move forward? Get a thrust in the horizontal direction: By increasing the speed of the motor 2 and thethrust increases in the rear. By decreasing the speed of the motor 1, the thrust will get reduced in the head. In this case, the aircraftwill move forward. At the same time, by maintaining the speed of the motor 3 and 4 to keep the anti torque balance, the aircraft willfly forward steadily and vice versa. 

Since the quadcopter is symmetrical in the middle, the action of controlling the quadcopter forward or laterally is similar. Just keep inmind, the control of the two groups of motors should be reversed while trying to fly the aircraft laterally. For example, by keeping thespeed of the motor 1 and 2 the same, increasing the speed of the motor 4 and decreasing the speed of the motor 3, it will generatehorizontal thrust to the left and the aircraft will move left. 

Yawing Motion

The three kinds of motion mentioned above all happen in the directions of the three axes. Next, we'll introduce the motion around thethree axes.

Yawing motion is the rotation in the horizontal direction, namely rotation around the Z­axis.

Page 4: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

4/15

During the rotation, it will form an anti­torque opposite to the rotation due to air resistance. Yawing rotation is realized by using thereverse torque. When the aircraft suspends, the speed of the four motors is the same, which can offset torque in both horizontal andvertical direction, and achieve balance. When the speed of the four motors is different, unbalanced anti­torque will cause horizontalrotation and the aircraft will deviate from the route. As the picture shows, by increasing the speed of the motor 1 and 2, anddecreasing that of the motor 3 and 4, the clockwise anti­torque generated by the motor 1 and 2 will be larger than the counterclockwise anti­torque generated by the motor 3 and 4, causing clockwise rotation of the aircraft horizontally and generating novertical displacement when there is no change in the thrust upside.

Pitch and Roll Motion

Pitch motion refers to the rotation in the Y­axis direction while the roll motion refers to the rotation in the X­axis direction.

As the picture shows, by increasing the speed of the motor 1 and decreasing that of the motor 2, and keeping the same of thevariable quantity as well as the speed of the motor 3 and 4: The thrust of the head is larger than that of the rear. The unbalancedtorque makes the body rise. Similarly, the roll motion is realized by reducing the speed of the motor 1 and increasing that of the motor2, generating a torque forward.The principle of the roll and pitch motion is the same due to symmetry in the middle. By keeping the speed of the motor 1 and 2unchanged, and changing the speed of motor 3 and 4, it'll generate unbalanced torque and make the aircraft rotate around the X­axisdirection.

Control Procedure

The remote controller sends out control command, such as take­off or flying left. The control signal is received wirelessly.

A remote control signal receiving module receives a control signal, which is converted into PWM, PPM or other signals andthen transmitted to the flight controller.

Micro controller uses the remote control signal and the sensor's value (the current state of the aircraft, such as acceleration,direction and other information) to control the four motor and achieve the desired action through the PWM.

Since the four­motor combination control can only reach to six directions, which is an under actuated system. So here we must havea flight controller to control the whole system.In the flight controllers, sensors such as gyroscope and accelerator are dispensable. Micro controller can calculate data from the twosensors, get the current aircraft's attitude and then adjust the rotation rate with algorithms such PID to keep the stability. Sure you canadd an electronic compass to get the direction or a GPS module to get the geographic location. Simply speaking, the quadcopter is

Page 5: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

5/15

system with two closed­loops to control­­­the large loop gets input volume from the remote receiving device and the small loopacquires input volume from the attitude sensor.Generally speaking, the quadcopter kit includes an aircraft and a remote controller, the two of which controls instructions through theCoreRF transmission.The quadcopter is composed of a frame, Microduino­CoreRF , Microduino­Motion and other modules. For Microduino­motion, itintegrates a three­axis gyroscope + a three­axis accelerator(MPU6040), a magnetic field intensity sensor(HMC5883L) and a digitalpressure sensor(BMP180), and have communication through IIC.MPU6050 is the most important attitude sensor with a three­axis accelerator and a three­axis gyroscope integrated inside, which notonly offsets adjustment errors for the combination of a three­axis accelerator and a three­axis gyroscope, and also has a built­in lowpass filter.

Buildup and Debugging

Bill of Materials

Microduino Equipment

Module Number Function

Microduino­CoreRF 1 Core board

Microduino­USBTTL 1 Program download module

Microduino­Motion 1 Attitude adjustment

Microduino­QuadCopter 1 Quadcopter driver

2.4G Antenna 1

Other Equipment

Component Number Function

USB Cable 1

Frame 1

Battery 1 Power supply

Screw 8

Screwdriver 1

Page 6: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

6/15

Step 1:Install the four propellers as shown below:

Step 2:Put the battery into the right place on the bottom of the frame.

Page 7: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

7/15

Step 3:Put the module base into the top of the frame and then insert the wires into the corresponding interface.

Step 4:Connect the antenna to the CoreRF, and then stack them to the Microduino­Motion on the base plate.

Page 8: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

8/15

Step 5:Connect the base module and the battery with wires.

Step 6:Paste the antenna on the CoreRF to the back of the frame. Congratulations! You just finished the Quadcopterbuildup.

Page 9: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

9/15

Please be noted of the electrode of the two wires, which is "red wire connects to red wire" and "black to black".Make sure all wires are connected well in order to prevent accident while flying.

Program Download

The code of the quadcopter:MultiWii_for_Microduino (https://github.com/wasdpkj/MultiWii_for_Microduino)

Programming

Stack Microduino­CoreRF and Microduino­USBTTL together.Connect the Microduino­USBTTL with USB cable and prepare to upload the program.Note:You’d better upload the programs before stacking all the modules together.

Open the Arduino IDE for Microduino environment(Reference of setting up:AVR Core:Getting started)Click 【File】, confirm board card (Microduino­CoreRF) selected rightly, and choose the corresponding portnumber (COMX).Click 【File】­>【Open】, browse to the project program address, and click “MultiWii_for_CoreRF.ino” to open it.After confirming all these are right, click "→" to download the program to the development board.Microduino­USBTTL download module is used when download programs and debug serial ports and correct the quadcopter,and you can not stack it at other time.

Operating Instructions

Guidance of Correcting the Four Axes

Autocorrection(Recommend)

The default is automatic correction mode, and the manual correction is not needed after programming.

Page 10: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

10/15

Manual Correction

When the quadcopter can’t correct automatically and the users want to correct by hand, you can refer to the following steps.Stack Microduino­CoreRF, Microduino­10DOF, and Microduino­USBTTL together and install them to the flightcontrol floor.

Open the softwareAccording to the system type, open the corresponding MultiWiiConf.exe in the quadcopter folder.Note:The file needs to be opened in JAVA development environment, and if you haven’t the JAVAdevelopment environment, you can choose the Microduino_Joypad_QuadCopter\java environment to install.

Correction of the SensorPut the four axis horizontally on the table.Click RECONNECT on the surface on the software, and wait for the sensor data curve appearing.Click CALIB_ACC and keep the four axis stable during the following 5 seconds, and the accelermeter of the flightcontrol will correct.Click WRITE to write number into the flight control.Click CALIB_MAG and then pick up the plane to make it run in circle centering on the module again and again, andplace the four axes on smooth place after the correction of the electronic compass.After the electronic compass is balanced, click WRITE to write the number into the flight control.

Page 11: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

11/15

Set the PID ParameterLOAD configuration file directly, and click LOAD, choose the Microduino.mwi to import, as shown in the picture:

Set the flight mode.On the right side of the adjustment of PID, click ”SELECT SETTING”(as the following figure).Click the left mouse button on the square, and the grey square will change into white. Click the 3 squares as thefollowing picture(which should be grey originally).After setting, click WRITE to write the value into the flight control.

Page 12: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

12/15

Use the sensor’s value to remove the debug.Make the fuselage lean to the right(the left side upward):

The values of MAG_ROLL, ACC_ROLL and GYRO_ROLL increase.The values of MAG_Z and ACC_Z decrease.

Make the fuselage lean forward(the tail lift up):The values of MAG_PITCH, ACC_PITCH and GYRO_PITCH increase.The values of MAG_Z and ACC_Z decrease.

Make the fuselage rotate clockwise(yawing):The value of CYRO_YAW increases.

The fuselage remains level:The values of MAG_Z and ACC_Z are positive.

Complete the correctionClose the connection of serial ports and MultiWiiConf software.Take down the Microduino­USBTTL module.

Guidance of Joypad Remote Controller

The set up process, you can refer to the following page:The Guidance of Joypad(https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start)

Joypad Communication mode configuration*The mode configuration, you can refer to the following page:Communication mode configuration(https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start/zh#.E9.80.9A.E8.AE.AF.E6.A8.A1.E5.BC.8F)

When we use Microduino­CoreRF as communication, the Joypad correspondingly choose “Quadro.”

Joypad battery instruction*Special attention should be paid to the battery instructions:#Step­3_.E7.94.B5.E6.B1.A0.E9.80.9A.E7.94.B5 Batteryinstruction (https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start)

Joypad unlock the four axes

Method 1:Place the four axes o smooth place and turn on the switch.Dial the switch on the left side of the Joypad controller to the bottom(shut down the accelerator), and dial the rightswitch to top(Reaching the maximum amplitude can it be unlocked.).

Page 13: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

13/15

Pull the throttle rocker to the minimum, and move to the right and wait for about 2s. If the blue led lights for a long time,it shows that unlock successfully, or put the throttle rocker in the middle and then operate again.If you fail to unlock for many times, reset the core of the quadcopter, and try to unlock again.

'Method 2:Dial the left and right to the top.Pull the throttle rocker to the bottom.Pressing the right stick can switch the quadcopter locking / unlocking state.

Joypad Controls the Quadcopter

Pull the throttle rocker to the bottom again.Push the top left switch up(open the throttle switch).At the first using, you’d better adjust precision adjustment switch to dialed to the bottom to make the flight more stable.

Gently push the throttle to make the four propellers roll.Step on the gas and make it not close to the ground.And control balance through the azimuth joystick.

Page 14: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

14/15

Caution of operationOpen (dial it to the top) the top left throttle control switch to control, and you can shake the rocker and observe thechange on the screen.The switch on the right is a precision adjustment switch, and dial it to the top can get the greatest control to it, or youcan only control it in a small degree, and the small degree is helpful to stable control.The left rocker controls the throttle in vertical direction. The higher it is, the greater the throttle is. And the bigger thepower is, the higher it flies. And it controls the quadcopter in horizontal direction to roll in horizontal direction.The right rocker controls the throttle to move back and forth in vertical direction. Up is to forth, and down is to back.And it controls the throttle to move to left and right in horizontal direction.

Program Description

Attention

Although the above contents list a lot of problems that should be paid attention to, they need to be summarized here.

For installationThe four propellers of the quadcopter are installed in order. If you install wrongly, it is likely to lead to that the aircraftcan’t fly.The positive and negative of the lithium battery. The red line is for the positive pole, and the black line is for the negativepole. The circuit is easy to burn out once connect wrongly. Especially when supply power to Microduino­Joypad,because there is no design for avoiding plugging inversely, it should be noted.

For adjustment of the parametersRefer to the content of section 4 to adjust the PID parameter of the aircraft and the flight mode. And you’d bettermodify them on the basis of the recommended configuration. If you want to manually modify the PID parameters, you’dbetter modify one parameter at one time, otherwise it is difficult to see which parameters work.

For debuggingYou must correct the controller(Microduino­Joypad)and aircraft, or it is easy to cause the aircraft flying unstably.

For the flight control

Page 15: MicroduinoQuadcopter Tutorial · 2016-06-22 · 22/06/2016 MicroduinoQuadcopter Tutorial Microduino Wikipedia 9/15 Please be noted of the electrode of the two wires, which is "red

22/06/2016 Microduino­Quadcopter Tutorial ­ Microduino Wikipedia

15/15

You must choose an empty place to test, such as the playground in the school, and larger lawn in the park.Before unlocking with the remote controlled, please dial the top left switch to the bottom(close the throttle), andwhen start the test, please turn the throttle to the lowest at first to avoid accidents.

If you want to turn off the aircraft, you must switch off the power of the quadcopter, and then switch off the power of theremote controller, or the quadcopter will be out of control, and it is easy to cause accidents.For charging/dry battery

The aircraft plate has the function of charge the battery of the aircraft directly, so you only need to plug the USB cableto supply power to the baseboard directly.Joypad adopts dry battery to supply power, and you should dial the battery selection switch to Dry bat. Set up the drybattery, and on supplying power to joypad with USB cable, pull out at once(It can’t be charged with USB cable for along time after installing the dry battery), then you can successfully activate the dry battery to supply power.