• No results found

Actuator control using pre-calibrated force data on a quadrocopter

N/A
N/A
Protected

Academic year: 2021

Share "Actuator control using pre-calibrated force data on a quadrocopter"

Copied!
77
0
0

Loading.... (view fulltext now)

Full text

(1)

Actuator control using pre-calibrated force

data on a quadrocopter

Amil Lah

Master thesis in Robotics (30 ECTS credits)

Mälardalens University, IDT Supervisor: Giacomo Spampinato

Examiner: Lars Asplund

(2)

Abstract

In ying robots, stability control is often very sensitive to the actuator performances, and the software module performing the controller, is usually subjected to a long and dicult tuning phase strongly dependent on the specic actuator used. The actuators are often electric motors equipped with propellers. The motor and propeller combination performs dierently for every choice of components adopted, even if they are provided by the same vendor with the same part family. The project aims to develop an intelligent actuator module for ying robots composed by a BLDC motor and a propeller, which is invariant to the specic motor and propeller adopted.

By gathering the force data of the four used on a quadrocopter, the force and control signal relation could be dened and stored into the program memory of the control board. A battery monitor and a Force-PWM controller was implemented such that it takes force as input and outputs the desired PWM-signal. Tests were made on a prototype of Iqarus quadrocopter and by mounting it with ropes to the oor, it was tested on the lift-o phase. The experiment showed theoretical and practical results, which concludes that the quadrocopter maintained the ability to lift right upwards without any remaining control, assuming proper weight balance of the quadrocopter.

(3)

Abstrakt

Inom ygande robotar, är stabilitet kontrollen oerhört känsligt till styrdonets prestation, och mjukvaru modulen som utför kontrollen, är ofta förknippad med en lång och problema-tisk justerings fas starkt beroende av de enskilda styrdonen. Styrdonen är ofta elektriska motorer med propeller. Motor och propeller kombinationen uppträder olika för varje val av komponent, även om komponenterna är försedda från samma återförsäljare och modell. Syftet med detta projekt är att utveckla en intelligent styrdons modul för ygande robotar, omfattad av en BLDC motor och propeller, som blir oberoende av den särskilda motor och propeller kombination som används.

Genom att samla kraft data för de fyra styrdonen som används på en quadrocopter, kunde relationen mellan kraft och kontroll signal bli denierad och lagrad i program minnet för kontrol kortet. En batteri monitor och en Kraft-PWM kontroller implementerades, vilket tar kraft data som ingång och skickar ut motsvarande PWM-signal som utgång. Tester var gjorda med en prototyp av Iqarus quadrocopter och genom att binda fast den med rep till golvet, testades den för upplyfts fasen. Experimenten visade teoretiska och praktiska resultat, vilket visar att quadrocoptern bevarade förmågan att lyfta rakt uppåt utan någon övrig kontroll, förutsatt ordentlig vikt balans av quadrocoptern.

(4)

Acknowledgements

I would like to thank Giacomo Spampinato, which came up with this interesting project idea and oered the supervisor position for my thesis. It also gave me the chance to con-tinue developing the quadrocopter, which me and 13 other students from the Robotic program worked together with. A big thank to the rest of the project group which suc-cessfully managed to construct and run a quadrocopter, and thanks to Mikael Åsberg and Fredrik Ekstrand for guidelines throughout the Iqarus project and for letting me to use the prototype of Iqarus quadrocopter.

I would also like to thank Ivica Crnkovic, for giving me the signicant opportunity to work on this thesis during my exchange period in UFBA (Federal University of Brazil) in Salvador. And thanks to Eduardo Almeida for being my supervisor during the residence in UFBA, and for providing me with everything I needed for working with my thesis.

(5)

Contents

List of Figures 3 1 Introduction 5 1.1 Background . . . 5 1.2 Contribution . . . 6 1.3 Motivation . . . 6 1.4 Outline . . . 7 2 Background 8 2.1 Hardware components of the actuator line . . . 8

2.1.1 Motors . . . 8

2.1.2 Lipo battery . . . 10

2.1.3 ESC . . . 11

2.2 Control of Iqarus quadrocopter . . . 12

2.2.1 Stabilisation . . . 12

2.2.2 Navigation . . . 13

2.2.3 RPM measurement . . . 14

3 State of the Art 15 3.1 Related works . . . 15

3.2 Summary . . . 18

4 Problem Statement 19 4.1 Problem to be solved . . . 19

4.2 Project description . . . 19

4.3 Choice and specication of components . . . 20

4.3.1 Arduino Mega2560 vs. Arduino Due . . . 20

4.3.2 Force sensor . . . 21 4.3.3 Actuator line . . . 22 4.4 Summary . . . 23 5 Hardware Process 24 5.1 Force sensor . . . 24 5.1.1 Mechanical construction . . . 24 5.1.2 Circuit construction . . . 24

5.1.3 Calibrate the circuit to achieve the force . . . 26

5.1.4 LP-lter and EMI rejection . . . 28

5.1.5 Gather data from the load cell . . . 28

5.2 Battery monitor . . . 30

5.2.1 Voltage divider . . . 30

5.2.2 Voltage divider bias of a BJT transistor . . . 32

(6)

6 Software method 34

6.1 Read analog inputs from Arduino . . . 34

6.2 Compensate for the battery monitor . . . 35

6.3 Force curve adjustment . . . 36

6.4 Gather and store data in Arduino . . . 37

6.5 Force-PWM controller . . . 40

6.6 Summary . . . 41

7 Experiments 42 7.1 Force eect over time . . . 42

7.2 Compare motor and propeller . . . 43

7.3 Testing the software . . . 44

7.4 Testing the lift-o phase . . . 47

7.5 Summary . . . 47

8 Analysing the Results 49 9 Summary and Conclusion 50 10 Discussion and Future Work 52 10.1 Discussion . . . 52

10.2 Future work . . . 52

Bibliography 54 Glossary 56 A INA125P Datasheet 57 B Vetek Single Point Load cell 58 C T-motor KV1100 Datasheet 59 D T-motor KV900 60 E Arduino Mega2560 Rev3 Schematic 61 F ATMEL Mega2560 Datasheet 62 G Software: Gather and Store 63 G.1 Main function . . . 63

G.2 Filter functions . . . 66

G.3 Write to EEPROM functions . . . 68

H Software: Read and Run 70 H.1 Main function . . . 70

H.2 Read from EEPROM function . . . 71

(7)

List of Figures

1.1 Iqarus quadrocopter . . . 5

2.1 T-motor KV1100 . . . 8

2.2 Unmounted BLDC Outrunner motor . . . 8

2.3 Sequence pattern of a 3-phase motor . . . 9

2.4 Motor variation between two BLDC motors . . . 9

2.5 APC propeller 9x4.7 . . . 10

2.6 Lipo battery Tripple 3S 3000mAh . . . 11

2.7 Hobbywing Flyfun 18-A . . . 12

2.8 Roll and pitch eect on the quadrocopter . . . 12

2.9 Constants eect on PID-controller . . . 13

2.10 Movement commands on the quadrocopter . . . 13

3.1 Test-bench using a 5 pound load cell . . . 15

3.2 Test bench using a digital weight scale . . . 15

3.3 Another test bench using a digital weight scale . . . 16

3.4 Thrust data of four motors (Sikiric's) . . . 16

3.5 Hobby Prop Balancer. . . 17

3.6 Hover thrust vs. Battery voltage . . . 18

4.1 The problems are going to be solved . . . 19

4.2 Vetek Single Point Load cell . . . 19

4.3 Gather data before run-time . . . 20

4.4 Process the data under run-time . . . 20

4.5 Load cell construction and strain gauges . . . 21

4.6 Wheatstone bridge circuit . . . 22

5.1 Pressure applied to load cell . . . 24

5.2 Plates placed on load cell . . . 24

5.3 Final mechanical construction . . . 24

5.4 Suggested circuits for INA125P . . . 25

5.5 Resistor values to specify the gain. . . 25

5.6 Final circuit for INA125P . . . 26

5.7 Dierent gain value settings . . . 26

5.8 Oset resistor set in four dierent ways. . . 27

5.9 Equation found in Excel . . . 27

5.10 LP-lters and software delay timings . . . 28

5.11 PS and Lipo dierence on force output . . . 29

5.12 Force output of dierent PS voltages . . . 29

5.13 Voltage divider with high and low resistance . . . 31

5.14 Final voltage divider circuit . . . 31

5.15 Comparison with using a LP-lter . . . 31

5.16 Comparision of battery monitor using PS and Lipo battery . . . 32

5.17 BJT Transistor circuit . . . 32

5.18 BJT Transistor circuit with corresponding values . . . 33

(8)

6.1 Battery voltage drop . . . 35

6.2 Battery voltage compensation . . . 35

6.3 Battery voltage compensation with oset values . . . 36

6.4 Force curve adjustment opt. 2.1 . . . 36

6.5 Force curve adjustment opt. 2.3 . . . 37

6.6 Force curve adjustment opt. 3 . . . 37

6.7 Interesting area of force data . . . 38

6.8 Program ow for Gather and Store . . . 39

6.9 Program ow for battery compensation. . . 40

7.1 Current to force relation . . . 42

7.2 Current and force over time . . . 42

7.3 Force line at 400g and 300g over time. . . 43

7.4 Dierence between two motors . . . 43

7.5 Dierence between two motors and three propellers . . . 44

7.6 Four rst force curves to be stored . . . 44

7.7 Filtered force curve vs. Original . . . 45

7.8 Resulting battery voltage (red line) . . . 45

7.9 Resulting battery voltage (red line) under run-time . . . 45

7.10 First, second and estimated force curve . . . 45

7.11 Four motors with 1st and 2nd force curves . . . 46

7.12 The four desired PWM-signals . . . 47

7.13 Quadrocopter mounted to the oor . . . 47

8.1 Force of 200-300g at 13.10V . . . 49

(9)

1

|

Introduction

1.1 Background

This project is currently based on the quadrocopter project named Iqarus, which was developed in a project course in Mälardalens University by 13 Master students. The main goal of the project was to have 4-5 autonomous quadrocopters with one leader in the front, following each other like a train. By communicate via bluetooth and perceive the environment using Computer-Vision system through a camera, the quadrocopters can share information among each other. The concept can be used in several applications, while the main goal is to be used in search- and rescue missions. This thesis aims to develop the controller for the actuators (motor and propeller) used on the quadrocopter, which is to investigate the control of the specic motor and propeller combination used. The performance of the actuators depends on other hardware components as well, such as the power source and the speed controller used. This is what is called to be the actuator line and involves (power source  electronic speed controller  motor  propeller). This thesis also aims to make a open controller, which can be used for several applications while the main goal is to help the development of multirotor aircrafts.

Figure 1.1: Iqarus quadrocopter

Under the Iqarus project some issues were found, mainly concerning the motor con-guration used, since two motors of the same model and brand could have dierent per-formance. To solve it, attempts were made by looking at the speed using tachometer and Revolutions Per Minute (RPM)-sensors. Other attempts were made by looking at the torque, using digital weight scales. Unfortunately, these approaches were never imple-mented nor set to be accurate or reliable enough. Questions were raised, such as "What type of data is the most reliable?" and "What data is set to be the most reliable in terms of performance?". In order to guarantee reliable values, a more dedicated measure of the actual performance had to be done. This was not the case in the project, due to lack of time as well as the project continued relying on the Proportional Integral Derivative (PID)-controller to take care of the dierences.

Even though the motors have the same model and brand, the mechanical construction between them does not have to be exactly the same. The dierence is more evident for low-quality components, and it was stated to be the case under the Iqarus project as well. When two kinds of motors with dierent brands were tested, the more expensive motor proved to be more reliable in terms of providing a more stable sound when running the motor. The performance also plays a roll on the specic propellers used, which can have dimensional dierences. Other components which directly aects the performance is the power source, as well as the Electronic Speed Controller (ESC) for controlling the motors. It also depends on the connection between these components, in terms of type and size of cables as well as the soldering and connection between them.

(10)

From the software side, there is no knowledge of the actual performance the actua-tors will get by sending dierent control-signals. Earlier approaches have been made in the software, using theoretical formulas to estimate the force and modelling the system. The software is therefore required to have hard-coded in-parameters of the hardware con-straints, in order to solve the equations and estimate the force. Another question is, "Is the theoretical calculations of the torque consistent with the actual torque produced?". While it just not depends on the dierence between each motor and propeller used, it also depends on other hardware factors such as stated earlier. In order to distinguish from the theoret-ical estimations of the torque, to rely on the practtheoret-ical outcome, a hardware measurement of the system have to be considered.

1.2 Contribution

The purpose of this project is to sense the force from every actuator, of the normally four used on a quadrocopter, for each control signal sent to the motor. The values will be gathered and stored into the program memory before run-time, and steering commands to the actuators will be done using force data as input, instead of the control signal earlier used. In this way, knowing the amount of force which contributes to actual performance specic for every motor, it is possible to control one of them individually with their own characteristics independently on the actuator line and mainly independently on the spe-cic actuator used. The actuators can be seen as components, which will be possible to exchange, without aecting the performance of the quadrocopter.

Since the actual force not only depends on the current delivered from the power source, but also on the voltage level, a way of reading the power source have to be done. Since the battery is discharging under run-time, the performance in terms of force will decrease, and the force curves must be adjusted according to the battery level to guarantee the proper amount of force.

Tests will be done with dierent models of motors as well as dierent models of pro-pellers, to achieve the dierence in force produced from the actuators. Two motors with the same model and brand will be tested against each other to achieve any motor to motor variation, regarding the mechanical structure and therefore the performance.

The Force-PWM controller will be tested in the lift-o phase, without the PID-controller for stabilisation. This is done to see if the quadrocopter will y right upwards, providing the same amount of force for every actuator. All tests will be done using a prototype of the Iqarus quadrocopter.

1.3 Motivation

This project can be of help concerning any multirotor application, interested to know how the motor and propeller conguration performs in terms of force. One of the main reasons of this project, lies on the modularity concept, in which the pre-calibrated actuators can be seen as individual components possible to exchange without aecting the quadrocopter performance. This subsection will give some more motivations on why this thesis project is done, and what it can tell other developers.

• By looking at the speed of an actuator, one can distinguish from which motor is used. By looking at the force produced from an actuator, one can distinguish both for which motor and propeller conguration is used.

(11)

• Since it is possible to control the actuator independently, it makes an open-controller suitable for all kind of quadrocopters, with some requirements accordingly to control board and memory.

• By achieving the actual performance of the actuator, it is possible to compare theo-retical force with actual force. This in order to achieve a good idea of how theotheo-retical models relates to actual measurements.

• In order to choose the specic motor and propeller combination, the actuators can rst be tested in order to choose regarding the actual performance.

• One could test in terms of force, how fast the motor and propeller combination re-sponds by varying the input signal from the software.

• The project will also contribute to how the force provided by the actuator diers over time, using a stable output from a power supply compared with a discharging battery.

1.4 Outline

In section 2, a detailed information is given about the hardware components used on Iqarus quadrocopter, and what kind of diculties were encountered working with them. The software part is explained concerning the control of navigation and PID-controller for stabilisation.

In section 3, related works regarding quadrocopter control are presented, with a focus on force estimations theoretically and force measurements practically. The diculties and problems which other have encountered are presented, as well as how they have been solved. These works also functions as a basis for the problem that need to be solved in this thesis. In section 4, the problem that need to be solved are presented followed by a detailed description of everything that needs to be done throughout the project. At last, motivation and choice of components are presented to be able to start the work.

In section 5, the hardware process of calibrating the force sensor is presented, as well as how the circuit is constructed for working together with the force sensor. The hardware part of the battery monitor is presented and how the most suitable option was selected.

In section 6, the software method is presented in order to work together with the hardware components and the Arduino, as well as how the Force-PWM controller was implemented regarding force curve adjustment and battery voltage compensation.

In section 7, experiments are made in order to get the force eect over time and to verify the work which have been done in section 5 and 6. Force data of dierent motors and propellers are compared and presented, and the lift-o phase is tested both theoretically and practically.

In section 8, the experiments are analysed and the nal result are presented.

In section 9, the whole work is summarized of what has been done throughout the project.

In section 10, the whole work is discussed and what kind of problems are still there. Suggestions for alternative approaches are presented, as well as what can be developed for future work.

(12)

2

|

Background

2.1 Hardware components of the actuator line

The actuator line on the quadrocopter is made up of a Lithum Polymer (Lipo) battery, ESC, motors and propellers. The ESC gets power from the battery and an input signal in form of a Pulse Width Modulation (PWM)-signal from the control board. The ESC then translates the PWM commands into a 3-phase signal to the Brushless Direct Current (BLDC) motor, which generates a magnetic eld inside the motor to rotate the shaft.

2.1.1 Motors

The motors which are currently used on the Iqarus quadrocopter are T-motor KV1100 (MT2208) (see gure 2.1). The motors are the key aspects regarding the actuator control. The performance of the motor when spinning delivers a torque, which will together with the propeller deliver a thrust (force in upward direction).

Figure 2.1: T-motor KV1100

The T-motor KV1100 is a type of BLDC electronical motor, and further dened as an Outrunner. The BLDC motors have better eciency and longer life time compared to Brushed Direct Current (BDC) electronical motors, due to the lack of brushes. They also have a more accurate positioning of the rotor, relying on sensors (usually Hall-eect sensors) inside the motor, which tells the current rotor position [1]. The Outrunners are usually used for quadrocopter applications heavier than 0.5kg [2], since it can provide 5 to 7 times higher torque then the Inrunners. On the Outrunners, the magnets are placed on the inside part of the shield and the coils forms the stationary center. This makes the whole outer part of the motor spin, including the rotor where the propeller is attached (see gure 2.2).

Figure 2.2: Unmounted BLDC Outrunner motor

The motor is modelled by a circuit containing a resistor, inductor and a voltage gener-ator in series, and the formulas for modelling the motor can be found in [3] and [4]. KV from the motor name, stands for maximum RP M/V olt the motor can handle. According

(13)

to the datasheet [C], where maximum power and current are dened, the maximum RPM is set to be 12210 RPM. Looking further at the datasheet, the conguration is dened as 12N14P, which means that the motor have 14 magnet poles and 12 stationary coils. Number of magnet poles divided by 2, gives the ratio of magnetic eld rotation speed to motor rotation speed. Which means that the motor, inclusive the propeller, is rotating 7 times slower then the magnetic eld surrounded the motor, and the motor rotation per 60◦ yields 8.6◦ of phase shift [5]. The sequence of the 3-phase signal to the motor can be seen in gure 2.3, where the phase sequence is AB-AC-BC-BA-CA-CB [1].

Figure 2.3: Sequence pattern of a 3-phase motor

The power signals alternate the polarity of the electromagnets on the motor stator which keep the rotor spinning [3]. One problem with the motors though, concerning motor to motor variations, is that some variations can be found in unevenly factory windings. Crossing turns and variation in numbers of turns from one arm to another, are things that goes directly into smoothness and performance. Theoretical data of the motor performance usually diers from the experimental, due to non-linearities [4]. These non-linear charac-teristics, due to magnetic material causing saturation and hysteresis, parts producing the eld, friction and intermittent environment contact, are examples of why it diers [6] [7]. These characteristics are more obvious on low-quality components which usually oers a lower price. As an example of a factory wind dierence between two dierent motors, can be seen in gure 2.4.

Figure 2.4: Motor variation between two BLDC motors

The left gure shows parallel strand wires with crossing turns and unevenly winding turns throughout the arms. The right gure shows a rewind with a single larger strand of wire and no obvious crossing turns, which seems to be a better construction.

Propellers

The propellers currently mounted on the Iqarus quadrocopter are of type APC 9x4.7 (see gure 2.5), which are set to be xed-pitch propellers. There are also so called variable-pitch propellers, which are good for small, aggressive and fragile quadrocopters with capability to

(14)

ights upside down, while more complexity are introduced working with them [3] [8]. They APC propellers are made of composite, which is known to be a sti and hard material. The standard measure of propellers is "diameter x pitch" in inches, so the length of the propeller is 9 inches (22.86 centimetres) and the pitch is 4.7 inches (11.93 centimetres). The pitch refers to the angle of incidence at 3

4 of the radius. Using the angle, the pitch

is converted into inches by how far the propeller would move after one revolution [9]. However, discussion says that pitch measurement is not proved to be 100% exact, since the propellers slips in air a bit.

Figure 2.5: APC propeller 9x4.7

Weight of the quadrocopter is proportional to its hover ability [10]. There are three sources of external forces acting on the actuator, which are gravitational eld, air drag and rotations of the blades in the air [11]. According to the airfoil data provided by the motor manufacturers [C], the four APC propellers are able to lift Iqarus quadrocopter's weight of 1.2kg with a throttle of approximately 56% using 11.1V supply. If the airfoil data is not provided, thrust data of the actuators can also be obtained using ”Motrofly” software calculation program [10], with in-parameters of motor, power source and propeller size. There are four propellers mounted on the Iqarus quadrocopter, in which two of them will give a moment in Clockwise (CW) direction (pulling) and the other two in Counter Clockwise (CCW) direction (pushing). The two CW and CCW propellers are mounted opposite each other, to avoid any undesirable yaw rotation. The thrust for each propeller are mainly dependent on rotational speed, air density, angle and area of blade [11]. Introducing the distance between the mass centre of the body and the rotor, the thrust of the whole quadrocopter can be calculated according to [4]. The smaller the propeller the better manoeuvrability [2], but at the same time the higher the rotor speed has to be to get the same lift. A greater angle of the blade will give more lift while being heavier for the motor to spin. A well balanced propeller is important, especially in high rotor speeds, since an unbalanced propeller will induce vibrations into the system [12]. The vibrations are also attributed because of the signicant distance between the motor and propeller, creating a relatively large moment arm over which small disturbance from the propellers are magnied to create large torques about the quadrocopter arms [3]. In [13] it is shown that the vibrations disturbs the IMU-data by ±6◦. The blade geometry does not either

have to be exact from propeller to propeller, even though APC-propellers are known to be reliable and well-balanced from factory.

2.1.2 Lipo battery

The power source currently used on the Iqarus quadrocopter is a Lipo battery Tripple 3S 3000mAh (see gure 2.6), from where all the power is delivered to the quadrocopter. The battery is a standard three cell Lipo battery and weights 254 grams. It can deliver up to 60A of nominal discharge and be loaded with 15A.

(15)

Figure 2.6: Lipo battery Tripple 3S 3000mAh

Suggested batteries for multirotor applications are usually Lipo batteries, since they can deliver a high current for an extended time and are generally smaller in size. All of the batteries have an amount of internal resistance, also known as Equivalent Series Resistance (ESR). As higher C-rating as lower internal resistance. As more the pack is used, as higher internal resistance which makes them run warmer and more current will be pulled out. The nominal voltage of every cell is 3.7V, which makes the total voltage of the battery 11.1V. Every cell can be charged from 2.7V to 4.23V, which in total means 8.1V to 12.69V. However, it is not recommended to discharge the battery to under 9V, since it can damage the battery and decrease the life-time. The motors runs approximately at 4A under ight, and the ight time can therefore be estimated to 11.25 min using following formula 2.1.2, also used in [14].

t = N rcells· 60min Adrawn· N rmotors

= 11.25 min (2.1)

The maximum power of the Lipo battery is 756W, while delivering a current of 16A (four motors) the power demand gets 201.6W. Internal resistance opens up a huge and complex topic of how to accurately calculate voltage drop in the pack and the total amount of watts being expended in form of heat within the pack. The internal resistance can still be estimated by measuring the current in two voltage levels, using the following formula.

Rint=

Vdif f

Adif f (2.2)

As well as the theoretical discharge rate, in terms of voltage over time, can be estimated using the following formula.

V t = Vf ullbattery 3000(mAh)·60(min) A = V · A 180 = 12.69 · 4 180 = 0.282 V /min (2.3) 2.1.3 ESC

The type of ESC used on the Iqarus quadrocopter is Hobbywing Flyfun-18A (see gure 2.7). The controller is the main link of converting the PWM-signal to a three phase signal to the motor (see gure 2.3), with power supplied from the Lipo battery. It is made for motor models demanding less than 18A, while it accepts burst currents of 22A.

(16)

Figure 2.7: Hobbywing Flyfun 18-A

The ESC is controlled by a PWM-signal in a frequency of 50Hz. The signal represents an square wave signal where the signal is varied to be high between 1-2ms each period of 20ms. The signal is also called duty cycle, which is dened in percentage where 1ms yields 0% and 2ms 100% duty cycle. The ESC translate the signal into an amount of voltage and current, sending a sequence of signal for rotation (see gure 3-phase). The signal is sent to the motor, depended on the signal received back from the motor. The signal received, tells the position of the rotor in order to decide which Field Eect Transistor (FET) to switch on, on the ESC. The speed is controlled by varying the length of the time the FETs are high, which is proportional to the duty cycle. The purpose of the ESC is to give the right signal in the right amount of time, which are things that goes directly into smoothness and performance. The ESC never seemed to be a problem throughout the Iqarus project, so no other type of ESC was concluded to be tested in this project.

2.2 Control of Iqarus quadrocopter

2.2.1 Stabilisation

The main heart of the stabilisation is the Inertial Measurement Unit (IMU)-sensor, which provides the current angles of roll, pitch and yaw of the quadrocopter. The IMU-data concerning roll and pitch values are taken as inputs for the PID-controller, in order to achieve the proper amount of PWM-signal to be sent to the motors. Two PID-controllers are implemented in the stabilisation controller, one for roll and one for pitch. The quadro-copter is stabilising in plus formation, which means that the PID-controller for pitch will send +PWM-signal to motor 1 and -PWM-signal to motor 2. The sum of these action will always results in zero. Motor 3 and 4 are proportional as well and concerns the PID-controller for roll (see gure 2.8).

Figure 2.8: Roll and pitch eect on the quadrocopter

The PID-controller [10] [2], is a three-term controller where the proportional term stands for the error between the actual output and the desired output. The integral term accumulates the error over time and the derivative term equals the rate of change of the error. All of these terms are tuned with gain parameters Kp, Ki and Kd and yield the

controller output u(t):

u(t) = Kpe(t) + Ki Z t 0 e(τ )dτ + Kd d dte(t) (2.4)

(17)

By changing these parameters individually, the system's rise time, overshoot, settling time, steady-state error and stability changes. These values are strictly dependently on the quadrocopter body frame, mass, weight and performance. For control of the quadro-copter, as for most of other systems, the fastest response with minimal overshoot should be provided [11]. An explanation of these terms can be seen in following gure.

Figure 2.9: Constants eect on PID-controller

There are alternative ways of nding the proper Kp, Ki and Kdconstants, such as the

Nichols method, the Cohen-Coon method and with manual tuning. The Ziegler-Nichols method was chosen to be rst tested in the Iqarus project, since it is a well known method for quadrocopter application and creates a good lter for rejecting disturbances. To nd the constants, Kp, Ki and Kd are set to zero and Kp is increased until the output

oscillates with constant frequency and amplitude. The control constants are then set from a table [15]. The Ziegler-Nichols method could however not be completed since the test rig never oscillated, so a manual tuning was made instead. The found constants were set to be Kp = 2.2and Kd= 0.4. It was however strongly dependent on the platform itself, which

was changed throughout the project in terms of weight and placement of extra components. The overall conclusion is that the constant are going to be changed, either if the platform changes or the amount of error value changes from PWM-signal to force data.

2.2.2 Navigation

The Iqarus quadrocopter stabilize in a plus-formation, while movements are done in a x-formation. The movements commands can either come from the Computer-Vision sys-tem or a Joystick controller. The movements commands are done by combining adjacent movement commands in the plus formation, which means that movement for forward is obtained by combining the movement commands for forward and right in plus-formation (see gure 2.10).

(18)

The stabilisation controller only takes an input of the calculated degree of movement, to be assumed in the PID-controllers for roll and pitch. This means that no further changes have to be made in the new stabilisation controller, since it can be implemented in the same way as earlier while changing Kp, Ki and Kd settings. A code snippet of the

PID-controller concerning pitch can be seen below, where "PITCH MOVE OFFSET" is the desired movement in degrees.

P = (PITCH_DESIRED+PITCH_MOVE_OFFSET) - att.pitch; I += (PITCH_DESIRED-att.pitch)*timeChange;

D = ((P - errorPitchLast)/timeChange);

2.2.3 RPM measurement

In the Iqarus project, an optical measurement of the motors was done by using reectance sensors of type Pololu QTR-1A, to achieve the RPM-values. The purpose was to get a smooth and slow lift-o by minimizing any dierence between the motors, since the Iqarus quadrocopter had an intention to steer away from the vertical direction it supposed to maintain during the lift-o phase. The RPM speed by applying dierent PWM-signals to the four motors can be seen in table 2.1.

PWM Motor0 Motor1 Motor2 Motor3

1190 192 190 186 150

1200 2507 2661 2620 2261

1210 3150 3140 3200 3060

1220 3720 3650 3640 3600

1230 4140 4150 4110 4030

Table 2.1: RPM speeds when given certain PWM values

The RPM values for the motors proved to be quite dierent in respect to each other, even though the motors were of the same brand and model. To get a high enough resolution of the RPM, longer sampling times are needed. The RPM calculations could therefore only be used before time, since it would take too long time to gather the data under run-time and use it as a control. The motors could however be synchronized by adding an osets values to each motor before run-time. The result proved to be good, while it never became the case when the new and currently T-motor's were used. A smaller dierences could still be seen among some motors, while the PID-controller was let to take care of the inconveniences. It is also said that in the future [8], the quadrocopter can no longer be stabilized through RPM control because the torque required to change the rotational velocity quickly exceeds the capacity of the motor.

(19)

3

|

State of the Art

3.1 Related works

In [3], a test-bench was constructed using a 5 pound (2.27 kg) load cell, to measure the thrust generated by the actuator. The test-bench also includes a current, voltage and optical RPM sensor for measuring the speed (see gure 3.1).

Figure 3.1: Test-bench using a 5 pound load cell

The main goal of the experiment is to test thrust changes using both xed-pitch and variable-pitch propellers, and verify the data to the theoretical data obtained from sim-ulation. It was shown that varying the pitch of the propeller yields fast and almost in-stantaneous thrust changes, in which it was concluded that the variable-pitch actuators fundamentally improve the performance and capability of the quadrocopter.

In [14], the author presents a numerical model based approach on the Combined Mo-mentum and Blade Geometry (CMBET), to aid in the design and selection of the optimum motor. A lot of manufacturers of the Commercial o the Shell (COTS) rotors, does not provide any airfoil data. The CMBET-method have to be measured by sectioning the blade, which is an impractical and inaccurate approach, to further calculate the formulas given in chapter 2.6 [14], The results are then compared with experimental data from the test bench, available to provide a thrust data from the actuator using a digital weight scale (see gure 3.2).

Figure 3.2: Test bench using a digital weight scale

The result showed that the average deviation between the both the results were esti-mated to be 4.6% in terms of thrust and 24.3% in terms of power.

In [12], the input values for the simulation were specied in terms of RPM, which is proportional to the output thrust in Newton. This does not however include any other factors which aects the performance, such as battery power or ineciencies of the actuator line. The thrust of the actuator was therefore measured using a digital weight scale in another construction (see gure 3.3).

(20)

Figure 3.3: Another test bench using a digital weight scale

The data were backed up using a hand held tachometer to verify the relationship between thrust and propeller speed. A future development would be to use a voltage monitor of the battery, to increase the scale of measurement according to the discharge of the battery.

In [16], it is said that motors and propellers are dicult to model because of the de-manding non-linearities imposed by the aerodynamic eects on the propeller. By conduct-ing a simple experiments usconduct-ing a digital weight scale, the motor and propeller combination could be tested for actual performance. The force was further calculated as following.

F (N ) = gm

s2(scale reading(Kg) − zero volt reading(Kg)) (3.1)

The result obtained by measuring the thrust of the four actuators on the quadrocopter, using the same model of motor and propeller, can be seen in gure 3.4.

Figure 3.4: Thrust data of four motors (Sikiric's)

The four curves represent the force output provided by the actuators, and a quite small motor to motor variation could be found between them. A linear approximation (the blue line), was obtained using a least square method on the mean thrust. Further on, a transfer function were obtained to transfer the servo output signal to force, in order to model the system in the software. A representative rise time of 0.3 was conducted and the nal transfer function which was found, can be seen in following formula.

F (s) = 0.027843

0.1s + 1(servo output(s)) (3.2)

Two dierent PID-controllers were compared to each other. A straight forward PID-A controller where Kp, Ki and Kd constants were theoretically calculated and implemented

(21)

in the software. The non-linearities of the motors were however not considered at all. The PID-B controller was used in a dierent approach, where the motor signal was interrupted and set to zero at intervals calculated by the PID-controller. The advantages was that the non-linearities posed by the aerodynamic eects on the propellers did not became as dominant as for the PID-A controller. The later approach was concluded to be the better approach. However, this technique brings diculties such as slower dynamics in the controller because of longer time delays.

A power supply was used during tests to maintain a stable voltage. One motor had maximum a voltage of 9.6V and a current limit of 10A, which required the battery to provide 40A. Since it was hard to nd a battery with such small voltage and high current, a larger battery was used together with a voltage regulator. This allowed the force to be constant, and distinguished the need of using a battery monitor. With 40A of current run-ning in the cables next to the signal cables, it was important to not overlook the shielding. The signal could get contaminated with electrical and magnetic-eld interference.

In [9], a quadrocopter was built using the same board used in Iqarus (Arduino Mega2560) and in [12]. The tuning of the PID-controller was made using Ziegler-Nichols method and Lambda tuning. It was stated, "that not all of the propellers are equal, neither do they have a perfect weight distribution since they are manufactured in large quantities". The plastic propellers required careful balancing to avoid any vibrations composed by running at high RPMs. The propellers were therefore rotated on a fastened spindle shaft by hand, and their nal resting position were observed. If the blades were perfectly balanced, they would end up in a horizontal position which was however not the case, since the bottom section of the blade proved to be heavier. By modifying the propellers using varnish and sanding, the propellers could be balanced all again.

In [12], another approach for balancing the blades were made by using a Hobby Prop Balancer (see gure 3.5). Clear and low prole tape was applied to compensate any inherent instability on the propeller.

Figure 3.5: Hobby Prop Balancer

In [17], the authors presents an unique approach for calculating the thrust demand at a certain height, to be used for the altitude controller. Since the delivered thrust is a function of the command signal and the battery voltage, the feed forwarded term uof f is

included in the following formula 3.1 to achieve the proper thrust uh(t).

uh(t) = Kpeh(t) + Ki Z t 0 eh(τ )dτ + Kd d dteht + uof f(t) (3.3) Where the error is eh(t) = z∗− z and z∗ denotes the desired height, z is the current

measurement and uof f is the feed forwarded term. The true height measurement z is

coupled with pitch and roll angle and can be calculated as following z = cos(θ) cos(φ)ˆz, where ˆz is the sensor measurement. The measured nominal thrust command for hover versus the battery voltage is shown in gure 3.6.

(22)

Figure 3.6: Hover thrust vs. Battery voltage

As higher voltage level on the battery as lower thrust is needed for hovering. It was stated that the Lipo battery used, also had a non-linear discharge curve. The voltage drops signicantly at the start and at the end of discharge, and is continuously decreasing at the mid-zone.

In [13], it is said from experiments that the relation between the control inputs and gen-erated thrust is approximately linear across the regime of useful operation. The identied rising time was set to be 0.2s resulting in a rst order transfer function. The PID-controller was derived by Ziegler-Nichols method and was then manually tuned.

3.2 Summary

After research, it was found that other works have been done in this area with similar problems concerning motors [16] and propeller [9] [12] characteristics, in relation to the Iqarus project. Theoretical estimations of the force have been done, for modelling the system in software [14] [12] [16] [17] [11]. It was also stated that the battery strictly aects the force of the actuator [12] [16] [17]. Force measuring of the actuator have been done in curiosity, by measuring the force using digital weight scales in dierent constructions [14] [12] or by using a load cell [3]. The data have however not been used for controlling the actuators, such as the proposal and purpose for this project.

(23)

4

|

Problem Statement

4.1 Problem to be solved

The problem to be solved, is to minimize system performance sensitivity due to motor dierences such was found in [16] (see gure 3.4) and [2] (see table 2.1). Another problem to be solved, is the dierent thrust aects according to dimensional dierences of the propellers such was found to be the case in [9] [12] [2]. Other factors which directly aect the force, such as the voltage level of the battery [12] [17] [13] and ESC characteristics, also needs to be solved.

Figure 4.1: The problems are going to be solved

By gathering the force data together with the battery voltage, these problems can be avoided and therefore solved. Further problems involves to nd a method for adjusting the force curve to the proper output depending on the battery voltage level, and to test the system in the lift-o phase.

4.2 Project description

To be able to measure the force, a type of force sensor need to be found such that it can give enough precision and be able to output an electronic signal. Such sensor was found to be Vetek Single Point Load Cell 1kg, a load cell which can measure up to 1kg of pressure. The load cell have to be mounted in a way that lets the motor and propeller conguration be mounted of top of it, to achieve the force in an upward direction (see gure 4.2).

Figure 4.2: Vetek Single Point Load cell

The output of the load cell is just a few millivolts, so it would need to be amplied in a circuit using an Instrumentation Amplier (INA). Such component was chosen to be INA125P, which was also used in [18] [19]. The amplied output is going to be connected to one of the analog inputs on the microcontroller, from where the PWM-signals are sent and the motors are controlled. The project is provided by the choice of using one of the two microcontrollers, Arduino Mega2560 or Arduino Due. The dierences and motivations will be discussed in section [4.3]. By sending values of PWM-signals, force and battery voltage

(24)

values will be gathered at the same time and stored into the memory of the Arduino for later use. See gure 4.3 for the system concerning gathering the data before run-time.

Figure 4.3: Gather data before run-time

When the gatherings are done for every motor, a Force-PWM controller will be im-plemented such that it takes the desired force as input and outputs the corresponding PWM-signal to the ESC. See gure 4.4 for the system concerning the process under run-time.

Figure 4.4: Process the data under run-time

The desired force command for the certain motor is received, and the gathered force and battery data for the same motor needs to be present in the controller. The force command will be adjusted depending on the battery voltage when the data was gathered, in relation to the current battery voltage which is read from a battery monitor. The Force-PWM controller will make sure it outputs the correct force command at the current voltage level, by sending the corresponding value of PWM-signal.

4.3 Choice and specication of components

4.3.1 Arduino Mega2560 vs. Arduino Due

The project were given two possibilities of which microcontroller to use, in order to choose the most proper one for the task. Arduino Mega2560 Rev3 is currently used on Iqarus, which would be a safe choice since no further changes have to be made. On the other hand, Arduino Due is faster and the rst Arduino board which uses an 32-bit ARM core processor. The Due is a new microcontroller, which was released in September 2012 while Mega2560 was released in December 2012. A comparison between the specications can be seen in table 4.1.

(25)

Arduino Mega2560 Arduino Due Microcontroller Atmega2560 AT91SAM3X8E

Clock speed 16MHz 84MHz

Operating voltage 3.3V 5V

Digital I/O Pins 54 (15 PWMs) 54 (12 PWM)

Analog Inputs 16 12

Analog Bit Resolution 10-bit 12-bit

Analog Outputs - 2 (DAC)

DC Current per I/O Pin 40 mA 130 mA

DC Current for 3.3V Pin 50 mA 800 mA

DC Current for 5V Pin - 800 mA

Flash Memory 256 KB 512 KB

SRAM 8 KB 96 KB

EEPROM 4 KB

-Table 4.1: Comparision between Mega2560 and Due

The highlighted rows shows the most signicant comparison. Arduino Due provides a 12-bit resolution of the Analog to Digital Converter (ADC), which gives 1024 possible values while Mega2560 with 10-bits resolution gives 4096 possible values. The sensitiv-ity for Mega2560 is 5V/1024values = 4.88mV/value, and for Due 3.3V/4096values = 0.8mV /value. Due's sensitivity would benet the choice, while not having any available Electrically Erasable Programmable Read-Only Memory (EEPROM) which is strictly nec-essary. Since Due is a new release, and the open-source Arduino Development Kit is now in BETA stage, there exists solutions on how to use the ash memory for storing non-erasable data, yet not been established in any conrmed release. While Due only operates at 3.3V as well as the load cell's sensitivity is 5 mV/g after amplication (compared to Due's sensitivity of 0.8 mV/bit), it was stated that Arduino Mega2560 would be a better choice for platform.

4.3.2 Force sensor

The force sensor is a type of Single point load cell 1k, manufactured by Vetek. The load cell is restricted to a maximum load of 1kg, which was chosen for the task. The load cell is constructed with an aluminium material and have four internal strain gauges (see gure 4.5).

Figure 4.5: Load cell construction and strain gauges

As the material holding the strain gauges getting bent by an outside force, the strain gauges sense the deformation on the material (in terms of resistance) and outputs the dierence between them according to the Wheatstone bridge conguration (see gure 4.6).

(26)

Figure 4.6: Wheatstone bridge circuit

The output VG of the Wheatstone bridge circuit is calculated as following.

Vg =  Rx R3+ Rx − R2 R1− R2  Vs (4.1)

When there is no load on the load cell, the output is zero. According to the datasheet [B], the sensitivity is 1mV/V ±20%. This means that if Vin = 5V, the output would be 5mV at 1kg. The output would need to be amplied 1000 times to meet the maximum voltage allowed on the analog input of the Arduino. INA125P [A] will be used for amplifying the signal, which is a small Integrated Circuit (IC) normally used for pressure applications. In theory, with Arduino Mega2560 sensitivity of 4.88mV/value, the gain would need to be set accordingly. G = Arduino (mV /value) Loadcell (mv/g) = 4.88 0.005 = 976 (4.2) 4.3.3 Actuator line

The currently motor used on the quadrocopter is T-motor KV1100 (MT2208) [C]. Another type of motor that will be tested is T-motor KV900 (MT22016-11) [D], which is a smaller motor comparing the KV value while having a higher maximum limit for continuous power and current. Larger quadrocopters requires larger motors which in turn, have larger inertias and can not therefore be controlled as quickly as the smaller motors [8]. T-motor KV900 can deliver a maximum of 9450 RPM while the KV1100 can deliver 12100 RPM. By looking at the datasheet of the two motors, a comparison between them can be obtained. Running them at 11.1V and 75% throttle, with APC-propeller 10x3.8, the performance data can be seen in following table 4.2.

Amps(A) Watts(W) Th(G) Th(OZ) RPM E(G/W) E(OZ/W)

KV900 7,9 87,69 670 23,63 6000 7,64 0,27

KV1100 7,6 84,63 590 20,81 5600 6,99 0,25

Table 4.2: Motor KV900 and KV1100 with prop 10x3.8

Three type of propellers will be tested, everyone with the same brand of APC, but with three dierent size of dimensions 9x4.7, 10x3.8 and 11x4.7. Again, looking at the datasheets of the two motors it is found that 9x4.7 and 10x3.8 were tested on KV1100, and 10x3.8 and 11x4.7 were tested on KV900. See table 4.3 for the performance data using 11.1V with 75% throttle.

(27)

Prop size Amps(A) Watts(W) Th(G) Th(OZ) RPM E(G/W) E(OZ/W)

KV900 10x3.8 7,9 87,69 670 23,63 6000 7,64 0,27

11x4.7 8,6 95,46 730 25,75 5298 7,65 0,27

KV1100 9x4.7 6,4 71,04 500 17,64 6600 7,04 0,25

10x3.8 7,6 84,63 590 20,81 5600 6,99 0,25

Table 4.3: Motor KV900 and KV1100 with prop 9x4.7, 10x3.8 and 11x4.7

The motor with higher KV gives an overall weaker output using 10x3.8 propeller, and specically RPM for interest. As smaller dimension of the propeller as higher velocity in terms of RPM, since it gets less heavier for the motor to spin.

Only one type of ESC HobbyWing Flyfun 18A will be used in this project, which is the same used in Iqarus. Even though the maximum current of T-motor KV900 is 20A, it would never increase the limit of 18A using these propellers. The Lipo battery is the same used in Iqarus project. It maintains to t the requirements as it can deliver up to 60A.

4.4 Summary

A denition of the problem was captured, concerning the problems throughout the Iqarus project which are supported by the problems from other works in section [3]. A solution to the problem was proposed using a load cell to achieve the force. The work that this thesis will cover were formulated, concerning setting up the load cell, gathering the data before run-time and working with the data in the Force-PWM controller under run-time. Section [4.3.1] were given to further understand the area of the work that will be covered. The rst convenience, would be to get the load cell to work.

(28)

5

|

Hardware Process

5.1 Force sensor

5.1.1 Mechanical construction

The force sensor can sense weights in both directions. While it is recommended, due to the construction, to follow the black arrow (see gure 5.1). It does not matter where the force is applied, while it benets the result if the plate is placed as near the load cell as possible.

Figure 5.1: Pressure applied to load cell

A perpendicular aluminium plate (1) was mounted on the front side of the load cell (see gure 5.2), so the motor and propeller combination could be mounted on top of it. The plate was screwed from the side and the plate was ensured to have a small distance (d)from the load cell. Another plate(2)was mounted on top of the load cell, in order to x the position.

Figure 5.2: Plates placed on load cell

The load cell was later strapped in a "working-bench" in order to x the horizontal plate. A picture of the construction can be seen in gure 5.3.

Figure 5.3: Final mechanical construction

5.1.2 Circuit construction

The load cell have ve coloured cables attached, in which Red corresponds to +Excitation, White Excitation, Green +Signal, Blue -Signal, Grey Earth. It is supplied by 5V and both of the ground wires are grounded. The red and white cables are connected to the +

(29)

and - inputs of the INA125P. According to the datasheet of INA125P [A], two circuits of interest can be obtained (see gure 5.4).

Figure 5.4: Suggested circuits for INA125P

The circuit to the left shows how the transistor can be used to improve the output drive capability of the voltage reference. The transistor also serves to remove power from the INA125P. The circuit to the right shows the overall connections and how the external bridge can be connected. The resistance of RG determines the gain and accordingly to [A],

following table can be obtained.

Figure 5.5: Resistor values to specify the gain

A potentiometer will be used to adjust and determine the proper gain in practice. One other potentiometer will be used to determine the oset voltage, in which the bridge "resting position" can be adjusted. Gain and oset resistance goes hand in hand. As higher gain as higher the oset voltage get. It is important to choose the gain to maximum measure 1kg, and to choose the oset voltage as near to zero as possible, which will be covered in the next section [5.1.3]. The nal circuit concerning INA125P settings before the load cell was calibrated can be seen in following gure.

(30)

Figure 5.6: Final circuit for INA125P

5.1.3 Calibrate the circuit to achieve the force

The theoretical gain was set to be 976, which yields that Rg should be around 63 Ohm. The load cell is operating in a linear manner. Since the load cell can sense weight in both direction, it was assumed to be possible to rst get the weight from the load cell when for example the motor and propeller combination have been mounted. This also to ensure that the load cell is working like it should. Dierent gains were tested to change the slope, and the result is shown in following gure.

Figure 5.7: Dierent gain value settings

By switching the red and white cables, so +Excitation goes to Vin- and Excitation goes to Vin+, makes it possible to read the weight in the other direction. Since the weight of the motor is much less then the force produced by the actuator, it is clear that switching cables is not necessary. The purpose of the oset resistor is to increase the voltage output, so the voltage can be decreased by adding a weight. Several oset values were tested and compared, and by changing oset values the lines maintained to be parallel assuming the same gain. See gure 5.8 for the four dierent connections regarding the oset resistor of 470 kOhm placed on either +Excitation or -Excitation to Vin+ or Vin+.

(31)

Figure 5.8: Oset resistor set in four dierent ways

As it can be seen from the gure, the oset resistor should be placed between +Ex-citation and +Vin which corresponds to the yellow line. The yellow line is then working like the red, when +Excitation is connected to -Vin. It is strictly necessary that the volt-age does not falls below 0V after the weight been placed, since it would destroy for later readings. The oset value in terms of grams was found to be 175g according to the yellow line. Subtracting the weight of the perpendicular plate of 60g the oset is set to be 115g. The weight of the T-motor KV1100 is 68g, which yields a margin of 57g to be added for heavier motors. A nal value of 470 kOhm proved to be good enough.

The nal equation for the load cell, using oset resistance of 470 kOhm and gain resistance of 63 Ohm, was achieved by placing weights in the down direction and by looking at the result. The load cell operates in a linear manner, and the equation for the line could be found in Excel (see gure 5.9).

Figure 5.9: Equation found in Excel

The y-axis represents values of grams and the x-axis number of values read from the ADC of Arduino Mega2560. The red line shows the maximum readable values of 870 values and 650 grams, when maximum pressure is applied. The gain was further increased by minimizing the gain resistance to 58.4 Ohm, to achieve a greater range of the readings. The nal equation according to the yellow line, was found to be following.

(32)

5.1.4 LP-lter and EMI rejection

A LP-lter was needed to be implemented, to get rid of noise (in and external) and Electro-magnetic Interference (EMI). First, second and third-order LP-lters were tested, as well as dierent values for the resistors and capacitors. The rst and second-order lters did not seem good enough, so a third-order lter were chosen. See gure 5.10 for tests using dierent LP-lters as well as the software delay between every increment of PWM-signal.

Figure 5.10: LP-lters and software delay timings

It is good to choose a strong LP-lter as possible, without introducing too long delay time. Slowly responding actuators might cause unpredictable behaviour [6]. The circuit was tested visually by inspecting the reaction of the signal, on an oscilloscope, when pres-sure was applied on the load cell. The nal LP-lter was chosen accordingly to the blue line, which shows a third-order LP lter with R1 = 470kOhm, R2 = 100kOhm, R3 = 22kOhm and C1 = 1uF, C2 = 2.2uF + C3 = 10uF. The cut-o frequency got 0.001 Hz and the reaction time proved to be good. The delay time for the test was set to 300ms, while 200ms was nally chosen since it gave the same result. Even though a LP-lter was implemented, there were still interference obtained from the results. Ground and voltage cables from the load cell were twinned together, as well as + and  Excitation cables. The circuit was further improved by adding decoupling capacitors (0.1uF electrolyte and 0.1nF ceramic) between Arduino's 5V output and the circuit, which in turn feeds the load cell. One other ceramic capacitor of 0.1uF was placed between Vrefout and the base input of

the transistor. Two other ceramic capacitors of 10nF were placed on +Vin and -Vin of the INA125P. The result proved to be better with minimized interference.

5.1.5 Gather data from the load cell

Equation 5.1.3 was programmed into the Arduino Mega2560, with the signal from the LP-lter connected to AN0. The program iterates trough all possible PWM-signals and stores the force data temporary. A power supply was used, which was limited to provide 3.16A. By parallel connecting the output of the power supply, a current of 6.32A could be delivered. The rst motor to be tested was T-motor KV1100 with APC 9x4.7, and according to [D] the thrust is 500g at 11.1V when the current is 6.4A which (75% throttle). The result of the gathered data can be seen in following gure.

(33)

Figure 5.11: PS and Lipo dierence on force output

The transfer function from current to sensed torque is of second order [6], which means that the force curve can be approximated in a form of f(x) = x2. The Lipo battery and the

power supply give the same result, while the Lipo can deliver a higher current. This means that the power supply can be used during tests, while in ight a battery will be used. Due to power loss, the Lipo battery can not manage to give a higher force than approximately 600g. Since the motor was applied with 12V, it reached the maximum point earlier at 62% throttle, then if it would be applied with 11.1V. Dierent voltages were applied using a power supply to obtain the dierences (see gure 5.12).

Figure 5.12: Force output of dierent PS voltages

As it can be seen, it is not recommended that the battery falls below 9V, and it is also not recommended that it falls below 9.7V for this motor and propeller conguration. The force curves seems to be relative each other, which means that the oset from one curve to another yields for the rest of the curves at the same force. This would make some things simpler, but unfortunately it is not the case. By looking at how many PWM/Volt are changed at 300g, table 5.1 can be obtained.

(34)

PS (V) PWM Di. (PWM/Volt) 9.7 1572 56.67 10 1555 40 10.5 1535 42 11 1514 29.09 12.1 1482 35 12.5 1468 32 13 1452 26 14 1426 28

Table 5.1: PWM/Volt change of dierent input voltages

It is stated that as higher the supply voltage gets, as lower the dierence in PWM-signal. It will be an important factor for deciding the approach for force curve adjustment in section [6.3].

5.2 Battery monitor

The battery monitor will be used before and under run-time. It is required that the circuit will draw as little current as possible to save battery time. Earlier approaches have been made using hardware components to stop the ight whenever the battery falls below a certain voltage. These approaches that will be presented here, requires the battery monitor to be accessed from the software in order to adjust and control the actuators. Some problems were encountered such as the output from the battery monitor is giving lower values as the PWM-signal is increasing, which gives a higher power demand to the ESC. The problem will be discussed in section [6.2]. The battery monitor was not connected directly at the power source referring to gure 4.3, it was however connected between the power source and ESC since it provides the possibility to exchange power source. Two mainly circuits have been investigated, a simple voltage divider and a voltage divider using a BJT-transistor circuit. Both Lipo battery and power supply were tested in order to see the dierence.

5.2.1 Voltage divider

The ratio of the resistors were chosen to scale down the voltage to maximum 5V, to be connected to the analog input of Arduino. The software then converts the value back to the battery voltage, with use of a mapping function in the Arduino, section [6.1]. The battery monitor was rst made in a simple voltage divider, with high and low resistor values to compare the dierence using a Lipo battery (see gure 5.13).

(35)

Figure 5.13: Voltage divider with high and low resistance

The result showed a small dierence, and the same yields for the power supply. High resistor values were chosen to minimize the current draw and to achieve a better output, but not to high for decreasing the current ow. The chosen values for the voltage divider was set to be R1 = 1.5kOhm and R2 = 3.3kOhm, which gives that the maximum battery voltage of 12.69V gives an output of 3.96V and a current ow of 2.65mA. The circuit was further improved by adding decoupling capacitors and second-order LP-lter which gives a corner frequency of 1.02 Hz. The chosen values for the components can be seen in following gure.

Figure 5.14: Final voltage divider circuit

The dierence between using the LP-lter and not, can be seen in gure 5.15, where as well using a power supply is compared with using a Lipo battery.

(36)

The result obtained by testing both power supply and Lipo battery at various voltage levels, can be seen in following gure.

Figure 5.16: Comparision of battery monitor using PS and Lipo battery

It was stated that the Lipo battery gave a better response then using the power supply, as well as the Lipo battery will be used under run-time.

5.2.2 Voltage divider bias of a BJT transistor

Voltage divider bias is a common way to bias BJT transistors. The resistors help to give complete control over the voltage and current that each region receives in the transistor. And the emitter resistor Re, allows for stability of the gain of the transistor. This circuit

will be used to assure the amount of current delivered from the circuit, in order to avoid the voltage drop or just to maintain a more stable output (see gure 5.17 and formula 5.2.2).

Figure 5.17: BJT Transistor circuit

Vbb= R2 R1+ R2 ∗ Vcc Vre= Vbb− Vbe Ire= Vre Rre Ie= Ic Vrc= Ic∗ Rc (5.2)

R1 and R2 was chosen to scale down the voltage, and Re was chosen to decide the

current. Since Reis equal to Rc, the same current will be drawn over Reand Rc(see gure

(37)

Figure 5.18: BJT Transistor circuit with corresponding values

If the input is 12.69V (maximum), the output will be 3.4V (Ie = 340.1uA). If the input is 9.7 (minimum), the output will be 2.5V (Ie = 248.2uA). The circuit will get a total current draw of 424.14uA. The output voltage is mapped in the software to correspond back to the proper battery voltage. However, the result even showed a higher voltage drop compared to the simple voltage divider (see gure 5.19).

Figure 5.19: Simple voltage divider vs. BJT Transistor

The simple voltage divider were chosen due to lower voltage drop, and to compensate for it will be discussed in section [6.2]. It was stated that the Lipo battery gave a better response then using the power supply. As well as the Lipo battery will be used in ight, the battery monitor readings have to be done using the Lipo battery.

5.3 Summary

The force sensor proved to work like it should, and the power supply and Lipo battery gave the same result according to the force data. More information regarding the software will be discussed in section [6.1]. The battery monitor would however need the Lipo battery to be used, since the power supply gives another appearance. The voltage drop will be compensated by an oset value, which will be stored into the program memory. This will be discussed in section [6.2].

(38)

6

|

Software method

6.1 Read analog inputs from Arduino

The equation which was found for the load cell was f(x) = 0, 7x−150, 46. The equation was implemented to the software and the result was inspected at dierent pressure levels on the load cell. The equation was further improved by modifying it to f(x) = 0, 75x−156, see source code in [G.1]. The load cell is connected to the analog input of (AN0), where one value of the 12-bits ADC corresponds to 4.887585 mV. The x-values are rst sorted in an array of 201 values, before the median is selected and calculated in the above equation. Since the load cell is operating in a linear manner, the "y-intersection" can freely be changed without aecting the slope of the equation. The software is divided into two phases, where the rst phase reads the weight in the down direction, to get how many grams are putted on the load cell. When the load cell is calibrated ('c' is pressed) regarding a well known weight (asked for user input) of the motor and propeller combination exclusive the weight of the perpendicular plate, the program jumps into the second phase. On the second phase, the equation is zerolized (putted to zero) and starts to read the weight in the upward direction to get the response of force. Here it does not matter how the y-intersection have been changed from the rst phase, since the equation works in a linear manner. The main formula, which is calculated in every iteration, is following.

valueEkv = 0.75*value - 156  CALIBRATION_VALUE;

And the rst phase where calibration is done, is calculated as following. valueGramsInt = abs(valueEkv)  START_WEIGHT;

Where START_WEIGHT is the weight for the perpendicular plate. The calibration is calculated as following.

CALIBRATION_VALUE = CALIB_WEIGHT + START_WEIGHT + valueEkv + CALIBRATION_VALUE; Where CALIB_WEIGHT is the motor and propeller weight. The second phase, after it been zerolized is calculated following.

valueGramsInt = valueEkv + ZEROLIZE_VALUE;

Where ZEROLIZE_VALUE is the inverted value of valueEkv, to start the readings from zero.

The battery monitor is connected to (AN1). These values are converted into millivolt according to the ADC, and sorted in an array of 101 values before the median is selected. The median value are later used in a map function, to transfer the range from the ADC (5V) to the actual battery voltage (see following code snippet for map function).

long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; }

(39)

Where long out_max is determined to what the maximum analog output of 5V would correspond to battery voltage input. According to formula 6.1, the output (and long out_max) is calculated to be 15.638V. Vout= R2 R1 + R2Vin=> Vin= R1 + R2 R2 Vout= 100 kOhm + 47 kOhm 47 kOhm 5V = 15, 638V (6.1)

6.2 Compensate for the battery monitor

It was stated that voltage divider was a better choice. One problem is the voltage drop, which occurs as higher PWM-signals are sent to the ESC. As it can be seen in gure 6.1, the voltage have dropped to 10.8V while the actual voltage of the battery is 11.35V.

Figure 6.1: Battery voltage drop

The red curve was achieved by reading the Lipo battery before and after the gathering phase. The blue curve is the battery monitor data read in Arduino. In order to avoid the voltage drop, it was proposed that it could be compensated for in the software. This means that instead of storing the values of the blue curve, the values of the orange oset arrows will be stored (see gure 6.2).

Figure 6.2: Battery voltage compensation

Since the memory is limited, as well as the battery values are somehow jumpy, the data is going to be divided to make an average between every increment of 40 PWM-values in order to smooth out the data. The oset values are now the red lines (see gure 6.3).

(40)

Figure 6.3: Battery voltage compensation with oset values

Every time the battery monitor is read, the oset value will be added to the current battery voltage depending on the PWM-signal sent last time. As higher PWM-signal that was sent, as higher oset will be added.

6.3 Force curve adjustment

There were several approaches for adjusting the force command regarding the current battery voltage. The rst option was to make a reading of the force curve and the battery monitor at the same time, with use of the Lipo battery. The second option was to make two readings of the force curve, one with a Lipo battery and one with a power supply, which would be easier for adjusting the voltage. Or make two readings using the Lipo battery, but then the voltage would have to be drained a bit.

In the rst option, a pre-determined behaviour of the force curve at dierent voltage levels had to be done. This can be achieved by testing the actuator at dierent voltage levels and hard-code the behaviour into the software. One disadvantages though, is that it gets very specied to the specic actuator line used. A more dynamic approach is option two, where everything can be calculated in the software under run-time. It will require more of the EEPROM memory, but it will be enough for this task. The second option have three sub-options (see gure 6.4, 6.5, 6.6) in which every time a force command is sent to the Force-PWM controller, some things needs to be calculated.

Option 2.1.)

Figure 6.4: Force curve adjustment opt. 2.1

Compare the dierence between the two force curves, in the certain force to be applied and subtract or add it according to what the battery level is. Where ∆x = x2 − x1 is the dierence when the desired force is for example 400g.

Figure

Figure 2.4: Motor variation between two BLDC motors
Figure 2.6: Lipo battery Tripple 3S 3000mAh
Figure 2.10: Movement commands on the quadrocopter
Figure 3.2: Test bench using a digital weight scale
+7

References

Related documents

In an effort to promote the utilization of such Immunoscore in routine clinical settings worldwide, the Society for Immunother- apy of Cancer (SITC), the European Academy of

In order to test the parameters presented in this work in an actual biological system, we have performed molecular dynamics simulations of our dummy models for

Lastly, a measuring of the current consumption and supply voltage was done for a Bitroot node prototype to compare with the theoretical power consumption values previously done

For each dataset, a description is provided, as is information on the temporal and spatial domain; the type of event in focus (usually armed conflict or war); how this event

dominium eo mägis ignorat, quod & adftrüereneceilümha- beat, etiam dominium Dei i-. pfiusinres creatas,

Summing all the errors we may thus expect the standard error in the drop height estimate to be of an order around 1 % or less, and a major variation coming from the method of

However in a corporate or large organisation environment it is often the employees who come up with innovative ideas because of their close contacts with consumers of the product

Included in the platform is a web site specific for each customer where all data is presented and there is also a possibility for the customer to upload files containing open