Actuator control using pre-calibrated force data on a ...667198/FULLTEXT01.pdf · Actuator control using pre-calibrated force data on a quadrocopter ... the software module performing

Embed Size (px)

Citation preview

  • Actuator control using pre-calibrated force

    data on a quadrocopter

    Amil LahMaster thesis in Robotics (30 ECTS credits)

    Mlardalens University, IDT

    Supervisor: Giacomo Spampinato

    Examiner: Lars Asplund

    November 20, 2013

  • Abstract

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

    By gathering the force data of the four used on a quadrocopter, the force and controlsignal 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 forceas input and outputs the desired PWM-signal. Tests were made on a prototype of Iqarusquadrocopter and by mounting it with ropes to the oor, it was tested on the lift-ophase. The experiment showed theoretical and practical results, which concludes that thequadrocopter maintained the ability to lift right upwards without any remaining control,assuming proper weight balance of the quadrocopter.

  • Abstrakt

    Inom ygande robotar, r stabilitet kontrollen oerhrt knsligt till styrdonets prestation,och mjukvaru modulen som utfr kontrollen, r ofta frknippad med en lng och problema-tisk justerings fas starkt beroende av de enskilda styrdonen. Styrdonen r ofta elektriskamotorer med propeller. Motor och propeller kombinationen upptrder olika fr varje valav komponent, ven om komponenterna r frsedda frn samma terfrsljare och modell.Syftet med detta projekt r att utveckla en intelligent styrdons modul fr ygande robotar,omfattad av en BLDC motor och propeller, som blir oberoende av den srskilda motor ochpropeller kombination som anvnds.

    Genom att samla kraft data fr de fyra styrdonen som anvnds p en quadrocopter,kunde relationen mellan kraft och kontroll signal bli denierad och lagrad i program minnetfr kontrol kortet. En batteri monitor och en Kraft-PWM kontroller implementerades,vilket tar kraft data som ingng och skickar ut motsvarande PWM-signal som utgng.Tester var gjorda med en prototyp av Iqarus quadrocopter och genom att binda fast denmed rep till golvet, testades den fr upplyfts fasen. Experimenten visade teoretiska ochpraktiska resultat, vilket visar att quadrocoptern bevarade frmgan att lyfta rakt upptutan ngon vrig kontroll, frutsatt ordentlig vikt balans av quadrocoptern.

  • Acknowledgements

    I would like to thank Giacomo Spampinato, which came up with this interesting projectidea 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 Roboticprogram 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 andFredrik Ekstrand for guidelines throughout the Iqarus project and for letting me to usethe prototype of Iqarus quadrocopter.

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

  • Contents

    List of Figures 3

    1 Introduction 51.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.3 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.4 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2 Background 82.1 Hardware components of the actuator line . . . . . . . . . . . . . . . . . . . 8

    2.1.1 Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.1.2 Lipo battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.1.3 ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    2.2 Control of Iqarus quadrocopter . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.1 Stabilisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.2 Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.2.3 RPM measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    3 State of the Art 153.1 Related works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    4 Problem Statement 194.1 Problem to be solved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.2 Project description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.3 Choice and specication of components . . . . . . . . . . . . . . . . . . . . . 20

    4.3.1 Arduino Mega2560 vs. Arduino Due . . . . . . . . . . . . . . . . . . 204.3.2 Force sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3.3 Actuator line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    4.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    5 Hardware Process 245.1 Force sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    5.1.1 Mechanical construction . . . . . . . . . . . . . . . . . . . . . . . . . 245.1.2 Circuit construction . . . . . . . . . . . . . . . . . . . . . . . . . . . 245.1.3 Calibrate the circuit to achieve the force . . . . . . . . . . . . . . . . 265.1.4 LP-lter and EMI rejection . . . . . . . . . . . . . . . . . . . . . . . 285.1.5 Gather data from the load cell . . . . . . . . . . . . . . . . . . . . . 28

    5.2 Battery monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.2.1 Voltage divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.2.2 Voltage divider bias of a BJT transistor . . . . . . . . . . . . . . . . 32

    5.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    1

  • 6 Software method 346.1 Read analog inputs from Arduino . . . . . . . . . . . . . . . . . . . . . . . . 346.2 Compensate for the battery monitor . . . . . . . . . . . . . . . . . . . . . . 356.3 Force curve adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366.4 Gather and store data in Arduino . . . . . . . . . . . . . . . . . . . . . . . . 376.5 Force-PWM controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    7 Experiments 427.1 Force eect over time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427.2 Compare motor and propeller . . . . . . . . . . . . . . . . . . . . . . . . . . 437.3 Testing the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447.4 Testing the lift-o phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    8 Analysing the Results 49

    9 Summary and Conclusion 50

    10 Discussion and Future Work 5210.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5210.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 63G.1 Main function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63G.2 Filter functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66G.3 Write to EEPROM functions . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    H Software: Read and Run 70H.1 Main function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70H.2 Read from EEPROM function . . . . . . . . . . . . . . . . . . . . . . . . . . 71H.3 Force-PWM Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    2

  • List of Figures

    1.1 Iqarus quadrocopter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2.1 T-motor KV1100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2 Unmounted BLDC Outrunner motor . . . . . . . . . . . . . . . . . . . . . . 82.3 Sequence pattern of a 3-phase motor . . . . . . . . . . . . . . . . . . . . . . 92.4 Motor variation between two BLDC motors . . . . . . . . . . . . . . . . . . 92.5 APC propeller 9x4.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.6 Lipo battery Tripple 3S 3000mAh . . . . . . . . . . . . . . . . . . . . . . . . 112.7 Hobbywing Flyfun 18-A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.8 Roll and pitch eect on the quadrocopter . . . . . . . . . . . . . . . . . . . 122.9 Constants eect on PID-controller . . . . . . . . . . . . . . . . . . . . . . . 132.10 Movement commands on the quadrocopter . . . . . . . . . . . . . . . . . . . 13

    3.1 Test-bench using a 5 pound load cell . . . . . . . . . . . . . . . . . . . . . . 153.2 Test bench using a digital weight scale . . . . . . . . . . . . . . . . . . . . . 153.3 Another test bench using a digital weight scale . . . . . . . . . . . . . . . . 163.4 Thrust data of four motors (Sikiric's) . . . . . . . . . . . . . . . . . . . . . . 163.5 Hobby Prop Balancer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.6 Hover thrust vs. Battery voltage . . . . . . . . . . . . . . . . . . . . . . . . 18

    4.1 The problems are going to be solved . . . . . . . . . . . . . . . . . . . . . . 194.2 Vetek Single Point Load cell . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.3 Gather data before run-time . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.4 Process the data under run-time . . . . . . . . . . . . . . . . . . . . . . . . 204.5 Load cell construction and strain gauges . . . . . . . . . . . . . . . . . . . . 214.6 Wheatstone bridge circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    5.1 Pressure applied to load cell . . . . . . . . . . . . . . . . . . . . . . . . . . . 245.2 Plates placed on load cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245.3 Final mechanical construction . . . . . . . . . . . . . . . . . . . . . . . . . . 245.4 Suggested circuits for INA125P . . . . . . . . . . . . . . . . . . . . . . . . . 255.5 Resistor values to specify the gain . . . . . . . . . . . . . . . . . . . . . . . . 255.6 Final circuit for INA125P . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.7 Dierent gain value settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.8 Oset resistor set in four dierent ways . . . . . . . . . . . . . . . . . . . . . 275.9 Equation found in Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.10 LP-lters and software delay timings . . . . . . . . . . . . . . . . . . . . . . 285.11 PS and Lipo dierence on force output . . . . . . . . . . . . . . . . . . . . . 295.12 Force output of dierent PS voltages . . . . . . . . . . . . . . . . . . . . . . 295.13 Voltage divider with high and low resistance . . . . . . . . . . . . . . . . . . 315.14 Final voltage divider circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 315.15 Comparison with using a LP-lter . . . . . . . . . . . . . . . . . . . . . . . 315.16 Comparision of battery monitor using PS and Lipo battery . . . . . . . . . 325.17 BJT Transistor circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325.18 BJT Transistor circuit with corresponding values . . . . . . . . . . . . . . . 335.19 Simple voltage divider vs. BJT Transistor . . . . . . . . . . . . . . . . . . . 33

    3

  • 6.1 Battery voltage drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356.2 Battery voltage compensation . . . . . . . . . . . . . . . . . . . . . . . . . . 356.3 Battery voltage compensation with oset values . . . . . . . . . . . . . . . . 366.4 Force curve adjustment opt. 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . 366.5 Force curve adjustment opt. 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . 376.6 Force curve adjustment opt. 3 . . . . . . . . . . . . . . . . . . . . . . . . . . 376.7 Interesting area of force data . . . . . . . . . . . . . . . . . . . . . . . . . . 386.8 Program ow for Gather and Store . . . . . . . . . . . . . . . . . . . . . . . 396.9 Program ow for battery compensation . . . . . . . . . . . . . . . . . . . . . 40

    7.1 Current to force relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427.2 Current and force over time . . . . . . . . . . . . . . . . . . . . . . . . . . . 427.3 Force line at 400g and 300g over time . . . . . . . . . . . . . . . . . . . . . . 437.4 Dierence between two motors . . . . . . . . . . . . . . . . . . . . . . . . . 437.5 Dierence between two motors and three propellers . . . . . . . . . . . . . . 447.6 Four rst force curves to be stored . . . . . . . . . . . . . . . . . . . . . . . 447.7 Filtered force curve vs. Original . . . . . . . . . . . . . . . . . . . . . . . . . 457.8 Resulting battery voltage (red line) . . . . . . . . . . . . . . . . . . . . . . . 457.9 Resulting battery voltage (red line) under run-time . . . . . . . . . . . . . . 457.10 First, second and estimated force curve . . . . . . . . . . . . . . . . . . . . . 457.11 Four motors with 1st and 2nd force curves . . . . . . . . . . . . . . . . . . . 467.12 The four desired PWM-signals . . . . . . . . . . . . . . . . . . . . . . . . . 477.13 Quadrocopter mounted to the oor . . . . . . . . . . . . . . . . . . . . . . . 47

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

    4

  • 1 | Introduction

    1.1 Background

    This project is currently based on the quadrocopter project named Iqarus, which wasdeveloped in a project course in Mlardalens University by 13 Master students. Themain goal of the project was to have 4-5 autonomous quadrocopters with one leader inthe front, following each other like a train. By communicate via bluetooth and perceivethe environment using Computer-Vision system through a camera, the quadrocopters canshare 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 todevelop 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 asthe power source and the speed controller used. This is what is called to be the actuatorline and involves (power source electronic speed controller motor propeller). Thisthesis also aims to make a open controller, which can be used for several applications whilethe 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 tachometerand Revolutions Per Minute (RPM)-sensors. Other attempts were made by looking atthe 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 "Whattype of data is the most reliable?" and "What data is set to be the most reliable in termsof performance?". In order to guarantee reliable values, a more dedicated measure of theactual performance had to be done. This was not the case in the project, due to lackof 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 constructionbetween them does not have to be exactly the same. The dierence is more evident forlow-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 motorproved to be more reliable in terms of providing a more stable sound when running themotor. The performance also plays a roll on the specic propellers used, which can havedimensional dierences. Other components which directly aects the performance is thepower 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 ofcables as well as the soldering and connection between them.

    5

  • 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 inthe 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 thetheoretical calculations of the torque consistent with the actual torque produced?". While itjust not depends on the dierence between each motor and propeller used, it also dependson other hardware factors such as stated earlier. In order to distinguish from the theoret-ical estimations of the torque, to rely on the practical outcome, a hardware measurementof 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 fourused on a quadrocopter, for each control signal sent to the motor. The values will begathered and stored into the program memory before run-time, and steering commands tothe actuators will be done using force data as input, instead of the control signal earlierused. In this way, knowing the amount of force which contributes to actual performancespecic for every motor, it is possible to control one of them individually with their owncharacteristics 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 toexchange, 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 thebattery is discharging under run-time, the performance in terms of force will decrease, andthe force curves must be adjusted according to the battery level to guarantee the properamount 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 withthe same model and brand will be tested against each other to achieve any motor to motorvariation, regarding the mechanical structure and therefore the performance.

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

    1.3 Motivation

    This project can be of help concerning any multirotor application, interested to know howthe motor and propeller conguration performs in terms of force. One of the main reasonsof this project, lies on the modularity concept, in which the pre-calibrated actuators canbe seen as individual components possible to exchange without aecting the quadrocopterperformance. This subsection will give some more motivations on why this thesis projectis 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 whichmotor and propeller conguration is used.

    6

  • Since it is possible to control the actuator independently, it makes an open-controllersuitable for all kind of quadrocopters, with some requirements accordingly to controlboard 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 theoreticalmodels relates to actual measurements.

    In order to choose the specic motor and propeller combination, the actuators canrst 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 overtime, 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 onIqarus quadrocopter, and what kind of diculties were encountered working with them.The software part is explained concerning the control of navigation and PID-controller forstabilisation.

    In section 3, related works regarding quadrocopter control are presented, with a focuson force estimations theoretically and force measurements practically. The diculties andproblems 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 detaileddescription of everything that needs to be done throughout the project. At last, motivationand 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 wellas how the circuit is constructed for working together with the force sensor. The hardwarepart 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 thehardware components and the Arduino, as well as how the Force-PWM controller wasimplemented regarding force curve adjustment and battery voltage compensation.

    In section 7, experiments are made in order to get the force eect over time and toverify the work which have been done in section 5 and 6. Force data of dierent motors andpropellers are compared and presented, and the lift-o phase is tested both theoreticallyand 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 forfuture work.

    7

  • 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 signalin form of a Pulse Width Modulation (PWM)-signal from the control board. The ESCthen 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 withthe 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 asan Outrunner. The BLDC motors have better eciency and longer life time comparedto Brushed Direct Current (BDC) electronical motors, due to the lack of brushes. Theyalso have a more accurate positioning of the rotor, relying on sensors (usually Hall-eectsensors) inside the motor, which tells the current rotor position [1]. The Outrunners areusually used for quadrocopter applications heavier than 0.5kg [2], since it can provide 5to 7 times higher torque then the Inrunners. On the Outrunners, the magnets are placedon the inside part of the shield and the coils forms the stationary center. This makes thewhole outer part of the motor spin, including the rotor where the propeller is attached (seegure 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]. KVfrom the motor name, stands for maximum RPM/V olt the motor can handle. According

    8

  • to the datasheet [C], where maximum power and current are dened, the maximum RPMis set to be 12210 RPM. Looking further at the datasheet, the conguration is denedas 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 tomotor rotation speed. Which means that the motor, inclusive the propeller, is rotating 7times slower then the magnetic eld surrounded the motor, and the motor rotation per60 yields 8.6 of phase shift [5]. The sequence of the 3-phase signal to the motor can beseen 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 statorwhich keep the rotor spinning [3]. One problem with the motors though, concerning motorto 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 thatgoes directly into smoothness and performance. Theoretical data of the motor performanceusually diers from the experimental, due to non-linearities [4]. These non-linear charac-teristics, due to magnetic material causing saturation and hysteresis, parts producing theeld, 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 alower price. As an example of a factory wind dierence between two dierent motors, canbe 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 windingturns throughout the arms. The right gure shows a rewind with a single larger strand ofwire 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 (seegure 2.5), which are set to be xed-pitch propellers. There are also so called variable-pitchpropellers, which are good for small, aggressive and fragile quadrocopters with capability to

    9

  • ights upside down, while more complexity are introduced working with them [3] [8]. TheyAPC 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 thepropeller 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 34 of the radius. Using the angle, the pitchis 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, sincethe 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 threesources of external forces acting on the actuator, which are gravitational eld, air dragand rotations of the blades in the air [11]. According to the airfoil data provided by themotor manufacturers [C], the four APC propellers are able to lift Iqarus quadrocopter'sweight of 1.2kg with a throttle of approximately 56% using 11.1V supply. If the airfoildata is not provided, thrust data of the actuators can also be obtained using Motroflysoftware calculation program [10], with in-parameters of motor, power source and propellersize. There are four propellers mounted on the Iqarus quadrocopter, in which two ofthem will give a moment in Clockwise (CW) direction (pulling) and the other two inCounter Clockwise (CCW) direction (pushing). The two CW and CCW propellers aremounted opposite each other, to avoid any undesirable yaw rotation. The thrust for eachpropeller 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 ofthe whole quadrocopter can be calculated according to [4]. The smaller the propeller thebetter manoeuvrability [2], but at the same time the higher the rotor speed has to be toget the same lift. A greater angle of the blade will give more lift while being heavier forthe 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 vibrationsare also attributed because of the signicant distance between the motor and propeller,creating a relatively large moment arm over which small disturbance from the propellersare magnied to create large torques about the quadrocopter arms [3]. In [13] it is shownthat the vibrations disturbs the IMU-data by 6. The blade geometry does not eitherhave to be exact from propeller to propeller, even though APC-propellers are known to bereliable and well-balanced from factory.

    2.1.2 Lipo battery

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

    10

  • Figure 2.6: Lipo battery Tripple 3S 3000mAh

    Suggested batteries for multirotor applications are usually Lipo batteries, since theycan deliver a high current for an extended time and are generally smaller in size. All of thebatteries 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 higherinternal 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 battery11.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 damagethe 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 =Nrcells 60min

    Adrawn Nrmotors= 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 andcomplex topic of how to accurately calculate voltage drop in the pack and the total amountof watts being expended in form of heat within the pack. The internal resistance can stillbe estimated by measuring the current in two voltage levels, using the following formula.

    Rint =VdiffAdiff

    (2.2)

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

    V

    t=

    Vfullbattery3000(mAh)60(min)

    A

    =V A180

    =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 gure2.7). The controller is the main link of converting the PWM-signal to a three phase signalto the motor (see gure 2.3), with power supplied from the Lipo battery. It is made formotor models demanding less than 18A, while it accepts burst currents of 22A.

    11

  • Figure 2.7: Hobbywing Flyfun 18-A

    The ESC is controlled by a PWM-signal in a frequency of 50Hz. The signal representsan square wave signal where the signal is varied to be high between 1-2ms each period of20ms. The signal is also called duty cycle, which is dened in percentage where 1ms yields0% and 2ms 100% duty cycle. The ESC translate the signal into an amount of voltage andcurrent, sending a sequence of signal for rotation (see gure 3-phase). The signal is sent tothe motor, depended on the signal received back from the motor. The signal received, tellsthe position of the rotor in order to decide which Field Eect Transistor (FET) to switchon, on the ESC. The speed is controlled by varying the length of the time the FETs arehigh, which is proportional to the duty cycle. The purpose of the ESC is to give the rightsignal in the right amount of time, which are things that goes directly into smoothnessand 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, whichprovides the current angles of roll, pitch and yaw of the quadrocopter. The IMU-dataconcerning roll and pitch values are taken as inputs for the PID-controller, in order toachieve the proper amount of PWM-signal to be sent to the motors. Two PID-controllersare 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 willsend +PWM-signal to motor 1 and -PWM-signal to motor 2. The sum of these actionwill always results in zero. Motor 3 and 4 are proportional as well and concerns thePID-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 termstands for the error between the actual output and the desired output. The integral termaccumulates the error over time and the derivative term equals the rate of change of theerror. All of these terms are tuned with gain parameters Kp, Ki and Kd and yield thecontroller output u(t):

    u(t) = Kpe(t) +Ki

    t0e()d +Kd

    d

    dte(t) (2.4)

    12

  • By changing these parameters individually, the system's rise time, overshoot, settlingtime, steady-state error and stability changes. These values are strictly dependently onthe 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 shouldbe 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 Kd constants, such as theZiegler-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 knownmethod 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 outputoscillates with constant frequency and amplitude. The control constants are then set froma table [15]. The Ziegler-Nichols method could however not be completed since the test rignever oscillated, so a manual tuning was made instead. The found constants were set to beKp = 2.2 and Kd = 0.4. It was however strongly dependent on the platform itself, whichwas 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 platformchanges 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 ax-formation. The movements commands can either come from the Computer-Vision sys-tem or a Joystick controller. The movements commands are done by combining adjacentmovement commands in the plus formation, which means that movement for forward isobtained by combining the movement commands for forward and right in plus-formation(see gure 2.10).

    Figure 2.10: Movement commands on the quadrocopter

    13

  • 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 changeshave to be made in the new stabilisation controller, since it can be implemented in thesame 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 thedesired 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 reectancesensors of type Pololu QTR-1A, to achieve the RPM-values. The purpose was to get asmooth and slow lift-o by minimizing any dierence between the motors, since the Iqarusquadrocopter had an intention to steer away from the vertical direction it supposed tomaintain during the lift-o phase. The RPM speed by applying dierent PWM-signals tothe four motors can be seen in table 2.1.

    PWM Motor0 Motor1 Motor2 Motor31190 192 190 186 1501200 2507 2661 2620 22611210 3150 3140 3200 30601220 3720 3650 3640 36001230 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 resolutionof the RPM, longer sampling times are needed. The RPM calculations could therefore onlybe used before run-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 anosets values to each motor before run-time. The result proved to be good, while it neverbecame the case when the new and currently T-motor's were used. A smaller dierencescould still be seen among some motors, while the PID-controller was let to take care ofthe inconveniences. It is also said that in the future [8], the quadrocopter can no longerbe stabilized through RPM control because the torque required to change the rotationalvelocity quickly exceeds the capacity of the motor.

    14

  • 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 thethrust generated by the actuator. The test-bench also includes a current, voltage andoptical 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 andvariable-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 actuatorsfundamentally 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 optimummotor. A lot of manufacturers of the Commercial o the Shell (COTS) rotors, does notprovide any airfoil data. The CMBET-method have to be measured by sectioning theblade, which is an impractical and inaccurate approach, to further calculate the formulasgiven in chapter 2.6 [14], The results are then compared with experimental data from thetest 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 isproportional to the output thrust in Newton. This does not however include any otherfactors which aects the performance, such as battery power or ineciencies of the actuatorline. The thrust of the actuator was therefore measured using a digital weight scale inanother construction (see gure 3.3).

    15

  • Figure 3.3: Another test bench using a digital weight scale

    The data were backed up using a hand held tachometer to verify the relationshipbetween thrust and propeller speed. A future development would be to use a voltagemonitor of the battery, to increase the scale of measurement according to the discharge ofthe 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 using a digital weight scale, the motor and propeller combinationcould 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 smallmotor to motor variation could be found between them. A linear approximation (the blueline), was obtained using a least square method on the mean thrust. Further on, a transferfunction were obtained to transfer the servo output signal to force, in order to model thesystem in the software. A representative rise time of 0.3 was conducted and the naltransfer 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-Acontroller where Kp, Ki and Kd constants were theoretically calculated and implemented

    16

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

    A power supply was used during tests to maintain a stable voltage. One motor hadmaximum a voltage of 9.6V and a current limit of 10A, which required the battery toprovide 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 beconstant, 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 andLambda tuning. It was stated, "that not all of the propellers are equal, neither do theyhave a perfect weight distribution since they are manufactured in large quantities". Theplastic propellers required careful balancing to avoid any vibrations composed by runningat 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, theywould end up in a horizontal position which was however not the case, since the bottomsection of the blade proved to be heavier. By modifying the propellers using varnish andsanding, the propellers could be balanced all again.

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

    Figure 3.5: Hobby Prop Balancer

    In [17], the authors presents an unique approach for calculating the thrust demandat a certain height, to be used for the altitude controller. Since the delivered thrust is afunction of the command signal and the battery voltage, the feed forwarded term uoff isincluded in the following formula 3.1 to achieve the proper thrust uh(t).

    uh(t) = Kpeh(t) +Ki

    t0eh()d +Kd

    d

    dteht+ uoff (t) (3.3)

    Where the error is eh(t) = z z and z denotes the desired height, z is the currentmeasurement and uoff is the feed forwarded term. The true height measurement z iscoupled 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 hoverversus the battery voltage is shown in gure 3.6.

    17

  • Figure 3.6: Hover thrust vs. Battery voltage

    As higher voltage level on the battery as lower thrust is needed for hovering. It wasstated that the Lipo battery used, also had a non-linear discharge curve. The voltage dropssignicantly at the start and at the end of discharge, and is continuously decreasing at themid-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 identiedrising time was set to be 0.2s resulting in a rst order transfer function. The PID-controllerwas 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 similarproblems concerning motors [16] and propeller [9] [12] characteristics, in relation to theIqarus project. Theoretical estimations of the force have been done, for modelling thesystem in software [14] [12] [16] [17] [11]. It was also stated that the battery strictly aectsthe force of the actuator [12] [16] [17]. Force measuring of the actuator have been done incuriosity, 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 theactuators, such as the proposal and purpose for this project.

    18

  • 4 | Problem Statement

    4.1 Problem to be solved

    The problem to be solved, is to minimize system performance sensitivity due to motordierences such was found in [16] (see gure 3.4) and [2] (see table 2.1). Another problemto be solved, is the dierent thrust aects according to dimensional dierences of thepropellers such was found to be the case in [9] [12] [2]. Other factors which directly aectthe 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 beavoided and therefore solved. Further problems involves to nd a method for adjusting theforce curve to the proper output depending on the battery voltage level, and to test thesystem 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 cangive enough precision and be able to output an electronic signal. Such sensor was found tobe 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 congurationbe 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 ampliedin a circuit using an Instrumentation Amplier (INA). Such component was chosen to beINA125P, which was also used in [18] [19]. The amplied output is going to be connectedto one of the analog inputs on the microcontroller, from where the PWM-signals are sentand the motors are controlled. The project is provided by the choice of using one of the twomicrocontrollers, Arduino Mega2560 or Arduino Due. The dierences and motivations willbe discussed in section [4.3]. By sending values of PWM-signals, force and battery voltage

    19

  • values will be gathered at the same time and stored into the memory of the Arduino forlater 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 correspondingPWM-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 andbattery data for the same motor needs to be present in the controller. The force commandwill be adjusted depending on the battery voltage when the data was gathered, in relationto the current battery voltage which is read from a battery monitor. The Force-PWMcontroller 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 choosethe 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 otherhand, Arduino Due is faster and the rst Arduino board which uses an 32-bit ARM coreprocessor. The Due is a new microcontroller, which was released in September 2012 whileMega2560 was released in December 2012. A comparison between the specications canbe seen in table 4.1.

    20

  • Arduino Mega2560 Arduino DueMicrocontroller Atmega2560 AT91SAM3X8EClock speed 16MHz 84MHz

    Operating voltage 3.3V 5VDigital I/O Pins 54 (15 PWMs) 54 (12 PWM)Analog Inputs 16 12

    Analog Bit Resolution 10-bit 12-bitAnalog Outputs - 2 (DAC)

    DC Current per I/O Pin 40 mA 130 mADC Current for 3.3V Pin 50 mA 800 mADC Current for 5V Pin - 800 mA

    Flash Memory 256 KB 512 KBSRAM 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 providesa 12-bit resolution of the Analog to Digital Converter (ADC), which gives 1024 possiblevalues 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 availableElectrically 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 nowin 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 operatesat 3.3V as well as the load cell's sensitivity is 5 mV/g after amplication (compared toDue's sensitivity of 0.8 mV/bit), it was stated that Arduino Mega2560 would be a betterchoice for platform.

    4.3.2 Force sensor

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

    Figure 4.5: Load cell construction and strain gauges

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

    21

  • Figure 4.6: Wheatstone bridge circuit

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

    Vg =

    (Rx

    R3 +Rx R2R1 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 5mVat 1kg. The output would need to be amplied 1000 times to meet the maximum voltageallowed on the analog input of the Arduino. INA125P [A] will be used for amplifying thesignal, which is a small Integrated Circuit (IC) normally used for pressure applications. Intheory, with Arduino Mega2560 sensitivity of 4.88mV/value, the gain would need to beset 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]. Anothertype of motor that will be tested is T-motor KV900 (MT22016-11) [D], which is a smallermotor comparing the KV value while having a higher maximum limit for continuous powerand current. Larger quadrocopters requires larger motors which in turn, have larger inertiasand can not therefore be controlled as quickly as the smaller motors [8]. T-motor KV900can deliver a maximum of 9450 RPM while the KV1100 can deliver 12100 RPM. By lookingat the datasheet of the two motors, a comparison between them can be obtained. Runningthem at 11.1V and 75% throttle, with APC-propeller 10x3.8, the performance data can beseen 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,27KV1100 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, butwith three dierent size of dimensions 9x4.7, 10x3.8 and 11x4.7. Again, looking at thedatasheets 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 using11.1V with 75% throttle.

    22

  • 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,2711x4.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,2510x3.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, andspecically RPM for interest. As smaller dimension of the propeller as higher velocity interms 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 isthe same used in Iqarus. Even though the maximum current of T-motor KV900 is 20A, itwould never increase the limit of 18A using these propellers. The Lipo battery is the sameused 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 Iqarusproject which are supported by the problems from other works in section [3]. A solutionto the problem was proposed using a load cell to achieve the force. The work that thisthesis will cover were formulated, concerning setting up the load cell, gathering the databefore 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.

    23

  • 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 tothe construction, to follow the black arrow (see gure 5.1). It does not matter where theforce is applied, while it benets the result if the plate is placed as near the load cell aspossible.

    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 tox 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 horizontalplate. 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 andboth of the ground wires are grounded. The red and white cables are connected to the +

    24

  • and - inputs of the INA125P. According to the datasheet of INA125P [A], two circuits ofinterest 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 outputdrive capability of the voltage reference. The transistor also serves to remove power fromthe INA125P. The circuit to the right shows the overall connections and how the externalbridge 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. Ashigher gain as higher the oset voltage get. It is important to choose the gain to maximummeasure 1kg, and to choose the oset voltage as near to zero as possible, which will becovered in the next section [5.1.3]. The nal circuit concerning INA125P settings beforethe load cell was calibrated can be seen in following gure.

    25

  • 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 bothdirection, it was assumed to be possible to rst get the weight from the load cell whenfor example the motor and propeller combination have been mounted. This also to ensurethat 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 Excitationgoes to Vin+, makes it possible to read the weight in the other direction. Since the weightof the motor is much less then the force produced by the actuator, it is clear that switchingcables 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 andcompared, and by changing oset values the lines maintained to be parallel assuming thesame gain. See gure 5.8 for the four dierent connections regarding the oset resistor of470 kOhm placed on either +Excitation or -Excitation to Vin+ or Vin+.

    26

  • 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 workinglike 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 laterreadings. The oset value in terms of grams was found to be 175g according to the yellowline. 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 forheavier 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 gainresistance of 63 Ohm, was achieved by placing weights in the down direction and bylooking at the result. The load cell operates in a linear manner, and the equation for theline 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 theADC of Arduino Mega2560. The red line shows the maximum readable values of 870 valuesand 650 grams, when maximum pressure is applied. The gain was further increased byminimizing 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.

    f(x) = 0.7x 150.46 (5.1)

    27

  • 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 wellas dierent values for the resistors and capacitors. The rst and second-order lters didnot seem good enough, so a third-order lter were chosen. See gure 5.10 for tests usingdierent 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 delaytime. Slowly responding actuators might cause unpredictable behaviour [6]. The circuitwas 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 blueline, 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 Hzand 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 wasimplemented, there were still interference obtained from the results. Ground and voltagecables from the load cell were twinned together, as well as + and Excitation cables. Thecircuit was further improved by adding decoupling capacitors (0.1uF electrolyte and 0.1nFceramic) 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 ofthe transistor. Two other ceramic capacitors of 10nF were placed on +Vin and -Vin of theINA125P. 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 storesthe force data temporary. A power supply was used, which was limited to provide 3.16A. Byparallel 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 ofthe gathered data can be seen in following gure.

    28

  • Figure 5.11: PS and Lipo dierence on force output

    The transfer function from current to sensed torque is of second order [6], which meansthat the force curve can be approximated in a form of f(x) = x2. The Lipo battery and thepower supply give the same result, while the Lipo can deliver a higher current. This meansthat the power supply can be used during tests, while in ight a battery will be used. Dueto power loss, the Lipo battery can not manage to give a higher force than approximately600g. 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 apower 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 alsonot recommended that it falls below 9.7V for this motor and propeller conguration. Theforce curves seems to be relative each other, which means that the oset from one curve toanother yields for the rest of the curves at the same force. This would make some thingssimpler, but unfortunately it is not the case. By looking at how many PWM/Volt arechanged at 300g, table 5.1 can be obtained.

    29

  • PS (V) PWM Di. (PWM/Volt)

    9.7 1572 56.6710 1555 4010.5 1535 4211 1514 29.0912.1 1482 3512.5 1468 3213 1452 2614 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 adjustmentin section [6.3].

    5.2 Battery monitor

    The battery monitor will be used before and under run-time. It is required that thecircuit will draw as little current as possible to save battery time. Earlier approacheshave been made using hardware components to stop the ight whenever the battery fallsbelow a certain voltage. These approaches that will be presented here, requires the batterymonitor to be accessed from the software in order to adjust and control the actuators. Someproblems were encountered such as the output from the battery monitor is giving lowervalues 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 connecteddirectly at the power source referring to gure 4.3, it was however connected betweenthe power source and ESC since it provides the possibility to exchange power source. Twomainly circuits have been investigated, a simple voltage divider and a voltage divider usinga BJT-transistor circuit. Both Lipo battery and power supply were tested in order to seethe dierence.

    5.2.1 Voltage divider

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

    30

  • Figure 5.13: Voltage divider with high and low resistance

    The result showed a small dierence, and the same yields for the power supply. Highresistor 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 dividerwas set to be R1 = 1.5kOhm and R2 = 3.3kOhm, which gives that the maximum batteryvoltage of 12.69V gives an output of 3.96V and a current ow of 2.65mA. The circuit wasfurther improved by adding decoupling capacitors and second-order LP-lter which gives acorner frequency of 1.02 Hz. The chosen values for the components can be seen in followinggure.

    Figure 5.14: Final voltage divider circuit

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

    Figure 5.15: Comparison with using a LP-lter

    31

  • The result obtained by testing both power supply and Lipo battery at various voltagelevels, 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 givecomplete 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 circuitwill be used to assure the amount of current delivered from the circuit, in order to avoidthe voltage drop or just to maintain a more stable output (see gure 5.17 and formula5.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 thecurrent. Since Re is equal to Rc, the same current will be drawn over Re and Rc (see gure5.18).

    32

  • 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 inputis 9.7 (minimum), the output will be 2.5V (Ie = 248.2uA). The circuit will get a totalcurrent draw of 424.14uA. The output voltage is mapped in the software to correspondback to the proper battery voltage. However, the result even showed a higher voltage dropcompared 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 compensatefor it will be discussed in section [6.2]. It was stated that the Lipo battery gave a betterresponse 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 gavethe same result according to the force data. More information regarding the software willbe discussed in section [6.1]. The battery monitor would however need the Lipo batteryto be used, since the power supply gives another appearance. The voltage drop will becompensated by an oset value, which will be stored into the program memory. This willbe discussed in section [6.2].

    33

  • 6 | Software method

    6.1 Read analog inputs from Arduino

    The equation which was found for the load cell was f(x) = 0, 7x150, 46. The equationwas implemented to the software and the result was inspected at dierent pressure levelson the load cell. The equation was further improved by modifying it to f(x) = 0, 75x156,see source code in [G.1]. The load cell is connected to the analog input of (AN0), whereone value of the 12-bits ADC corresponds to 4.887585 mV. The x-values are rst sorted inan 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 changedwithout aecting the slope of the equation. The software is divided into two phases, wherethe rst phase reads the weight in the down direction, to get how many grams are puttedon the load cell. When the load cell is calibrated ('c' is pressed) regarding a well knownweight (asked for user input) of the motor and propeller combination exclusive the weight ofthe 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 upwarddirection to get the response of force. Here it does not matter how the y-intersection havebeen changed from the rst phase, since the equation works in a linear manner. The mainformula, 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 calibrationis calculated as following.

    CALIBRATION_VALUE = CALIB_WEIGHT + START_WEIGHT + valueEkv + CALIBRATION_VALUE;

    Where CALIB_WEIGHT is the motor and propeller weight. The second phase, afterit been zerolized is calculated following.

    valueGramsInt = valueEkv + ZEROLIZE_VALUE;

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

    The battery monitor is connected to (AN1). These values are converted into millivoltaccording 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; }

    34

  • Where long out_max is determined to what the maximum analog output of 5V wouldcorrespond to battery voltage input. According to formula 6.1, the output (and longout_max ) is calculated to be 15.638V.

    Vout =R2

    R1 +R2Vin => Vin =

    R1 +R2

    R2Vout =

    100 kOhm+ 47 kOhm

    47 kOhm5V = 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 gatheringphase. The blue curve is the battery monitor data read in Arduino. In order to avoidthe voltage drop, it was proposed that it could be compensated for in the software. Thismeans that instead of storing the values of the blue curve, the values of the orange osetarrows 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 datais going to be divided to make an average between every increment of 40 PWM-values inorder to smooth out the data. The oset values are now the red lines (see gure 6.3).

    35

  • Figure 6.3: Battery voltage compensation with oset values

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

    6.3 Force curve adjustment

    There were several approaches for adjusting the force command regarding the currentbattery voltage. The rst option was to make a reading of the force curve and the batterymonitor at the same time, with use of the Lipo battery. The second option was to maketwo 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 Lipobattery, 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 voltagelevels had to be done. This can be achieved by testing the actuator at dierent voltagelevels and hard-code the behaviour into the software. One disadvantages though, is that itgets very specied to the specic actuator line used. A more dynamic approach is optiontwo, where everything can be calculated in the software under run-time. It will requiremore of the EEPROM memory, but it will be enough for this task. The second option havethree sub-options (see gure 6.4, 6.5, 6.6) in which every time a force command is sent tothe 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 appliedand subtract or add it according to what the battery level is. Where x = x2 x1 is thedierence when the desired force is for example 400g.

    Option 2.2.)

    36

  • Figure 6.5: Force curve adjustment opt. 2.3

    Calculate "x" and "b" degrees to the x-axis of the two lines which are pointing to thedesired force we want to apply, to get "how many degrees are changed per volt". Use thedegree to rotate the initial line (in this example "x") around the z-axis using a transforma-tion matrix, with a degree of rotation depending on what the battery monitor says. Thennd the right PWM-signal according to the rotated line. This approach is more dynamic,since the new lines will change according to the desired force to be applied as well as ofthe battery value.

    Option 2.3.)

    Figure 6.6: Force curve adjustment opt. 3

    This approach would be to use an constant line for the initial force curve, and notchange it under run-time. The line can be rotated depending on the battery value as inthe previous option, and with use of an oset value (the red line with the pile), it canbe subtracted before the rotation and added again after the rotation. One disadvantageis that the blue line (the linear approximation) have to be found as near the initial forcecurve as possible for best result. The nal option which was chosen for the task was option2.1, as that would be easiest to implement and seemed to be most reliable.

    6.4 Gather and store data in Arduino

    A program was made called "Gather and Store" [G.1], which gather and stores each motor'sforce output, using the same procedure for reading the analog inputs presented in section[6.1]. Arduino Mega2560 provides an EEPROM size of 4096 bytes which means it canstore 4096 numbers with a range of 0-255 values. According to the datasheet chapter 8.3[F], the EEPROM is good for 100,000 read/write cycles. This means that each memoryaddress can be read or write around 100,000 times, until the memory gets damaged. The

    37

  • limitation of reading together with the memory size, limits the project's expectations. Thedata is therefore only stored once, and read once every start into a temporary buer. Thedata has also to be crypt in order to t 0-255 values and be stored into the EEPROM. Byusing the inbuilt EEPROM library, it is possible to write and read accordingly.

    EEPROM.write(a,b);

    z = EEPROM.read(a);

    Where "a" is the number of row from 0-4096, "b" is the byte to be stored and "z" isthe byte to be read. A test was made using T-motor KV1100 and APC 9x4.7 at dierentvoltage levels using a power supply, to get the dierence in force output, while non of thesecurves was stored into the memory (see gure 6.7). The PWM-data data is dened from1000-2000 values, while the most interesting area lies between 1080-1680 of PWM-signals,8-68% of duty cycle, and around 300 grams of force.

    Figure 6.7: Interesting area of force data

    According to gure 6.7, the maximum force is 500g with 12.5V supply. This meansthat 500 values of force is going to be stored for every motor. To store and use the datafor two force curves, together with the battery monitor, the address places for the memoryare divided accordingly (see table 6.1).

    To be stored Address places (1024)

    Start voltage 11st force curve 500Battery monitor 500/400 = 12.5 13Start voltage 1

    2nd force curve 500Total 1015

    Table 6.1: Address places divided in EEPROM

    Since every force value on the force curve may not be dened from the gathering phase,the program will take the two nearest PWM-values and make an average in a lter function[G.2]. The second force curve will only be used to get the distance x from gure 6.6, ata certain force to be applied. The nal data to be stored for motor one, can be seen infollowing table 6.2.

    38

  • Address place Data Value

    0 (M0) Start voltage(1) Volt1 (M0) Force(1) 1 PWM. . .

    500 (M0) Force(1) 500 PWM501 (M0) Batt mon 1 O. Volt. . .

    513 (M0) Batt mon 13 O. Volt514 (M0) Start voltage(2) Volt515 (M0) Force(2) 1 PWM. . .

    1015 (M0) Force(2) 500 PWM. . .. . .

    1024 (M1) Start voltage Volt1025 (M1) Force(1) 1 PWM. . .

    Table 6.2: Data divided in EEPROM

    Where the three remaining motors follows the same division, having the same intervalof 1024 address places. Motor 0 starts at 0, motor 1 at 1024, motor 2 at 2048 and motor 3at 3072. Before the data is stored into the memory, it has to be ltered and xed regardingthe requirements already stated in this project. The program ow for gather and storedata can be seen in gure 6.8.

    Figure 6.8: Program ow for Gather and Store

    When option 1 is pressed from "First or second?", the rst force curve will be storedtogether with the battery values to the corresponding memory place. When two is pressed,the second force curve will be stored. In both of the options, the data needs to be encryptedin order to be placed into the memory. The technique for encrypting the data can be seen

    39

  • in [G.3]. The same technique is used to decrypt the data back to normal script and canbe seen in [H.2]. In "Filter function", the force data is averaged in function lterForce()and the battery oset compensation is done in function lterBattery(). A block diagramof the battery oset compensation can be seen in following gure.

    Figure 6.9: Program ow for battery compensation

    The battery array (1) of at least 500 values are summed up for every increment of indexpointer (corresponding to the PWM-signal), until 40 values have been summed together(2). The average of the 40 battery values are calculated (3) and if 13 values (n) have beengathered (4), the remaining oset values are found by taking the rst place of the averagearray subtracted by the remaining average values in a loop (5). The rst iteration of 40index increments Average[0] becomes the start voltage value for the actual force curve aswell.

    6.5 Force-PWM controller

    A program was made called "Read and Run" [H.1], which reads data from the EEPROM[H.2] to store it in the temporary motor structs. The motor struct contains all necessaryinformation, specic for every motor, to be used in the Force-PWM controller under run-time. See the following code snippet concerning variables inside the motor struct.

    typedef struct my_motor_struct

    {

    // constants

    int motor_number;

    int first_start_value;

    unsigned char first_force[NR_EEPROM_FORCE_DATA];

    int first_force_index;

    unsigned char first_battery[NR_EEPROM_BATTERY_DATA];

    int first_battery_index;

    int second_start_value;

    unsigned char second_force[NR_EEPROM_FORCE_DATA];

    int second_force_index;

    // force pwm-controller, non-constants

    int last_pwm;

    int force_number_ctr;

    double force_x_sum;

    40

  • double force_x_result;

    int first_offset;

    int second_offset;

    } motor_struct;

    The procedure for the Force-PWM controller yield the same theoretical approach pre-sented in section [6.3], and the implemented code can be seen in [H.3] for a more detailedexplanation. When the battery voltage is read, the Force-PWM controller make sure thecorresponding oset value is added depending on the last PWM-signal sent, to compen-sate for the voltage drop. The dierence between the two force curves are calculated atthe desired force, to get how many PWM-signals are changed per volt (PWM/Volt). Thedierence between the rst force curve (which was gathered by the Lipo battery) and thecurrent battery voltage is multiplied together with the calculated rate of PWM/Volt toestimate how much the PWM-signal has to be either added or subtracted from the rstforce curve. The distance is later added to the rst force curve to estimate the desiredPWM-signal as output from the Force-PWM controller.

    6.6 Summary

    The battery monitor is going to be compensated in an interval of every 40 PWM-value,in order to smooth out the data and save memory place. The force curves are going tobe read twice, to work as a force curve adjustment. Arduinos internal EEPROM wasproved to limit the amount of data to be stored, and only be capable of read/write 100,000times before it got damaged. The force and battery monitor data is therefore only writtenonce when gathered, and read once every start-up of the program. Two programs wereimplemented, one which gather and store the data, and another program which readsand run the memory data to control the quadrocopter. Some experiments regarding thesystem will be explained in section [7], including the Force-PWM controller to be testedboth theoretically and practically.

    41

  • 7 | Experiments

    7.1 Force eect over time

    The delivered current from the power supply, is proportional to the PWM-signal sentfrom the ESC. Since it is not possible to measure the current from the ESC to the motor(because of the current which goes back and forth) a measurement of the current was doneby connecting a multimeter between the power supply and ESC (see gure 7.1).

    Figure 7.1: Current to force relation

    The force curve is the data read from the load cell and the current holds the result fromthe multimeter. The force should accordingly to [6], follow the current very closely over aspecic frequency band, which the result currently states. The relation between force andcurrent yields over time (see gure 7.2).

    Figure 7.2: Current and force over time

    No obvious force or current dierence was observed by running the motor from coldstart to 10 min. Though when running normally, small variations of 20-30mA was foundwhich aected the force 2-3g. The force was further investigated over time, using the Lipobattery. By adjusting the PWM-signal to achieve 400g respective 300g of force, with 11.2Vrespective 12.35V, the following gure could be obtained.

    42

  • Figure 7.3: Force line at 400g and 300g over time

    As it can be seen, the two force curves are decreasing in a linear and parallel manner.After 16 minutes, the blue curve have dropped to 373g and the red to 272g. This gives anaverage decrease of 1.72g/min. The blue line says the battery have dropped 31.25mV andthe red 43,75mV. According to formula 2.1.2, the theoretical discharge rate was 282mV/minwith 4A load. The blue line starts with 4.55A and the red with 2.92A. The same formula2.1.2, gives that the red line discharges 200mV/min and the blue 280mV/min, which iseven lower then the theoretical even though it has 0.55A higher current.

    7.2 Compare motor and propeller

    To investigate any motor to motor variation, two motors were tested with the same modeland brand. Using the same actuator used on Iqarus quadrocopter, T-motor KV1100 andAPC 9x4.7, the result can be seen in following gure.

    Figure 7.4: Dierence between two motors

    To achieve the dierence in force between two dierent motors with three dierentpropellers, another test was made. The two motors were T-motor KV1100 (MT2208) andKV900 (MT2216-11), and the propellers APC 9x4.7, 10x3.8 and 11x4.7. The voltage wasset to 12V using a power supply. The result can be seen in following gure.

    43

  • Figure 7.5: Dierence between two motors and three propellers

    Motor MT2208 shows a better result compared to motor MT2216-11 using these pro-pellers, as it can be seen from the non-linearity and jumpy values. The smallest propeller9x4.7 (blue line) have not