compact safety system for automatic flagpole kompakt...

123
INOM EXAMENSARBETE TEKNIK, GRUNDNIVÅ, 15 HP , STOCKHOLM SVERIGE 2019 Compact safety system for automatic flagpole Kompakt säkerhetssystem för automatisk flaggstång Flow sensor anemometer DAVID STRÖM CARL JENSEN KTH SKOLAN FÖR INDUSTRIELL TEKNIK OCH MANAGEMENT

Upload: others

Post on 23-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

INOM EXAMENSARBETE TEKNIK,GRUNDNIVÅ, 15 HP

, STOCKHOLM SVERIGE 2019

Compact safety system for automatic flagpole

Kompakt säkerhetssystem för automatisk flaggstång

Flow sensor anemometer

DAVID STRÖM

CARL JENSEN

KTHSKOLAN FÖR INDUSTRIELL TEKNIK OCH MANAGEMENT

Page 2: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 3: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Compact safety system for automatic flagpole

Flow sensor anemometer

DAVID STROM, CARL JENSEN

Bachelor’s thesis ITMSupervisor: Mans CollnerExaminer: Nihad Subasic

TRITA-ITM-EX 2019:54

Page 4: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 5: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Abstract

Automating tasks and processes are becoming more andmore common in both corporate and everyday life. Theaim of this project is to assist the company Hotswap in thedevelopment of a safety system for an existing automaticflagpole. The safety system should be able to monitor windvelocity and, optionally, wind direction as well as commu-nicate the data to the flagpole’s main control unit. Thethesis describes and discusses the different possible mech-anisms, solutions for measuring wind, and a possible im-plementation. A method for measuring wind velocity byutilizing an FS5 thermal mass flow sensor was selected anda prototype was developed for testing the performance ofthe implementation. The tests showed that the thermalmass flow sensor fulfilled the requirements regarding windvelocity measurement and accuracy with an average devi-ation of 0.19 m/s from the reference value. The solutionwas then discussed and compared with Hotswap’s existingprototype. The comparison showed that the prototype wasa viable alternative. Finally, some suggestions for furtherdevelopment were presented along with the conclusion thatthe prototype provides a proof of concept for a fully realiz-able solution.

Keywords: Mechatronics, Thermal Mass Flow Sensor,Anemometer, Automatic Flagpole, Automation

Page 6: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 7: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

ReferatKompakt säkerhetssystem för automatisk

flaggstång

Automatisering av arbetsuppgifter och processer blir meroch mer vanligt bade pa foretag och i vardagslivet. Dettaprojekt hade som mal att bista foretaget Hotswap med ut-vecklingen av ett sakerhetssystem for en befintlig automa-tisk flaggstang. Sakerhetssystemet ska kunna mata vind-styrka och vindriktning och kommunicera den uppmattadatan till flaggstangens kontrollenhet. Rapporten beskriveroch diskuterar de olika mojliga mekanismer och losningarsom finns for att mata vindhastighet samt en mojlig im-plementering. En metod for matning av vindhastighet daren hot-wire flodessensor valdes och en prototyp utveckla-des sedan for att testa den implementerade metodens pre-standa. Testen visade att anvandning av flodessensorn till-fredsstallde de stallda kraven pa prototypen gallande vind-hastighetsmatning och matprecision med en medelavvikel-se pa 0.19 m/s fran referensvardet. Losningen diskutera-des och jamfordes sedan med Hotswaps befintliga proto-typ. Jamforelsen visade att prototypen var ett rimligt al-ternativ. Slutligen presenterades nagra forslag pa vidareut-veckling tillsammans med slutsatsen att prototypen ar enkonceptvalidering for en fullt realiserbar losning.

Nyckelord: Mekatronik, Flodessensor, Anemometer,Automatisk Flaggstang, Automation

Page 8: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 9: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Acknowledgements

This project would not have been possible without the contribution and assistanceof several people. We would most notably like to thank:

Nihad Subasic, course examiner and our supervisor at KTH, for his crucial part ascourse director and constant source of advice and encouragement.

Mans Collner, development engineer and our supervisor at Hotswap AB, for hisinvaluable assistance and willingness to provide advice and important informationabout the project.

Ronny Brakhya, mechanical design engineer at Hotswap AB, for proposing theproject and setting up our contact with Hotswap as well as showing interest and awillingness to assist at all times.

Samuel Wikstrom, head of operations at Hotswap AB, for granting us the oppor-tunity to conduct our bachelor’s thesis project in cooperation with Hotswap.

Ramis Orlu, researcher at KTH Mechanics, for giving us access to and helping uswith the KTH wind tunnel.

Sresht Iyer and Seshagopalan Thorapalli, the lab assistants, for their inexhaustibleknowledge and invaluable input and advice during the entire course of the project.

Staffan Qvarnstrom for being helpful at all times.

David Strom and Carl JensenStockholm, May 2019

Page 10: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 11: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Contents

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Theory 52.1 Anemometers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.1 Mechanical anemometers . . . . . . . . . . . . . . . . . . . . 52.1.2 Hot-wire anemometers and thermal mass flow sensors . . . . 62.1.3 Ultrasonic anemometers . . . . . . . . . . . . . . . . . . . . . 6

2.2 Electronic components . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.1 Arduino Nano microcontroller . . . . . . . . . . . . . . . . . . 72.2.2 Wheatstone bridge . . . . . . . . . . . . . . . . . . . . . . . . 72.2.3 Voltage divider . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.4 Stepper motor . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Demonstrator 93.1 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2.1 Downscaled wind tunnel . . . . . . . . . . . . . . . . . . . . . 93.2.2 HY-SRF05 ultrasonic distance sensor . . . . . . . . . . . . . . 93.2.3 FS5 thermal mass flow sensor . . . . . . . . . . . . . . . . . . 10

3.3 Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.4 Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.1 28BYJ-48 12V stepper motor . . . . . . . . . . . . . . . . . . 123.4.2 ULN2003 Darlington transistor array . . . . . . . . . . . . . . 123.4.3 LS0851505F160C1A-ND limit switch . . . . . . . . . . . . . . 133.4.4 Wheatstone bridge . . . . . . . . . . . . . . . . . . . . . . . . 133.4.5 Voltage divider . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.6 Arduino Nano microcontroller . . . . . . . . . . . . . . . . . . 143.4.7 PCB prototype . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.5 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Page 12: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

3.5.1 Sensor calibration . . . . . . . . . . . . . . . . . . . . . . . . 143.5.2 Detecting wind direction . . . . . . . . . . . . . . . . . . . . . 15

4 Results 174.1 Downscaled wind tunnel . . . . . . . . . . . . . . . . . . . . . . . . . 174.2 Sensor housing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.3 KTH wind tunnel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

5 Discussion and conclusions 21

Bibliography 23

A Project description 25

B Downloaded .stl files to assembly in Solid Edge ST10 29

C Application Note: Thermal Mass Flow Sensor 31

D Manufacturer’s recommendation 47

E Hotswap’s prototype 51

F Hotswap’s concept research 63

G Image of Hotswap’s existing design 73

H FS5 thermal mass flow sensor datasheet 75

I Arduino Code 79I.1 Main.ino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80I.2 Controller.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84I.3 Controller.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88I.4 FS5.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90I.5 F5.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92I.6 quickSort.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94I.7 quickSort.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Page 13: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 14: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 15: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Acronyms

DC Direct Current. 8

IDE Integrated Development Environment. 7

KTH Kungliga Tekniska Hogskolan. 2, 19, 21, 22

MCU Microcontroller Unit. 2, 7, 14, 21, 22

PCB Printed circuit board. 14

Page 16: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 17: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Glossary

anemometer A device used for measuring wind velocity. 2, 5–7, 9, 10, 14, 17–19,21, 22

FS5 A thermal mass flow sensor. 10, 11, 13, 14, 17, 18, 20–22

transducer A device that converts energy from one form to another. 6

Wheatstone bridge A type of differential measurement circuit. 6–8, 10, 13, 14,22

Page 18: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 19: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Nomenclature

k Calibration parameter −

n Calibration parameter −

Ri Resistance Ω

U Voltage V

V Voltage V

v Wind velocity m/s

Page 20: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 21: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

List of Figures

2.1 A typical cup anemometer (L) [6] and vane anemometer (R) [7]. . . . . 52.2 Schematic of hot-wire anemometer and Wheatstone bridge circuit [5]. . 62.3 An ultrasonic anemometer [9]. . . . . . . . . . . . . . . . . . . . . . . . 72.4 Circuit for a Wheatstone bridge [12]. . . . . . . . . . . . . . . . . . . . . 82.5 A simple voltage divider [14]. . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1 The downscaled wind tunnel, designed in Solid Edge ST10. . . . . . . . 103.2 The constructed prototype. Designed in Solid Edge ST10, images ren-

dered in Autodesk 3ds Max 2020 with V-Ray and edited in Adobe Photo-shop CC 2015. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 The constructed prototype, designed in Solid Edge ST10 and AutodeskFusion 360, rendered in Autodesk 3Ds Max 2020 with V-Ray and editedin Adobe Photoshop CC 2015. . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4 The manufacturer’s Wheatstone bridge recommendation for the FS5 (seeAppendix D) (L). The Wheatstone bridge with minor changes, designedwith Autodesk Eagle (R). . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5 The PCB schematic (L) and the complete circuit (R). Designed in Au-todesk Eagle and edited in Adobe Photoshop CC 2015. . . . . . . . . . . 14

3.6 Flowchart of the scanning algorithm. Flowchart created using draw.io. . 16

4.1 The results of comparing the FS5 and the reference anemometer in thedownscaled wind tunnel. Graph created in Microsoft Excel. . . . . . . . . 17

4.2 The four constructed sensor housings. Designed in Solid Edge ST10,images captured in Autodesk Fusion 360 and edited in Adobe PhotoshopCC 2015. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4.3 The test results from the test at KTH Mechanic’s wind tunnel plotted inMatlab R2018a. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Page 22: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 23: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

List of Tables

4.1 The results from the testing of different sensor housings. . . . . . . . . . 19

Page 24: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 25: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Chapter 1

Introduction

1.1 BackgroundHistorically, many attempts at automating flagpoles have been made but there arecurrently no solution on the market with a high level of automation. A highly auto-mated flagpole is a flagpole that can raise and lower flags without human interactionfor long periods of time. The principle is that two flags are fastened to the flagpoleand the user can then select which flag to raise using either a mobile application ora website. One scenario is a flagpole which can alternate between a national flagand a corporate flag. The corporate flag is raised at all times until a particular day(i.e. a birthday or a flag day) when it is exchanged for the national flag at a certaintime of day.

A product development project with the goal to design a highly automated flag-pole has been running at Hotswap AB since 2012. A need for a safety system whichmeasures and communicates wind velocity to the control unit has been identified.The control unit can then lower the flag in case of high wind velocity. The reasonfor this is mainly to avoid damage to the flag and flagpole, thereby increasing theservice interval (which is desired to be longer than two years). Hotswap has alreadyresearched different methods of wind velocity monitoring (see Appendix F) and de-veloped a prototype that uses pressure sensors with four Pitot probes to monitor thewind velocity (see Appendix E). The aim of this project is consequently to developa prototype which is utilizing a different method of monitoring wind velocity. Thesafety system will work by monitoring wind velocity and optionally wind directionat the top of the flagpole and then communicate a warning signal to the controlunit if wind velocity exceeds a defined value (15 m/s) (see Appendix A). The reportfurther attempts to give answers to the following research questions:

• Which type of wind measuring sensor is best suited for the intended applica-tion?

• How can the chosen sensor be implemented into the existing flagpole construc-tion?

1

Page 26: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 1. INTRODUCTION

• How does the prototype compare to Hotswap’s existing prototype?

1.2 Purpose

The purpose of this project was to develop a working prototype that monitors windvelocity and optionally also wind direction and air temperature. The prototypewas meant to include a safety switch that, at a wind velocity equal to or higherthan 15 m/s, communicates this to the flagpole’s control unit. The prototype wassupposed to be mountable to an existing automatic flagpole and then be evaluatedin a controlled environment to see how well it performed (see Appendix A).

1.3 Scope

To ensure the development of a working prototype some limits for the project wereset. One limit was a focus on measuring wind velocity and wind direction, with airtemperature being optional. The reason was that the prototype’s main function wasto work as a safety switch for high wind velocities. The prototype was also supposedto function during a limited time which resulted in lower demands on mechanicalstrength and robust construction. Another limiting factor was that the prototypewas meant to be implementable into the existing design (see Appendix G), whichthereby limited the sensor options due to geometric constraints. A requirement setby KTH was also that the prototype had to include a moving part controlled by anMCU (microcontroller unit), which limited the possible solutions.

1.4 Method

The method used for this project is based on David G. Ullman’s Mechanical De-sign Process’ different phases; Product Definition, Conceptual Design and ProductDevelopment [1]. Ullman’s Mechanical Design Process is a standardized design pro-cess for mechanical designers and has empirically been shown to lead to a morestructured development and a higher level of adaptability [2].

During the first phase, Product Definition, a literature study was conducted toresearch the different methods for measuring wind velocity. The most promisingwind measuring methods for this project were then selected for further evaluation.The selected methods were tested using a constructed downscaled wind tunnel and areference anemometer of type Skywatch Xplorer 1 in order to decide which methodperformed best regarding the accuracy of wind velocity measurement. The mostsuitable method was then selected for further development.

In the second phase, Conceptual Design, concepts of prototypes utilizing theselected wind measuring method were developed. The most promising concept wasselected and a prototype based on this concept was constructed and tested, first inthe downscaled wind tunnel and then in a larger wind tunnel at KTH.

2

Page 27: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.4. METHOD

In the phase Product Development a more thorough analysis of the prototype’sperformance was conducted with regards to the requirements set by Hotswap inorder to answer the project’s research questions and present suggestions for furtherdevelopment.

3

Page 28: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 29: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Chapter 2

Theory

2.1 AnemometersThe device used for measuring wind velocity is called an anemometer. There aremany types of anemometers with different properties and applications. This sectionwill briefly explain the types of anemometers that have been considered for thisproject.

2.1.1 Mechanical anemometersOne of the most common types of anemometers is the mechanical cup anemometerseen in Figure 2.1. This type of anemometer typically consists of hemisphericalcups mounted on three or four horizontal arms on a vertical shaft. Air flow passinghorizontally past the anemometer causes the shaft to turn at a rate roughly pro-portional to the wind velocity. The rotating speed of the shaft is then averagedover a defined time interval to give a more accurate measurement of wind velocity[5]. A cup anemometer only measures wind velocity whereas a vane anemometeralso measures wind direction. The vane anemometer, seen in Figure 2.1, utilizesa propeller mounted on a horizontal axis that stays parallel to the wind direction.To ensure that the propeller is held parallel to the direction of the wind a windvane is typically employed. A vane anemometer works in a similar way to a cupanemometer, relating the rotational speed of the propeller to the wind velocity.

Figure 2.1: A typical cup anemometer (L) [6] and vane anemometer (R) [7].

5

Page 30: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 2. THEORY

2.1.2 Hot-wire anemometers and thermal mass flow sensors

A hot-wire anemometer, seen in Figure 2.2, consists of an electrically heated wirethat is exposed to airflow. The flow results in heat being transferred from thewire to the air, thereby decreasing the temperature of the wire. This temperaturedecrease leads to a change in the wire’s resistance. The change in resistance can thenbe related to the airflow and consequently wind velocity. Hot-wire anemometerstypically consist of a conducting wire placed in a ceramic body with two leadsconnected to a Wheatstone bridge (described in section 2.2.2), making it possibleto measure the change in resistance of the wire [3]. The characteristics of thermalflow hot-wire sensors in regards to anemometry have been studied and shown to beindependent of ambient temperature [4]. Thermal flow hot-wire sensors thereforerequire minimal maintenance and function in most weather conditions.

A thermal mass flow sensor is a type of hot-plate sensor that works like a hot-wire anemometer in terms of setup and usage. It consists of two platinum platesthat act as two separate resistors. If airflow passes across the thermal mass flowsensor, the plates are cooled down and resistance decreases in one of the resistors.

Figure 2.2: Schematic of hot-wire anemometer and Wheatstone bridge circuit [5].

2.1.3 Ultrasonic anemometers

Ultrasonic anemometers measure wind velocity based on the time it takes for ultra-sonic impulses to pass between pairs of transducers. Since sound travels by makingair molecules move back and forth, the flight time of the sound changes dependingon the velocity and direction of the wind. Sound travelling in the same direction asthe wind travels faster while sound travelling against the wind travels slower. Ascan be seen in Figure 2.3 an ultrasonic anemometer normally consists of two pairsof sound transmitters and receivers mounted at right angles to one another. The

6

Page 31: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

2.2. ELECTRONIC COMPONENTS

time it takes for the sound to travel from each transmitter to the correspondingreceiver is measured and then used to calculate the wind velocity [5].

Ultrasonic anemometers typically require less maintenance than other anemome-ters and may be used in most applications due to their high performance and ex-cellent accuracy of measurement of up to 160 km/h [8]. This, however, results inultrasonic anemometers being more expensive than other anemometers.

Figure 2.3: An ultrasonic anemometer [9].

2.2 Electronic components

The following section explains and introduces the theory behind the necessary elec-tronic components used for obtaining, transmitting, and interpreting data and sig-nals in this project.

2.2.1 Arduino Nano microcontroller

Arduino Nano is an open source development board that is built around an MCU.The Arduino comes with its own IDE that makes it possible to program and controlthe different output and input pins. This in turn makes it possible to, for example,control a stepper motor or read data from a sensor [10].

2.2.2 Wheatstone bridge

A Wheatstone bridge is a type of differential measurement circuit [11]. The schematicfor a Wheatstone bridge circuit can be seen in Figure 2.4. The resistances R1 andR3 are known and R2 is variable. Changing R2 to a value such that the voltage VGis set to zero, the unidentified resistance Rx can be determined.

7

Page 32: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 2. THEORY

Figure 2.4: Circuit for a Wheatstone bridge [12].

2.2.3 Voltage dividerTo lower the output voltage in a circuit a simple voltage divider consisting of tworesistors can be implemented as shown in Figure 2.5, where Vin is the input voltage,Vout is the output voltage, and R1 and R2 are the two resistors.

By applying Ohm’s law, the following expression can be derived to calculate theoutput voltage Vout [13]:

Vout = VinR2

R1 +R2(2.1)

Figure 2.5: A simple voltage divider [14].

2.2.4 Stepper motorIn order to control the rotation of an object with precise steps, a stepper motorinstead of a typical DC-motor had to be utilized. Stepper motors consist of multiplecoils that are organized in phases. By sending pulses to each phase in sequence thestepper motor rotates in a given direction one step at a time. A stepper motor’sspeed is controlled by the frequency of the pulses and the direction of rotationis determined by which phases the pulses are applied to. There are two types ofstepper motors, namely unipolar and bipolar stepper motors. A unipolar steppermotor consists of one winding and a center tap per phase as opposed to a bipolarstepper motor which consists of a single winding per phase. Unipolar stepper motorscan be controlled with just a single transistor for each winding which in turn meansthat the direction of rotation can be reversed without switching the direction of thecurrent [15].

8

Page 33: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Chapter 3

Demonstrator

3.1 Problem formulationIn accordance with the purpose established in the beginning of the project, a pro-totype of an anemometer was constructed to answer the aforementioned researchquestions.

Both an ultrasonic sensor and a flow sensor was evaluated while mechanicalanemometers were excluded due to geometrical constraints. One sensor type wasselected for further testing. The prototype was constructed for testing in a controlledenvironment in order to ensure repeatability.

3.2 PrefaceA sensor had to be selected before constructing and testing the main prototype.This section briefly describes the methods of testing the sensors and presents theconclusions of the tests.

3.2.1 Downscaled wind tunnelA downscaled wind tunnel (Figure 3.1) was constructed in Solid Edge ST10 and 3D-printed using an Ultimaker2 for testing the sensors and calibrating the prototypealongside a reference anemometer. Guidelines for designing wind tunnels for engi-neering laboratories were taken into consideration during the construction [16]. A12V computer case fan powered by a bench power supply was used to create airflowthrough the wind tunnel. The maximum wind velocity achieved in the downscaledwind tunnel was, according to the reference anemometer, 4.1 m/s.

3.2.2 HY-SRF05 ultrasonic distance sensorAn ultrasonic distance sensor was tested to evaluate whether it was possible andfeasible to construct an ultrasonic anemometer at a lower cost than ultrasonicanemometers on the market. A quick test where the ultrasonic signal reflected

9

Page 34: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 3. DEMONSTRATOR

Figure 3.1: The downscaled wind tunnel, designed in Solid Edge ST10.

against a surface at a fixed distance while an airflow passed between the sensorand the surface was conducted. The NewPing library for Arduino made continuousdistance measurement possible [17]. During the test, the measured distance didnot change when an airflow was introduced. The difficulty to get any change inmeasured distance combined with the time constraint of the project resulted in thedecision not to continue with the idea of an ultrasonic anemometer prototype.

3.2.3 FS5 thermal mass flow sensorThe FS5 is a thermal mass flow sensor. A preliminary Wheatstone bridge wasbuilt on a breadboard according to the FS5 manufacturer’s recommendation (seeAppendix D) in order to test whether the FS5 flow sensor was a viable alternative.The sensor was connected to the Wheatstone bridge and then placed inside the windtunnel which introduced an airflow across the sensor. The change in voltage whenairflow passed across the sensor was measured and the resulting increase in voltagelead to the decision to use the FS5 flow sensor in the development of the prototype.

3.3 PrototypeOne of the premises of the project was that the safety system should fit into anexisting model designed by Hotswap. Consequently, all modelling was made withregards to the original design in accordance with the constraints established inthe project. The 3D-models of the standard components used in the prototypewere downloaded from various websites and imported to the assembly model inSolid Edge ST10 (see Appendix B). All non-standard components and parts were

10

Page 35: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

3.3. PROTOTYPE

designed in Solid Edge ST10 and Autodesk Fusion 360, except for the circuit boardwhich was designed in Autodesk Eagle.

For airflow to pass across the FS5 sensor, a sensor housing was designed at thevery top of the flagpole. The sensor housing consisted of a top with a channel,a fitting for the sensor and a shaft connection. The sensor housing was designedfor airflow to pass through the channel with the FS5 sensor mounted in the sensorfitting. The sensor was securely fastened at the top of the shaft connection, whichwas constructed in such a way that it could be aligned and inserted into the shaftwhich was connected to the top shell via a bearing (see Figure 3.3 and 3.2). Hence,the sensor housing could rotate freely around the top shell. The top shell wasmounted and locked onto the original outer shell. A stepper motor, mounted on acustom fitting that in turn was connected to an original mounting plate designed byHotswap, drives the shaft via bevel gears. The prototype scanned for the highestwind velocity by rotating the sensor housing approximately 180° while recordingmeasurements from the FS5 sensor. When the highest wind velocity was found,the sensor housing rotated back to the point of maximum wind velocity. The windvelocity was recorded for a set duration, and then averaged.

All the designed components were 3D-printed using an Ultimaker2/Ultimaker3

and the standard components were store-bought.

Figure 3.2: The constructed prototype. Designed in Solid Edge ST10, images rendered inAutodesk 3ds Max 2020 with V-Ray and edited in Adobe Photoshop CC 2015.

11

Page 36: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 3. DEMONSTRATOR

Figure 3.3: The constructed prototype, designed in Solid Edge ST10 and Autodesk Fusion360, rendered in Autodesk 3Ds Max 2020 with V-Ray and edited in Adobe Photoshop CC2015.

3.4 Electronics

This section describes the electronic components used in the final prototype.

3.4.1 28BYJ-48 12V stepper motor

A unipolar stepper motor of type 28BYJ-48 that could be powered by 12V wasused to rotate the housing approximately 180°. The 28BYJ-48 was a relative strongstepper motor with a gear ratio of 64:1.

3.4.2 ULN2003 Darlington transistor array

A ULN2003 Darlington transistor array was utilized in order to drive the steppermotor. The ULN2003 array consists of seven Darlington transistors capable of anoutput of 50V, 500mA.

12

Page 37: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

3.4. ELECTRONICS

3.4.3 LS0851505F160C1A-ND limit switch

To ensure that the top would not rotate more than approximately 180°, which wouldlead to the sensor cables twisting, a limit switch of type LS0851505F160C1A-NDwas added to the construction. The limit switch was mounted in such a way thattwo protruding parts on opposite sides of the rotating top would activate the switchwhen encountering it.

3.4.4 Wheatstone bridge

A Wheatstone bridge was constructed and configured as a constant temperaturesetup according to the manufacturer’s application note (see Appendix C). Thissetup solved the issue of temperature alteration, resulting in the calibration of thesensor being independent of the ambient temperature. There are, however, someminor changes between the constructed circuit and the application note. As canbe seen to the left in Figure 3.4, compared to the right, the calibration resistor R2was removed since the need of very high precision measuring was not needed andcalibration could be done solely by programming the Arduino Nano.

Figure 3.4: The manufacturer’s Wheatstone bridge recommendation for the FS5 (see Ap-pendix D) (L). The Wheatstone bridge with minor changes, designed with Autodesk Eagle(R).

3.4.5 Voltage divider

The output voltage from the Wheatstone bridge with the FS5 connected to it wastoo high for the Arduino Nano’s input pins. A voltage divider was implementedinto the circuit (Figure 3.5), thereby sufficiently decreasing the voltage.

13

Page 38: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 3. DEMONSTRATOR

3.4.6 Arduino Nano microcontrollerEvery component’s size had to be minimized in order to fit inside the flagpole top.The required outputs, inputs and processing power in the MCU meant an ArduinoNano would suffice. The Arduino Nano was the central unit to which all necessarycomponents were connected. Values from the FS5 sensor and limit switch were readby the Arduino Nano. The Arduino Nano also controlled the stepper motor.

3.4.7 PCB prototypeA PCB prototype of the full circuit was designed to fit the circuit for the ArduinoNano, the Wheatstone bridge, and the ULN2003 array into the flagpole top. ThePCB was designed in Autodesk Eagle and milled using an LPKF ProtoMat S63.The PCB design as well as the complete circuit can be seen in Figure 3.5.

Figure 3.5: The PCB schematic (L) and the complete circuit (R). Designed in AutodeskEagle and edited in Adobe Photoshop CC 2015.

3.5 SoftwareThis section describes the calculations and algorithms used in the final prototype.

3.5.1 Sensor calibrationThe FS5 sensor was calibrated according to the manufacturer’s recommendation inthe downscaled wind tunnel. The wind velocity values of the reference anemometerat fan voltages between 4 and 12 volts were recorded in the downscaled wind tunneland compared with the FS5’s voltage input to the Arduino Nano at the same fanvoltages. The wind velocity could then be calculated and linearized with a sim-plified version of King’s Law according to the manufacturer’s application note (seeAppendix C):

v = ((U − U0)(U + U0)) 1n

(k 1nU

2n

0 )(3.1)

14

Page 39: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

3.5. SOFTWARE

Where v is the wind velocity, U0 is the voltage input to the Arduino Nano at zerom/s wind velocity, U is the current voltage and n and k are parameters calculatedduring calibration. The calibration parameter n was chosen to 0.51 according tothe manufacturer’s application note which also presented the following equation forobtaining k:

k =(U50%

U0)2 − 1

vn50%

(3.2)

Where U50% was the sensor voltage at 50% of maximum wind velocity (v50%).A simple low-pass filter was implemented to further improve the accuracy of thewind velocity measurement and to reduce potential errors [19]. The median valueof the recorded wind velocities during a set duration was then included in a gener-ated JSON-array. The JSON-array can then be used in whichever communicationmethod Hotswap desires (see Appendix I).

3.5.2 Detecting wind directionDue to the construction of the flagpole top, and in particular the housing for theflow sensor, the prototype would not be able to detect the actual cardinal points ofthe wind. It would, however, be able to detect the axis with the maximum airflow.The prototype scaned for the axis with the maximum airflow on a regular basis,which was made possible by the stepper motor that drives the rotation of the sensorhousing. To easily program the stepper motor, the Arduino library CheapStepperwas used [18]. An Arduino program controlled the stepper motor to rotate thesensor housing approximately 180° while reading the wind velocity measurementsfrom the sensor. The stepper motor then rotated the sensor housing to the positionthat measured the maximum wind velocity. A flowchart for the scanning algorithmcan be seen in Figure 3.6.

15

Page 40: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 3. DEMONSTRATOR

Figure 3.6: Flowchart of the scanning algorithm. Flowchart created using draw.io.

16

Page 41: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Chapter 4

Results

4.1 Downscaled wind tunnel

The calibration parameter k was obtained using Equation 3.2, and values measuredby the FS5 and reference anemometer were recorded. The FS5 sensor was thencompared to the reference anemometer at eleven different fan voltages (0-12V),with fan voltages lower than the fan’s required voltage of approximately 4V beingexcluded. The results of the test can be seen in Figure 4.1.

Figure 4.1: The results of comparing the FS5 and the reference anemometer in the down-scaled wind tunnel. Graph created in Microsoft Excel.

The results show both anemometers increase approximately linearly with in-creasing fan voltage. This behaviour was expected because of the linear transfer

17

Page 42: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 4. RESULTS

function for rotational anemometers as discussed by Pindado et al. [20] and thelinearized King’s Law recommended by the manufacturer of the FS5 (see AppendixC).

As can be seen in Figure 4.1 the FS5’s measured values were slightly more in linewith the expected linear behaviour than the reference anemometer. These results,however, had to be verified in a larger wind tunnel at KTH.

4.2 Sensor housingWith a sensor as sensitive and responsive as the FS5 flow sensor it was very im-portant that the sensor housing minimized turbulence in order to reduce potentialerrors. In addition to the housing’s effect on turbulence it would also influence theaccuracy of the measured wind direction. The sensor housing best suited for theprototype should result in the narrowest possible span of angles that detect airflow.A narrow span of angles detecting airflow leads to faster and more precise detectionof the axis of maximum airflow.

Figure 4.2: The four constructed sensor housings. Designed in Solid Edge ST10, imagescaptured in Autodesk Fusion 360 and edited in Adobe Photoshop CC 2015.

To test which type of sensor housing best fit the aforementioned demands, fourdifferent sensor housings were constructed (see Figure 4.2) using Solid Edge ST10and 3D-printed with an Ultimaker3. Each sensor housing containing the sensor wasthen placed in the downscaled wind tunnel with the air flow passing straight acrossthe sensor. The sensor’s output voltage at zero flow and maximum flow was thenrecorded. Using a stepper motor, the sensor housing was then rotated in incrementsof 5°, first clockwise and then counterclockwise, until the sensor’s output voltagewas halfway between the voltage at minimum and maximum flow ±0.05V. The angleαU50% was then recorded and the test was repeated for all four sensor housings. Theresults of the test can be seen in Table 4.1.

18

Page 43: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

4.3. KTH WIND TUNNEL

Type 1 Type 2 Type 3 Type 4αU50% (CCW) 65° 35° 40° 45°αU50% (CW) 70° 50° 40° 45°

Table 4.1: The results from the testing of different sensor housings.

As can be seen in Table 4.1 the most suitable sensor housing was Type 3. Ithas the narrowest span of the four housings while also having a symmetrical spanaround the center line. This sensor housing was therefore the one used for theprototype and consequent tests.

4.3 KTH wind tunnel

The anemometer was intended to act as a safety system for particularly strongwinds and therefore had to be tested and calibrated for strong winds. After testingthe accuracy of the anemometer at a wind velocity between zero and 4.1 m/s in thedownscaled wind tunnel a test with higher wind velocities and less turbulence wasnecessary. The anemometer should send a warning signal to the flagpole’s controlunit when the wind velocity exceeds 15 m/s. The test was therefore conducted withwind velocities between zero and 16 m/s in a wind tunnel at KTH.

Figure 4.3: The test results from the test at KTH Mechanic’s wind tunnel plotted in MatlabR2018a.

19

Page 44: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 4. RESULTS

The graph in Figure 4.3 shows the results of the test with the FS5’s measuredwind velocity being compared to the reference wind velocity measured by Pitotprobes in the wind tunnel. The line represents the reference wind velocity values.The average deviation from the reference line was approximately 0.19 m/s.

20

Page 45: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Chapter 5

Discussion and conclusions

There are many ways to measure wind velocity and this report has introducedand described the methods deemed most suitable for the intended application. Themethod chosen for the prototype developed in this project was using an FS5 thermalflow sensor. Excellent accuracy, high sensitivity (0.01 m/s), simple calibration,a broad measuring range (0-100 m/s), no moving parts, temperature range (-20to +150°C) and temperature compensation not being necessary makes it an idealsensor for the intended application (see Appendix H).

For the sensor’s performance to be optimal it has to be aligned in a way thatallows airflow to pass across both sides. Taking this into account, the prototypedeveloped during the course of this project is one way to implement this method ofmeasurement into the existing flagpole construction. A rotating sensor housing witha channel for air to flow through and the sensor placed in the middle of the channelis a simple solution that, in addition to fulfilling most of Hotswap’s requirements,fulfills the requirement from KTH that the project includes a moving part controlledby an MCU.

This project’s main purpose was to develop and evaluate an anemometer thatwas different from the prototype developed by Hotswap (see Appendix E). It istherefore of great importance to compare the prototype previously developed duringthis project to Hotswap’s prototype. The main difference is unsurprisingly themethod of measuring wind velocity and wind direction. Hotswap’s prototype utilizespressure sensors to measure the dynamic pressure in four Pitot probes whereasthis project’s prototype measures the decrease in resistance in a single thermalflow sensor as air flows across it while actively detecting along which axis the airis flowing. Another important difference to consider is the fact that Hotswap’sprototype measures the wind direction whereas the flow sensor prototype measuresthe axis along which the air flows. Another very significant difference is the fact thatthis project’s prototype has moving parts whereas Hotswap’s prototype lacks movingparts aside from the miniscule movement of the pressure sensors. An importantpoint to make however, is that the top of the existing flagpole is able to rotate180°, thus potentially making the added rotation of the flow sensor an unnecessary

21

Page 46: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CHAPTER 5. DISCUSSION AND CONCLUSIONS

addition.A potential issue with both solutions is the vulnerability of rain, snow and dirt

obstructing the flow across the FS5 as well as blocking the Pitot probes’ inlets,consequently leading to incorrect measurements. This can, however, be avoided byadding a protective net or filter which might add an additional benefit in the formof a more laminar flow. A laminar flow with minimal turbulence potentially alsoleads to an increase in the accuracy of measuring wind direction. This improvementmight also positively affect the issue discovered during the sensor housing test inSection 4.2, namely that air flowing against one side of the FS5 leads to a highervoltage than air flowing across the other side.

The test at KTH Mechanic’s wind tunnel demonstrated that the prototype’sperformance regarding wind velocity measurement accuracy was sufficient with anaverage error of under 0.2 m/s. This error could probably be reduced further with amore thorough sensor calibration combined with a precision resistor implemented inthe Wheatstone bridge. Another important test to conduct would be to study howaccurate the wind velocity measurement is in the intended environment, namelyoutdoors and exposed to rapidly changing wind velocities and different weatherconditions. The FS5 has a fast response time and high response sensitivity (see Ap-pendix H) and should therefore perform well with rapidly changing wind velocities.This hypothesis should however be tested to ensure the performance of the finishedproduct.

Finally, the prototype developed in this project is a proof of concept, whichmeans that if this prototype was to be developed further into a finished productthere are some improvements and changes to be made. Due to KTH’s demand thatthe project includes a moving part controlled by an MCU, some design choices hadto be excluded. One of those design choices was a completely solid-state anemometerutilizing two FS5 sensors placed at right angles to each other in separate housingchannels. This solution would improve the developed prototype while still beingfairly inexpensive. The lack of moving parts would result in better sealing, lowerrisk of functioning errors, as well as higher overall durability. This concept could bea more optimal solution, that is in line with the demands on low maintenance andhigh automation. In conclusion, the finished prototype fulfills the requirements setby KTH and Hotswap and provides a proof of concept for a fully realizable solution.

22

Page 47: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Bibliography

[1] D. Ullman, The Mechanical Design Process, 6th ed. David Ullman LLC, 2017.

[2] L. Stauffer and D. Ullman, ”A comparison of the results of empirical studiesinto the mechanical design process”, Design Studies, vol. 9, no. 2, pp. 107-114,1988.

[3] J. Yoon, ”Wheatstone Bridge”, in Introduction to Biosensors, 2nd ed. Tucson,AZ: Springer International, 2016, ch. 5, pp. 79-90.

[4] P. Lange, M. Weiss and S. Warnat, ”Characteristics of a micro-mechanical ther-mal flow sensor based on a two hot wires principle with constant temperatureoperation in a small channel”, Journal of Micromechanics and Microengineering,vol. 24, no. 12, 2014.

[5] Y. Posudin, ”Measurement of Wind Parameters”, in Methods of Measuring En-vironmental Parameters, Hoboken, New Jersey: John Wiley & Sons, 2014, ch.4, pp. 38-49.

[6] Mykoelectronics.co.in, ’Wind Speed Meter and Anemometer’, [Online].Available: https://www.mykoelectronics.co.in/wind-speed-meter-and-anemometer.html. [Accessed: 26-Mar-2019].

[7] Davis-tr.com, ’Serial Output Wind Monitor Model09101’, [Online]. Available: http://www.davis-tr.com/store/index.php?route=product/product&page=3&product id=101.[Accessed: 27-Mar-2019].

[8] G. Lopes et al., ”Development of 3-D Ultrasonic Anemometer With Nonorthog-onal Geometry for the Determination of High-Intensity Winds”, IEEE Transac-tions on Instrumentation and Measurement, vol. 66, no. 11, 2017.

[9] Biral.com, ’Ultrasonic Anemometer 2D’, [Online]. Available:https://www.biral.com/product/ultrasonic-anemometer-2d-4-3820-xx-xx/.[Accessed: 13-Feb-2019].

[10] Arduino.cc, ’What is Arduino?’, [Online]. Available:https://www.arduino.cc/en/Guide/Introduction. [Accessed: 19-Mar-2019].

23

Page 48: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

BIBLIOGRAPHY

[11] S. Keil, ”The Wheatstone bridge circuit”, in Technology and Practical Use ofStrain Gages, Berlin, Germany: Wilhelm Ernst and Sohn, 2017.

[12] Askiitians.com, ’Wheatstone Bridge’, [Online]. Available:https://www.askiitians.com/iit-jee-electric-current/meter-bridge/. [Accessed:23-May-2019].

[13] Wang, M. (2010). Understandable electric circuits. 1st ed. London: Inst. ofEngineering and Technology, p.68.

[14] Build-electronic-circuits.com, ’Voltage Divider Circuits Give You PowerOver The Voltage’, [Online]. Available: https://www.build-electronic-circuits.com/voltage-divider/. [Accessed: 28-Mar-2019].

[15] Solarbotics.net, ’Stepper motors’, [Online]. Available:http://solarbotics.net/library/pieces/parts mech steppers.html. [Accessed:21-Apr-2019].

[16] C. U-tapao and S. Moryadee, ”A Design and Construction of a Wind Tunnelfor Engineering Laboratories”, MATEC Web of Conferences, vol. 192, 2018.

[17] Playground.arduino.cc, ’NewPing Library’, [Online]. Available:https://playground.arduino.cc/Code/NewPing/. [Accessed: 21-Mar-2019].

[18] Github.com, ’CheapStepper’, [Online]. Available:https://github.com/tyhenry/CheapStepper. [Accessed: 27-Mar-2019].

[19] Github.com, ’Filters’, [Online]. Available: https://github.com/JonHub/Filters.[Accessed: 17-Apr-2019].

[20] S. Pindado, J. Perez and S. Avila-Sanchez, ”On Cup Anemometer Rotor Aero-dynamics”, Sensors, vol. 12, no. 5, 2012.

24

Page 49: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix A

Project description

Pa uppdrag av en kund skall en automatiserad flaggstang tas fram, projektet medatt utveckla denna har lopt hos oss pa HotSwap sedan 2012. Historiskt sa haringen automatiserad FS varit sarskilt automatiserad, aven om manga forsok hargjorts. Utvecklingsprojektet avser ta fram en FS med hog automationsgrad, d.v.s.att flaggningar skots utan mansklig interaktion i langa perioder. Principen ar atten FS ska laddas med tva flaggor som sedan kan flaggas pa hel- eller halv-stangenligt ett schema som styrs via en app eller hemsida. I ett tankt scenario har dennaFS laddats med en nationsflagga och en ”foretagsflagga”. Foretagsflaggan kan narden ar hissad sitta uppe dygnet runt tills ett behov av flaggning med nationsflaggauppstar (flaggdag eller t.ex. en fodelsedag eller ett dodsfall). Nationsflagga skahissas vid solens uppgang eller ett givet klockslag samt halas vid solens nedgangeller klockslag.

En labb-modell har byggts och skall anvandas for utvecklingsarbete en periodinnan en produktionsmodell ska tas fram. En identifierat behov ar en sakerhets-funktion som halar flaggor da en viss vindstyrka rader, detta forst och framst for attforhindra olyckar med omkullblasta/knackta flaggstanger, men aven for att forlangalivslangden pa flaggorna vilket paverkar systemets totala serviceintervall (> 2 ar).

For att gora detta sa vill man monitorera vindstyrkan i toppen av FS, sa attflaggning kan undvikas eller avbrytas da vindstyrkan overstiger ett definierat varde(for narvarande 15 m/s).

Da flaggorna da ar placerade mycket nara vara sensorer sa vill vi inte att toppenpa FS ar sa slat och fri fran utstickande geometri som mojligt (da sadan mojliggorfor flaggor att trassla in sig = lag automationsgrad). En losning vi har jobbat pa,och har framme som prototyp, ar ett sensorsystem baserat pa tva trycksensorersom mater tryckskillnad mellan fyra punkter placerad runt om FS-knoppen. Dennaprincip ska ses som ett forslag pa losning, andra principer ar mojliga.

I korthet om foreslaget examensarbete: Utveckla en realiserbar losning for attmonitorera vindstyrka. Systemet skulle aven kunna monitorera vindriktning ochtemperatur, det ar dock inte prioriterat. Prioriterat ar att bista projektet med detautomatiska flaggstangssystemet med ett forslag pa sakerhetsbrytare for hard vind.

25

Page 50: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

APPENDIX A. PROJECT DESCRIPTION

Under examensarbetet byggs en funktionsmodell som kan monteras pa/i befintligtFS-system under kommande utvardering. Forvantad livslangd for prototypen borvara ca 6 manader utomhus, sommar och/eller vinter.

Nagra preliminara krav, dessa far vi diskutera effekten av innan vi spikar dem,samt vad vi tillsammans anser det rimligt att hinna med med avseende pa er tillgang-liga tid for detta:

• Utstickande geometri fran FS-kula som flaggor kan fastna pa ska helt und-vikas. Detta ar huvudkravet och en anledning till att behovet inte tillgodosesmed en standardkomponent.

• Mjukvarukrav: sprak, principer, dokumentation, aldersbestandighet skall definierasinnan vi faststaller dessa som krav.

• Prestandakrav: upplosning, datatakt, processorkraft, minnesmangd, antalminnesskrivningar/tid valjs alla med avseende pa TK och driftsakerhet.

• Driftssakerhetskrav: paverkan av vatten, sno, is, lov, damm, faglar, spindlaroch pavaxtning ska minimeras.

• Kostnadskrav komponenter: < 400 SEK vid en serie om 5000 stycken FS,tillganglighetskrav komponenter over tid - TBD.

• Kostnadskrav montering: skall beaktas (detta kommer vi arbeta vidare medsa detta behover ej na top notch-niva).

• Kostnadskrav service: input fran kunden samt generellt fri fran service, alter-nativt intervall > 2 ar.

• Volymsnalt system: I toppen av FS sa ska detta system samsas om utrymmetmed motorer och kameror samt annat mekanik.

• Robust sjalvstartsprocedur: vi ska tala stromavbrott (tal rimliga/forutsagbarayttre storningar).

Nagra andra parametrar:

• Avstandet mellan toppen och central har ett spann pa 6 till 18 m. Dennaonskade prototypen skall monteras pa en 6 m FS.

• Behandlar mat-data via en mikroprocessor som ger lag TK (denna valjs ocksamed avseende pa tillganglighet over tid).

• Backup-plan for da matningsstrom fran central andrar specifikation.

• Toppen kommer kunna bli varm (upptiningsfunktioner av olika slag), sa dennavarma ska hanteras sa att den inte slar ut precisionen i var uppmatta data.

26

Page 51: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

• Toppen ar idag inte stationar, den roteras med motor +/- 180 grader vidhissning/halning av flaggor. Om detta blir vasentligt fordyrande kan en delav toppen vara stationar, och om sa, hur tata, lagra mm?

• Miljo-aspekten pa ingaende komponenter. Skriv nagot om mojliga anpass-ningar for en miljovanligare losning. Preliminart gar lagt TK fore, men pre-sentera alternativens kostnad/spec. om dessa inte valjs som arbetsspar.

Mvh, Mans

27

Page 52: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 53: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix B

Downloaded .stl files to assembly inSolid Edge ST10

• SKF 6205-2RSH Grove ball bearing. Downloaded via www.skf.com

• E-switch LS0851505F160C1A-ND Limit Switch. Downloaded via www.digikey.se

• 28BYJ-48 Unipolar Stepper Motor. Downloaded via www.grabcad.com

29

Page 54: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 55: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix C

Application Note: Thermal Mass FlowSensor

31

Page 56: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Application NoteThermal Mass Flow SensorFS7

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 1/15

Page 57: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Application NoteThermal Mass Flow SensorFS7

1. FS7 3

1.1 About the Sensor 3

1.2 Benefits and Characteristics 3

1.3 Application Areas 3

1.4 Sensor Structure 3

1.5 Measurement Principle 5

1.6 Dimensions and Housing 5

1.7 Mounting 6

1.8 Delivery and Content 7

1.9 Handling 7

1.10 Performance 9

1.11 Influences 10

1.12 Electronic and Circuit Diagram 11

1.13 Calibration and Linearization 13

2. Additional Electronics 15

3. Additional Documents 15

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 2/15

Page 58: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Application NoteThermal Mass Flow SensorFS7

1. FS7

1.1 About the Sensor

The Innovative Sensor Technology IST AG thin film mass flow sensors were developed to offer solutions for a wide variety of flow applications with considerable advantages. Thermal mass flow modules and measuring systems are well-known devices that are offered in a wide range of applications by a handful of suppliers in the marketplace. Most of these designs are compact, ready to use systems with a channel and a passive or active output. These modules are sufficient for many general purpose applications where component price and size are less significant, but they are not well-suited for price-sensitive and space limited flow control solutions.

The FS7 flow sensors are based on a function of the flow speed and utilize heat transfer principles to determine the flow velocity. As flow passes across the sensor, heat is carried from the sensor to the medium. As flow increases, so does the amount of heat that is transferred. By knowing the heat transfer, the flow rate can be determined from the amount of voltage compensation needed to maintain a constant temperature differential.

The FS7 flow sensor with symmetric heater design and improved sensitivity is the successor product of the former FS5 flow sensor. The sensors can be applied in various gases. They have a wide operating temperature range and flow measuring rate. Flow channels guarantee the best possible adaptation of our sensors to the requirements of your application, whether in terms of dynamic range, response time or ambient conditions. The FS7 flow sensors are optimal for limited space system integration and can be upgraded into finish developed systems simply. Furthermore, customer specific designs of the chip and housing/channels are possible as well as implementation in customer de-fined and supplied housings.

1.2 Benefits and Characteristics

The following list outlines the advantages of the FS7 sensor. It is not a list of the sensor’s full range of capabilities and should not be seen as such.

No moving mechanical parts Excellent long-term stability

Simple signal processing Stable platinum technology

Simple calibration Excellent reproducibility

Easy adaptation in various applications and housings

Customer-specific sensor available upon request

FS7.4W sensor is applicable up to ambient tempe-ratures of +400 °C

1.3 Application Areas

Amongst others, the FS7 flow sensor is suitable for, but not limited to, the following application areas:

Compressed air billing Medical applications

HVAC - building automation Device monitoring

Automotive Coolant monitoring

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 3/15

Page 59: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.4 Sensor Structure

The following paragraphs describe and elaborate the multiple steps of the sensor structure.

Substrate

The base of the FS7 flow sensor chip is a special ceramic with low thermal conductivity.

The production of the FS7 flow sensor starts by depo-sition of high purity platinum thin film layers onto the ceramic substrate.

To ensure high quality sensors, wet chemical processes are performed on automated systems for chemical clea-ning and etching processes.

Resistive structure

The resistive structure on the sensor consists of two pla-tinum resistors on one chip. The small resistor is used as heater and the high resistor as temperature sensor. They are fabricated by multiple steps, hereunder spin coating of a photo-sensitive resist, illumination of the photo sen-sitive resist through a mask, developing the photo resist and etching the platinum, leaving only the sensor struc-ture on the chip.

The sensor is individually laser trimmed to the customer specific resistance.

Passivation

The resistive structure is covered with a glass passivation using screen printing, which furthermore increases the robustness and strength.

Afterwards each substrate is diced on fully automated dicing machines and ready for wiring.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 4/15

Page 60: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Wire connections

The FS7 sensor is equipped with wire connections wel-ded on the chip on automated welding machines. For easy to use design-in the sensor can be ordered with va-rious customer specific lengths, requirements and speci-fications.

The standard FS7 sensor is delivered with 195 mm black PTFE-insulated AWG 30/7 stranded wires suitable for crimping and attaching connectors.

The wires are stripped 5 mm.

Wire fixation

The welding area is additionally covered by a polyimide to increase robustness, resulting in a pull strength of 10N.

1.5 Measurement Principle

The Innovative Sensor Technology IST AG FS7 thermal mass flow sensors are based on a variation of the heat transfer coefficient, which is a function of the flow speed. Thermal mass flow sensors utilize heat transfer principles to deter-mine the flow velocity of a medium.

Flow speed changes the thermal energy loss by the heater: As a medium passes across the sensor, heat is carried from the sensor to the medium. As flow increases, so does the amount of heat that is transferred, meaning an increase in flow speed results in a higher cooling. This effect leads to a heat transfer coefficient change. Hence, cooling is a function of the mass flow.

By adapting controllers, a constant temperature difference between the heater and the temperature sensor can be achieved. This measuring principle is called Constant Temperature Anemometer (CTA). The supplied electrical power, which controls the temperature difference, is a function of the flow speed. The power is converted into a voltage output signal with a bridge circuit and can be easily readout. Knowing the temperature of the medium, the flow rate can be determined from the amount of voltage compensation needed to maintain a constant temperature differential.

The range of flow measurements is very wide and can be adjusted to the specific application. Through an electronic circuit, it is possible to increase the temperature of the heater with respect to the temperature of the medium.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 5/15

Page 61: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.6 Dimensions and Housing

The following describes the dimensions of the two standard IST AG FS7 thermal mass flow sensors - the FS7.0 without housing and the FS7.A with housing.

1.6.1 FS7.0

The standard FS7.0 measures 6.9 mm x 2.4 mm x 0.2 mm

Tolerances: outer dimension (chip): ± 0.2 mm; thickness (chip): ± 0.1 mm, height ± 0.3 mm

Other dimensions, customer-specific housings and wire lengths available upon request.

1.6.2 FS7.A

For an easy mounting in a channel, the FS7.A is offered with a standard housing.

3.5 mm

3 mm6 mm

Ø 6.0 (+/-0.1) mm

14 (+/-0.2) mm4 (+/-0.2) mm

O-ring O 4 mm x 1.5 mm

37.32202 mm

The standard FS7.A measures Ø 6.0 (±0.1) mm, L = 14 (±0.2) mm. PTFE wires measure 195 mm.

Other dimensions, customer-specific housings and wire lengths available upon request.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 6/15

Page 62: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.7 Mounting

The following mounting possibilities are only intended as examples. If you have any questions regarding specific mounting possibilities, please contact us to find the best possible solution for your application.

Duct mounting flow probe

Sensor mounted in a duct flow probe. The direction of the air flow must be across the sensor meaning an air flow flowing over the active sensor surface.

Customized channel/pipe with flow sensor

Sensor mounted in an air flow channel. The direction of the air flow must be across the sensor meaning an air flow flowing over the active sensor surface.

O-Ring

The size of the O-ring is 4 mm x 1.5 mm. The material is NBR with a shore hardness of 70.

Other materials and sizes upon request.

Connector

The standard FS7 sensor is not supplied with a connector, but the sensor can be purchased with e.g. a JST connector. Please contact Innovative Sensor Technology IST AG for more information regarding the various connector possibili-ties.

1.8 Delivery and Content

The standard delivery time of the Innovative Sensor Technology IST AG FS7 sensor is 4-6 weeks after orders received.

The FS7 sensor is delivered without electronic parts or modules. The FS7 test module must be purchased separately.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 7/15

Page 63: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.9 Handling

The FS7.0 sensor is delivered in a carton box and must be handled as follows:

The FS7.0 sensor is delivered in a box with label showing the exact sensor type and lot-number

Open the box carefully with both hands

Remove the stripes of plastic covering the sensors Open the carton flips to release the sensors

Carefully remove the plastic spiral around the wires Handle the sensors with plastic tweezers only

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 8/15

Page 64: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

The FS7.A is delivered in a carton box and must be handled as follows:

The FS7.A sensor is delivered in a box with label showing the exact sensor type and lot-number

Open the box carefully with both hands

Remove the stripes of plastic covering the sensors Open the carton flips to release the sensors

Carefully remove the plastic spiral around the wires Handle the sensors with plastic tweezers only

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 9/15

Page 65: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.10 Performance

The following graph showcases the performance of the IST AG FS7 sensor during application. Depending on the specific application and possible influences the measurements might vary.

0

1

2

3

4

5

6

7

8

0 5 10 15 20 25 30 35 40 45

Flow

sig

nal

(bridge

voltag

e) [

V]

Flow speed [m/s]

FS5

The output signal is adjusted to 3.0 V at zero flow and corresponds to a temperature difference (heater temperature minus ambient) of approximately 30K. With the temperature difference an optimal overhead of the heating element is generated and hence a perfect performance exists. According to King`s Law, which is declared in section 1.12, the sensor performance has the highest sensitivity at lower flow speeds.

The flow speed was measured with a CTA-circuit (see section 1.12) and with nitrogen at an ambient temperature of 25 °C. The sensor was mounted in a tube with an inner diameter of 5 mm.

1.11 Influences

The following list showcases possible influences, however is strongly dependent upon the application. If you have any questions regarding specific applications and its possible influences, please contact us to find the best possible solution for your requirements.

Contamination

The characteristics can be affected due to sensor contamination such as dust.

Alignment

The characteristics depend on sensor alignment/orientation. The sensor must be aligned so the flow passes over the active sensor surface. The IST AG FS7 is independent of the flow direction.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 10/15

Page 66: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Temperature (medium)

The characteristics depend on the medium temperature; therefore temperature compensation is necessary in order to achieve an accurate measurement.

Temperature changes in the medium are already compensated by using the CTA electronics („first order“).

1.12 Electronic and Circuit Diagram

The CTA-mode (Constant Temperature Anemometer) consists of a simple feedback circuit for the temperature regula-tion of the heater on the flow sensor, as flow speed changes the thermal energy loss by the heater. When a medium passes across the sensor, heat is carried from the sensor to the medium. As flow increases, so does the amount of heat that is transferred, meaning an increase in flow speed results in a higher cooling. This effect leads to a heat transfer coefficient change. Hence, cooling is a function of the mass flow.

By adapting controllers, a constant temperature difference between the heater and the temperature sensor can be achieved. The supplied electrical power, which controls the temperature difference, is a function of the flow speed. The power is converted into a voltage output signal with a bridge circuit and can be easily readout. Knowing the temperature of the medium, the flow rate can be determined from the amount of voltage compensation needed to maintain a constant temperature differential.

The medium temperature variation is compensated by the temperature sensor on chip (Pt1200). The resistors R1 to R6 can be chosen as shown in the circuit below. The temperature difference (DT) between heater (RH) and medium (RS) is set by resistor R1, e.g. DT=30 K for air. The resistor R2 should be adjustable within ±10 % for calibration. The R7 resistor is placed for stability of the anemometer circuit.

Depending on used operational amplifier, it should be valued from 1.1 MΩ to 3 MΩ.

Electronic circuit and curve progression are examples. Each application linked to the accuracy level requires an indivi-dual calibration of the system.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 11/15

Page 67: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

The CTA is described by King’s law:

By conversion and simplification, the equation can be obtained in the following form:

U = CTA-output k = Fluidic dependent constant

U0 = Free convection offset v = Fluid velocity

U represents the flow depended output signal. U0 represents the value of constant temperature difference (∆T) between the heater and fluid at no flow speed, which results due to natural convection. The controller of a CTA keeps the ΔT between heater and temperature sensor constant.

Maximum supply voltage

2 V to 5 V

Maximum heater voltage

3 V (at 0 m/s)

Optimal resistance values (heater resistance) )

RH (0 °C) = 45 Ohm ± 1 %

For gas applications, the temperature difference (resistor value) is recommended to 30 K.

Pin assignment

3

1

heater 2

sensor

123

1 2 3

heater temperature sensor GND

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 12/15

Page 68: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.13 Calibration and Linearization

1.13.1 Calibration

For linearization the reverse function of CTA- equation is used.

CTA - equation

Reverse function

The n-parameter is close to 0.5 (0.48....0.52). Most of flow fitting modules (each with different FS7 sensor) and individually mounted into the flow fitting have the value n = 0.51. The k-value goes from 0.9...0.93, it is depending on the alignment of the sensor and the flow profile.

The values n and k can be determined by a flow calibration at 3 points:1. Initial value (value U0 at zero flow)

Point is at zero flow and adjusting the 3,6 volts at analog output. With this adjustment all tolerances of chip thickness, thickness of glass passivation (+/- 10 microns), and tolerances of heater resistances are compensated.

2. Mid-point of measuring range3. End point of measuring range: full range value

Anemometer output calibration

Measuring curve from 0…12 m/s.

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 13/15

Page 69: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

1.13.2 Linearization of Anemometer output

How to calculate k and n:By using the calibration points of the anemometer output diagram an equation system can be set up. Calibration points according the diagram and equation system are:

U0 = 3. 6 V at v0 = 0 m/s

U50% = 6.6 V at v50% = 6 m/s

U100% =7.5 V at v100% = 12 m/s

Solving equation system:A. Calculating n

where:

B. Calculating k

B. Results of Linearization

Together with the three calculated values U0, k and n we can find the linearized characteristic. By solving the equa-tion system k and n were found. Assumed that n always can be set to 0.50, we only need the full range calibration point. This is the reverse function again of flow sensor (for linearization):

v = velocity or later mass flowU0 = 3.6 voltsU = measured voltage depending from mass flow n and k

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 14/15

Page 70: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CTA output linearization

By using the real measured n, k and U0 voltage together with the reverse function for linearization we get the follo-wing curve.

2. Additional Electronics

Document name:

Module: DFFS_FSL_Module_E DFFS_FSL_Module_D

3. Additional Documents

Document name:

Data Sheet: DFFS7_E DFFS7_D

DFFS74W_E DFFS74W_D

AFFS7_E2.2.0 | App Note | Thermal Mass Flow Sensor FS7 15/15

Innovative Sensor Technology IST AG, Stegrütistrasse 14, 9642 Ebnat-Kappel, SwitzerlandPhone: +41 71 992 01 00 | Fax: +41 71 992 01 99 | Email: [email protected] | www.ist-ag.com

All mechanical dimensions are valid at 25 °C ambient temperature, if not differently indicated • All data except the mechanical dimensions only have information purposes and are not to be understood as assured characteristics • Technical changes without previous announcement as well as mistakes reserved • The information on this data sheet was examined carefully and will be accepted as correct; No liability in case of mistakes • Load with extreme values during a longer period can affect the reliability • The material contained herein may not be reproduced, adapted, merged, translated, stored, or used without the prior written consent of the copyright owner • Typing errors and mistakes reserved • Product specifications are subject to change without notice • All rights reserved

Page 71: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix D

Manufacturer’s recommendation

47

Page 72: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Hi David

Here’s a design guide for our flow sensors, please mind that on the diagram there are values

for FS7 / FS5 sensor! Values in text are correct (for FS2sensor)

Usually sensor should work in Wheatstone Bridge in Constant Temperature Anemometer

mode. It means that difference between heater&apos;s and sensor&apos;s temperature is

constant:

You can calculate it using:

and

, where:

RH – heater’s resistance at TH,

RS – sensor’s resistance at TS,

RH0 – heater’s resistance at 0°C (RH0 = 45 Ω),

RS0 – sensor’s resistance at 0°C (RS0 = 1200 Ω),

α – Temperature Coefficient (3900 ppk/K),

TH – heater’s temperature.

TS – sensor’s temperature.

In order to keep ΔT = const, bridge has to be balanced: R4 / RS0 = R3 / RH0 => R4 / 1200 =

R3 / 45. Resistor R1 sets ΔT: ΔT = R1 / (α RS0) = R1 / (1200*0.0039). Resistor R5 supplies

bridge with some current allowing it to start to operate. Without it, after switching VCC on,

voltage at the input of operational amplifier is zero (U+ – U– ≈ 0 V). So amplifier’s output

depends only on its offset voltage VOS: if VOS < 0 circuit will start to operate normally, but if

VOS > 0 amplifier’s output will saturate and circuit will not work properly.

In CTA mode (balanced bridge) potentiometer R2 is set to 0 Ω. But in order to increase

sensitivity the bridge can be slightly unbalanced. The exact value of R2 should be obtained

during tests.

Page 73: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 74: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 75: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix E

Hotswap’s prototype

51

Page 76: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

© Eftertryck utan tillstånd förbjudet

Dokument

1931-0RE001-02 Anemometerutveckling

Beställare Författare

GTI AB Ronny Brakhya Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 1(11)

Anemometerutveckling

Page 77: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 2(11)

Innehåll 1.1 Omfattning ....................................................................................................... 3

1.2 Versionshistorik ............................................................................................... 3

1.3 Definitioner ....................................................................................................... 3

1.4 Referenser ....................................................................................................... 3

2.1 Vindens egenskaper ........................................................................................ 4

3.1 Riktningsberäkning .......................................................................................... 5

3.2 Beräkning av verklig vindhastighet .................................................................. 6

3.3 Test .................................................................................................................. 7

3.4 Elektronik ......................................................................................................... 8

3.5 Databehandling ................................................................................................ 8

4.1 Testresultat ...................................................................................................... 9

Page 78: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 3(11)

1 Inledning

1.1 Omfattning

För att utvärdera konceptet Termisk flödesmätning 3.2 i [1] byggdes en försöksuppställning med 2st SensorTechnics LDES250B för bidirektionell mätning av stagnationstrycket i två mot varandra ortogonala pitotrör. För att simulera vind byggdes även en enkel vindtunnel. Data samlas in via USB-gränssnitt i en PC på vilken en VB-applikation omvandlar uppmätta trycksignaler till beräknad vindhastighet och vindriktning.

1.2 Versionshistorik

Version Författare Datum Beskrivning

01 Ronny Brakhya 2015-06-18 Första revisionen 02 Ronny Brakhya 2015-11-03 Uppdaterade kapitel 4.1 testresultat med

mätdata.

1.3 Definitioner

Term Definition

Anemometer Vindmätare Dynamiskt tryck Det maximala tryck vinden utövar på ett stillastående objekt Prob Munstycke kopplat till sensorn

1.4 Referenser

[1] 1931-0CP001-01 Anemometerkoncept [2] 1931-3TR001-01 Anemometer comparison

Page 79: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 4(11)

2 Bakgrund

2.1 Vindens egenskaper

Vindens dynamiska tryck beror på luftens densitet och hastighet. Densiteten beror på lufttryck och temperatur men inte så mycket på luftfuktighet som man skulle kunna tro. Detta beror på att molmassan för vattenånga är lägre än den för luft (fuktig luft är alltså lättare än torr!).

Om man bortser från temperatur och lufttryck så kan felet i den uppmätta vindhastigheten variera så mycket som 20% i anemometerns tänkta användningsområde (felet i dynamisk tryck blir upp till 40%, men eftersom vindhastigheten är proportionell mot roten ur det dynamiska trycket så blir felet i vindhastighet mycket mindre) . Man bör dock observera att noggrannheten i den uppmätta vindriktningen inte påverkas då denna mätning är relativ samt att man faktiskt mäter det dynamiska trycket vilket är det som påverkar flaggans slitage/maxgräns. För att höja noggranheten på vindhastigheten som användaren kan se genom ett webgränssnitt är det lämpligt att väga in väderdata för att kompensera för just temperatur och statiskt tryck. Om det är önskvärt kan anemometern kompletteras med en sensor för dessa två parametrar. Förhållandet mellan vindhastighet och dynamiskt tryck är kvadratiskt och upplösningen på mätningen blir således lägst kring stiltje. En av utmaningarna var att hitta en tillräckligt billig sensor som klarar att mäta de låga tryck det handlar om (enstaka Pascal!) med tillräckligt hög noggrannhet. Observera att vindhastigheten som mäts upp i två mot varandra vinkelräta riktningar (Nord-Syd, Öst-Väst) räknas om enligt en tabell för att få ut en vindriktning. Denna beräkning gör att vi förlorar en del av noggrannheten.

Page 80: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 5(11)

3 Utförande

3.1 Riktningsberäkning

En approximation av tryckets beroende av mätprobens riktning relativt vinden skulle vara att anta att uppmätt tryck relativt dynamiskt tryck är 1 när proben står rakt in i vinden och 0 då proben står vinkelrätt mot vindriktningen. Lockande är även att anta att förhållandet däremellan varierar sinusformat. Försök har visat att vindmätningen inte helt förljer en sinusfunktion och vi har därför valt att approximera mätvädena med en funktion som ger mindre avvikelse. Med denna funktion skapas sedan en tabell för att kunna koppla mätvärden mot verklig vind.

För att kunna beräkna vindriktningen utifrån de två hastighetskomposanterna som ju kan variera i absolut storlek utan riktningsförändring (då vindstyrkan ändras), används förhållandet mellan de två komposanterna. Eftersom dessa bli noll då proben står vinkelrätt mot vindriktningen kommer förhållandet att gå mot oändligheten kring noll och nittio grader. För att hantera detta slopas belopp större än ca 40 ur tabellen. Eftersom funktionen är periodisk behövs bara en tabell för 0 till 180 grader. Vid beräkningen används sedan kvoten (förhållandet mellan vindhastighet 1 och 2) för att finna riktningen om den är mellan 0° och 180° och om riktningen är mellan 180° och 360° så ser man det på att vindhastighet 2 är negativ och man kan då enkelt addera 180° till värdet man får från tabellen.

Eftersom funktionen är udda kring 45° räcker det med att skapa en tabell för 0° till 90°, men för att förenkla sökfunktionen har en större tabell skapats.

-4

-3

-2

-1

0

1

2

3

4

5

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37

Uppmätt värde

Funktion för approximering

-40

-20

0

20

40

1

14

27

40

53

66

79

92

10

5

11

8

13

1

14

4

15

7

17

0

18

3

19

6

20

9

22

2

23

5

24

8

26

1

27

4

28

7

30

0

31

3

32

6

33

9

35

2

Förhållande

Förhållande

Page 81: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 6(11)

3.2 Beräkning av verklig vindhastighet

Förutom i fallen där vinden blåser rakt in i proberna kommer den verkliga vindhastigheten behöva räknas fram ur de två komposanterna. Om vindmätningen hade ett sinusformat beroende av vindriktningen hade man kunnat använda Pythagoras sats för att räkna ut resultanten, den verkliga vindhastigheten. Eftersom vindmätningen inte följer denna sinusform bildar inte resultanten av de två vindkomposanterna en enhetscirkel, för att få ett korrekt värde på vindhastigheten måste vi använda vår tabell för att multiplicera hypotenusan med en korrigeringsfaktor.

-1,5

-1

-0,5

0

0,5

1

1,5

-1,5 -1 -0,5 0 0,5 1 1,5

Tabell

Enhetscirkel

Page 82: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 7(11)

3.3 Test

En försöksuppställning byggdes för att kunna skapa tabeller och utvärdera konceptet. En enkel vindtunnel byggdes för att få en repeterbar vind med konstant riktning. Anemometern med sina prober är upphängd mitt i vindtunneln och går att vrida i horisontalplanet. Vinkeln går att avläsa på en gradskiva, och vindhastigheten är reglerbar. Proberna gjordes av sprutor och har en innerdiameter på 16mm som konas ner till en tunn slang som leder trycket till sensorn. En prob riktad i varje vädersträck mäter det dynamiska trycket som en skillnad mellan två motriktade prober. Sättet att mäta är inget nytt utan används i Pitotrör av typ S.

Page 83: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 8(11)

3.4 Elektronik

2 st sensore kopplades via analog ingång till en NI USB-6008 I/O. Mätdata presenterades i mjukvaran i kapitel 3.5. Avvikelsen vid nolltryck var tyvärr lite för hög, så ett utvecklingskit för MCP2210 USB-SPI-brygga införskaffades. Med digital utläsning via SPI blev avvikelsen i princip noll.Sensorerna, 2st SensorTechnics LDES250B kopplades via slang till proberna.

3.5 Databehandling

En mjukvara skissades upp i VB Express för att sköta följande funktioner: • Samla in sensordata med jämna intervall • Filtrera bort mätbrus (rullande medelvärde) • Bestämma förhållande mellan de båda sensorvärdena • Finna vindriktningen genom att söka upp förhållandet i tabell • Beräkna verklig vindhastighet utifrån vindkomposanternas resultant multiplicerad med

ett vinkelberoende kompensationsvärde (tabell) • Ladda upp mätvärdet till en websida.

Mjukvaran skall endast användas till test och kalibrering.

Page 84: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 9(11)

4 Sammanfattning

4.1 Testresultat från fälttest

För utvärdering av vindmätaren i verklig miljö monterades sensorerna i en SLS-modell av flaggstångsknoppen (1931-2CD059-10 FS-kula). Flaggstångsknoppen monterades på en 4m högt rör uppen på taket på vår kontorsbyggnad på Bataljonsgatan 12 i Jönköping. Sensorerna avlästes som tidigare via USB-SPI-brygga och datat skickades vidare genom en USB-förlängare ner till en dator. Sensordatat integrerades över 14-sekunders intervall med en testmjukvara, 1391-4TC001.

Parallellt med flaggstångsknoppen monterades även en vindmätare från Oregon Scientific, en WGR800. Denna användes som referensmätare under testerna. Mätaren var inte kalibrerad.

Figure 1 Referensanemometern och GTI's anemometer

I databladet för WGR800 står följande:

• Speed accuracy 2 m/s ~ 10 m/s (+/- 3 m/s)

• 10 m/s ~ 56 m/s (+/- 10%)

• Direction accuracy 16 positions

Av detta kan vi utläsa att man bör ha i åtanke att

1. noggrannheten vid låga vindhastigheter är ganska låg 2. Riktningsavläsningen sker i 360/16=22-graders steg

Page 85: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 10(11)

WGR800 loggades med mjukvaran SwitchKing Klient 3.1.0.1 och server 3.2.3.1. Datat lästes ut med 14 sekunders intervall (begränsat av WGR800) vilket tillsammans med byiga och växlande vindar gav stora skillnader i avläst värde. Vinden loggades i ca ett dygn och datat jämfördes i Excel, se [2]. Vinden låg under mätperioden mellan 0 och ca 8m/s. Sammanfattningsvis kan sägas att mätdatat från den utvecklade anemometern följde det från referensanemometern WGR800 inom mindre än 1 m/s och hade en standardavvikelse på 0,27m/s. Eftersom detta är mycket lägre än noggranheten för referensanemometern i detta vindspann kan man bara dra slutsatsen att vår anemometer beter sig som en traditionell skålkorsanemometer. För att få ut en noggrannare jämförelse behöver vi vänta på starkare vindar eller köpa ett noggrannare, kalibrerat instrument.

Figure 2 Medelvind

Figure 3 Byvind

När det gäller riktningsangivelsen så är det svårare att jämföra resultaten. Vindmätarna utsattes för en turbulent vind och flöjeln på WGR800 snurrade ibland hela varv. Vi vet ej hur mätningen i WGR800 går till (när själva mätvärdet sparas eller om det rentav är ett medelvärde). Termoanemometern LDE250 är till sin natur mycket snabb och reagerar på rikningsändringar upp till flera Hertz medan en flöjel är långsammare och svängningshastigheten beror på vindhastigheten. Vi valde därför att jämföra riktningsangivelsen i ett begränsat tidsintervall där vindriktningen hade varit jämn. I fig 3 nedan ses en del av detta intervall och där kan man se att skillnaden mellan anemometrarna låg inom riktningsupplösningen på WGR800 (22 grader). De

Page 86: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0RE001-02 Anemometerutveckling

Projekt Datum för senaste ändring Sida

Automatic Flagpole generation two 2015-11-04 11(11)

svängningar man ser i det rullande medelvärdet (svarta linjer) är alltså kvantiseringsfel på grund av den lägre upplösningen.

Figure 4 Vindriktning

Detta test har förutom en jämförelse också gett oss en korrektionsfaktor och en lämplig tidsrymd att medelvärdesbilda vindhastigheten. Vi har även kommit fram till att vi med LDE250 och den beräknade korrektionsfaktorn kan mäta upp till 18,8m/s.

Page 87: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix F

Hotswap’s concept research

63

Page 88: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

© Eftertryck utan tillstånd förbjudet

Dokument

1931-0CP001-01 Anemometerkoncept Beställare Författare

GTI AB Ronny Brakhya Projekt Datum för senaste ändring Sida

1931 2019-01-30 1(9)

Anemometerkoncept

Page 89: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 2(9)

Innehåll 1.1 Omfattning ....................................................................................................... 3 1.2 Versionshistorik ............................................................................................... 3 1.3 Definitioner ....................................................................................................... 3 1.4 Referenser ....................................................................................................... 3

Page 90: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 3(9)

1 Inledning

1.1 Omfattning

Detta dokument beskriver…

1.2 Versionshistorik

Version Författare Datum Beskrivning

01 Ronny Brakhya 2014-06-11 Första versionen

1.3 Definitioner

Term Definition

1.4 Referenser

[1]

Page 91: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 4(9)

2 Sammanfattning

För att kunna skydda flaggan från kraftiga vindar samt för att minska risken för att flaggan

snor sig kring flaggstången behövs ett medel för att mäta vindhastighet och vindriktning.

Kraven på noggrannhet bestäms av om instrumentet endast skall användas för att säkerställa

nämnda funktioner eller om man även vill använda mätdatat till annat, till exempel som

väderdata.

Kravet för att skydda flaggan (Variant 1) borde inte vara högre än följande:

Avgöra när medelvinden är högre än ca 15m/s +/- 2m/s

Avgöra riktningen med en noggranhet på +/- 45° (t.ex. om det blåser S eller V)

Underhållsfri

Frostsäker

Temperatur -30 till +50

Fuktsäker

Vill man använda den för att samla användbart väderdata (Variant 2) skall man förbättra

Mäta vindhastighet med en noggrannheten på +/-0,5m/s mellan 0m/s-40m/s

Avgöra riktningen med en noggranhet på +/-12,5°(t.ex. om det blåser SV eller SSV)

De kostnader som redovisas nedan är rena tillverknings/inköpskostnader, vid utveckling av

elektronik tillkommer självklart utvecklingskostnaden.

Eftersom nedanstående tryck- och flödessensorer bygger på massflödet så är de beroende av

luftens densitet, alltså luftfuktighet, barometertryck samt temperatur. Sensorer för dessa

parametrar bör därför byggas in om maximal noggranhet önskas. Skillnaden i luftens densitet

mellan -30 och +30 grader är uppåt 25% så en termometer måste integreras. Felet pga

luftfuktighet är försumbart. Barometertrycket är även detta av mindre betydelse.

Page 92: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 5(9)

3 Metoder

3.1 Mekanisk anemometer och flöjel

Den vanligaste metoden för vindmätning. Beprövad, enkel men har ett par nackdelar.

Används som Variant 2.

Fördelar:

Beprövad

Noggrann

Nackdelar:

Flera rörliga delar, utsatta för väder och vind

Ser inte ut som en flaggstångskula

Ej frostsäker utan uppvärmning

Kostnad från ca 500kr för en icke uppvärmd.

Page 93: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 6(9)

3.2 Termisk flödesmätning

Princip: En komponent värms upp till en känd temperatur över omgivningstemperaturen och

man mäter den effekt som krävs för att hålla den vid denna temperatur. Denna effekt är ökar

med vindhastigheten. För att avgöra rikningen kan man mäta åt vilket håll värmeöverföringen

sker eller skärma 3 olika komponenter från olika håll och jämföra mätvärdena.

Integreras i hål i flaggstångskulan.

Egen konstruktion med låg precision (Variant 1) tillverkningskostnad ca 100kr/kort.

Består av ett kretskort med 3 enkla termoanemometrar.

Fördelar:

Billig

Inga rörliga delar

Integreras i hål i flaggstångskulan

Frostsäker

Nackdelar:

Mindre beprövad

Onoggrann

Kostnad från ca 100kr.

Page 94: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 7(9)

En mer noggrann variant går att göra med precisionssensorer av samma typ.

Precisionssensorer ca 250kr/axel (500kr för vindhastighet och riktning)+ Elektronik och

kretskort 100kr borde kunna komma upp till Variant 2 i noggranhet.

Fördelar:

Noggrann

Inga rörliga delar

Integreras i hål i flaggstångskulan

Frostsäker

Nackdelar:

Mindre beprövad

Kostnad från ca 600kr.

Page 95: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 8(9)

3.3 Piezoresistiv tryckmätare

Denna teknik bygger på att man mäter vindens dynamiska tryck (stagnationstryck). Detta

beror på massflödet. Eftersom det ökar kvadratiskt med vindhastigheten så ökar noggranheten

med vindhastigheten.

Integreras i hål i flaggstångskulan. Se videon för en demonstation av känsligheten.

http://www.sensortechnics.com/fr/produits/capteurs-et-transmetteurs-de-pression/capteurs-de-

pression-a-sortie-amplifiee-/lde/lba-video-sensitivity.html

Fördelar:

Noggrann

Inga rörliga delar

Integreras i hål i flaggstångskulan

Frostsäker

Nackdelar:

Mindre beprövad

Kostnader:

Precisionssensor 250kr/axel (500kr för vindhastighet och riktning)

Elektronik+ PCB ca 100kr.

0-20m/s upplösning bättre än 0,1m/s.

Page 96: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Dokument

1931-0CP001-01 Anemometerkoncept Projekt Datum för senaste ändring Sida

1931 2019-01-30 9(9)

3.4 Ultraljudsanemometer

Fördelar:

Beprövad

Noggrann

Inga rörliga delar

Frostsäker

Nackdelar:

Ser inte ut som en flaggstångskula

Dyr

Kostnad ca

5000kr och uppåt.

Page 97: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix G

Image of Hotswap’s existing design

73

Page 98: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation
Page 99: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix H

FS5 thermal mass flow sensor datasheet

75

Page 100: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Flow Sens FS5 / FS5A Thermal Mass Flow Sensor for all-purpose use in Gases

1/3

Product The Flow Sens FS5 is the successor of the proven FS1 and is characterised by a sensing structure thermally more efficient. This leads to a higher chip temperature, which is thus more sensitive. The Flow Sens FS5 is a thermal flow sensor based on the conductometric principle. It includes two platinum resistors on one chip. A small resistance is used as heater; a high resistance is used for the temperature measurement of the fluid. Thermal conductometric flow sensors are based on the heat transfer coefficient, which is a function of the flow speed. The range of flow measurements is very wide and can be adjusted to specific applications, e.g. from 0…0.1 m/s or 0…100 m/s. Through an electronic circuit, it is possible to increase the temperature of the heater with respect to the temperature of the medium. Flow speed changes the thermal energy lost by the heater: An increase in flow speed results in a higher cooling. This effect leads to a heat transfer coefficient change. Hence, cooling is a function of the mass flow. By adapting controllers, a constant temperature difference between the heater and the temperature sensor can be achieved. The supplied electrical power, which controls this temperature difference, is a function of the fluid’s flow speed. The power is converted into a voltage output signal with a bridge circuit and can be easily readout. The small thermal mass of the sensor provides a fast response and heating times. The chip is also available with a housing of 6 mm in diameter. With this option, the sensor can be easily implemented into custom specific housings (e.g. T-piece) by the user.

Advantages Easily adaptable for different applications or into housings Simple signal processing and calibration No mechanical moving part Excellent reproducibility Excellent long-term stability Best price to performance ratio

Applications HVAC and building control solutions Automotive industry Medical devices Device monitoring Cooling devices Food industry

Page 101: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Flow Sens FS5 / FS5A Thermal Mass Flow Sensor for all-purpose use in Gases

2/3

Technical Data Measuring principle Thermal Measuring range 0 ... 100 m/s Sensitivity 0.01 m/s Accuracy < 3% of measured value (depends on electronic and calibration) Response time t63% < 2 s Temperature range -20 ... +150 °C Temperature sensitivity < 0.1 % / K (depends on electronic) Electrical connection 3 pins, Leads AWG 30, insulated with PTFE, or custom specific Heater resistance RH(0°C) = 45 Ω ± 1% Temperature sensor Rs(0°C) = 1200 Ω ± 1% Supply voltage Typical 2 … 5 V @ ∆ T = 30 K (0 ≤ vström ≤ 100 m/s) Max. heater voltage @ 0 m/s 3 V Substrate material Special ceramic with low thermal conductivity In general Smaller specifications upon request

Construction sizes

6.9 mm 195 mm

2.4 mm

0.2 mm

RHRSGND

4 mm 14 mm

202 mm

∅6

mm

6 mm 3 mm 3.5 mm

GND RSRH

O-Ring ∅ 4mm x 1.5mm

Page 102: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Flow Sens FS5 / FS5A Thermal Mass Flow Sensor for all-purpose use in Gases

3/3

U_Bsabout2,7V...6V

Flow Sensoren FS1 oder FS5

+ U1A

LM2902

V4+12V

Q1MPSA05

500RR2

Outp

utR1140

R352

Heater

RH

Pt1200Rs

R41.2k

R512K

Electronic circuit recommendation of a CTA (constant temperature anemometer) The flow sensor can be implemented as a constant temperature anemometer (CTA), like shown in the figure below. With this electronic, the heater can be set up to a higher temperature compared to the fluid. The electrical power has to be controlled to achieve a constant temperature difference ∆T at different flow speeds. Hence, a flow-depending bridge voltage U_Bs is obtained as output signal. The resistors R1 to R5 can be chosen as shown in the circuit below. The temperature difference ∆T between heater (RH) and fluid (RS) is set up by resistor R1, e.g. ∆T=30K for air. The resistor R2 should be adjustable within ±10% for calibration. Adjustment depends on the application. Electronic circuit and curve progression are examples. An individual calibration is necessary and depends on the application.

Typical signal – curve between 0 .... 5 m/s

Custom specific solutions The sensor electrical connections or connectors (e.g. JST EHR3) can be custom specific. Development and fabrication of custom specific chip design and sensor packaging on request.

2.5

2.7

2.9

3.1

3.3

3.5

3.7

3.9

0 1 2 3 4 5Flow velocity [m/s]

Brid

geVo

ltage

U_B

s[V

]

1.1M

TLV27L1

All

mec

hani

cald

imen

sion

sar

eva

lidat

25°C

ambi

entt

empe

ratu

re,i

fnot

diffe

rent

lyin

dica

ted.

All

data

exce

ptth

em

echa

nica

ldim

ensi

ons

only

have

info

rmat

ion

purp

oses

and

are

nott

obe

unde

rsto

odas

assu

red

char

acte

ristic

s.

Tech

nica

lcha

nges

with

outp

revi

ous

anno

unce

men

tas

wel

las

mis

take

sre

serv

e.

The

info

rmat

ion

onth

isda

tash

eetw

asex

amin

edca

refu

llyan

dw

illbe

acce

pted

asco

rrec

t;N

olia

bilit

yin

case

ofm

ista

kes.

Load

with

extre

me

valu

esdu

ring

alo

nger

perio

dca

naf

fect

the

relia

bilit

y.A

llrig

hts

rese

rved

.The

mat

eria

lco

ntai

ned

here

inm

ayno

tbe

repr

oduc

ed,a

dapt

ed,m

erge

d,tra

nsla

ted,

stor

ed,o

ruse

dw

ithou

tthe

prio

rwrit

ten

cons

ento

fthe

copy

right

owne

r.Ty

ping

erro

rsan

dm

ista

kes

rese

rved

.Pro

duct

spec

ifica

tions

are

subj

ectt

och

ange

with

outn

otic

e.A

llrig

hts

rese

rved

DFF

S5_

E1.

0

Flow Sensoren FS5 / FS5A

Page 103: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

Appendix I

Arduino Code

Contents

I.1 Main.ino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80I.2 Controller.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84I.3 Controller.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88I.4 FS5.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90I.5 F5.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92I.6 quickSort.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94I.7 quickSort.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

79

Page 104: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.1 Main.ino

The main program for the prototype:

/* Filename: main.ino* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose:* This scripts contains the main functionality for the safety system* prototype for Hotswaps automatic flagpole.** First, the code conducts a scan for the wind current and aligns the* FS5 sensor accordingly to the wind current.** It then records the wind velocity in intervalls and stores all* recorded values in an array. The array is then sorted and the* median wind velocity, which represent the current wind* velocity, can be determined by the middle element of the sorted array.** If the current wind velocity exceeds the maxiumum allowed wind* velocity a JSON array is created and printed to the serial monitor* with a status to lower the flag.** Else, if the current wind velocity is in the allowed span, a JSON* array is created and printed to the serial monitor with a status to* not lower the flag.** Hardware:* MCU: ATmega328* Clock Speed: 16 MHz* Board: Arduino Nano 3.x* Used pins: A0, 7, 8, 9, 10, 12** Notes:* - The values U0, U50 and v50 are measured values and can vary.* - See Controller.cpp and FS5.cpp for a more thorough* understanding of the logic behind the scan- and* wind measuring procedure.

*/

80

Page 105: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.1. MAIN.INO

//Include libraries.#include "Controller.h"#include "FS5.h"#include "CheapStepper.h"#include "quickSort.h"#include <ArduinoJson.h>

//The input pin for the FS5 sensor.int pinFS5 = A0;

//The measured value for the voltage output from the FS5 sensor at windspeed 0% [V].

double U0 = 2.24;

//The measured value for the voltage output from the FS5 sensor at windspeed 50% [V].

double U50 = 3.33;

//The measured value for the wind speed at 50% [m/s].double v50 = 8;

//The constant to the FS5 calibrartion.double nFS5 = 0.51;

//Pins for the stepper motor.int IN1 = 10;int IN2 = 9;int IN3 = 8;int IN4 = 7;

//Pin for the limit switch input.int pinLS = 12;

//Initialize the quicksort algorithm.Sorting qs;

//Initialize the FS5.FS5sensor FS5(pinFS5, U0, U50, v50, nFS5);

//Intialize the controlling unit.Control controller(pinLS,IN1,IN2,IN3,IN4,pinFS5,U0,U50,v50,nFS5);

//Declaring the variables.double currentWindSpeed; //The current wind speed.double allowedWindSpeed = 2; //The allowed wind speed.double FS5ValArray[11] = 0; //Array for storing FS5 data.int N = sizeof(FS5ValArray)/sizeof(FS5ValArray[0]); //The number of

elements in the array

81

Page 106: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

void setup() Serial.begin(9600);

void loop() Serial.println("//////////////////////////////////////////////////////////");

//Scans the area for the highest wind speed,controller.scan();

Serial.println("Start wind measuring sequence...");

//Recording the wind speed at the the given point and stores the valuesin a array.

for(int k = 0; k < N; k++) FS5ValArray[k] = FS5.velocity();Serial.println(FS5ValArray[k]);delay(100);

Serial.println("Measuring sequence complete");

Serial.println("Determine the median value of the measuringsequence...");

//Sorting the array.qs.quickSorting(FS5ValArray, 0, N-1);

//Declares the current wind speed as the median value from the recordedsession.

currentWindSpeed = FS5ValArray[(N-1)/2+1];

Serial.println("Create and print JSON array...");Serial.println("");

//Creates a JSON array with information about the current//windspeed and prints it to the Serial monitor.if ( currentWindSpeed > allowedWindSpeed)

StaticJsonDocument<200> doc;doc["Sensor"] = "FS5";doc["Wind Speed"] = currentWindSpeed;doc["Status"] = "True";doc["Info"] = "Wind speed is NOT in the allowed span. Lower the flag.";serializeJson(doc,Serial);

82

Page 107: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.1. MAIN.INO

elseStaticJsonDocument<200> doc;doc["Sensor"] = "FS5";doc["Wind Speed"] = currentWindSpeed;doc["Status"] = "False";doc["Info"] = "Wind speed is in the allowed span. ";serializeJson(doc,Serial);

Serial.println(" ");Serial.println(" ");Serial.println("Program complete");

83

Page 108: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.2 Controller.cpp

The library for controlling the stepper motor for scanning and detection of the axisof maximum wind velocity:

/* Filename: Controller.cpp* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose:* Library for controlling the stepper motor to preform scanning* procedure.** Hardware:* Stepper Motor: 28byj-48 12V* Driver: ULN2003 IC** Notes:* - In order for this library to work, please install the library* CheapStepper created by tyhenry via:* https://github.com/tyhenry/CheapStepper*/

//Includes necessary libraries.#include "Arduino.h"#include "Controller.h"#include "CheapStepper.h"#include "FS5.h"

/* Constructor: Control::Control(int limitSwitch, int IN1, int IN2, intIN3, int IN4, int pin, double U0, double U50, double v50, double n)

** Purpose: Setup for the class Control. Declaring private variables.** Input: Pin for limitSwitch (int limitSwitch)* Pins for stepper motor (int IN1 - int IN4)* Pin for FS5 (int pin)* Voltage at wind speed 0% (double U0)* Voltage at wind speed 50% (double U50)* Wind velocity at wind speed 50% (double v50)* Value to setup FS5 for parameter n (double n)** Output: None

*/

84

Page 109: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.2. CONTROLLER.CPP

Control::Control(int limitSwitch, int IN1, int IN2, int IN3, int IN4, intpin, double U0, double U50, double v50, double n)

_limitSwitch = limitSwitch;_IN1 = IN1;_IN2 = IN2;_IN3 = IN3;_IN4 = IN4;_pin = pin;_U0 = U0;_U50 = U50;_v50 = v50;_n = n;pinMode(limitSwitch,INPUT);

/* Function: void Control::scan()** Purpose: Find the direction of, and align the sensor to, the wind* current by scanning a span of approximately 180 degrees.** Input: None** Output: None

*/void Control::scan()

//Setup for the stepper motor and the FS5 sensor.CheapStepper stepper (_IN1,_IN2,_IN3,_IN4); //Initialize controller

//for stepper motor.stepper.setRpm(16); //Set the rpm of the

//stepper motor.FS5sensor FS5(_pin, _U0, _U50, _v50, _n); //Initialize FS5 sensor.

int stepCounter = 0; //Counter for step rotation.int state = 0; //The state for the switch case.bool startFind = true; //State variable used to find start position.bool cw = true; //The state variable for the direction.int Position = 0; //Current step position.int scaning = true; //State variable for the scanning process.double maxFS5 = 0; //Placeholder for the maximum voltage.int maxPosition; //Placeholder for the step position at maxFS5.int LSSafteyStep = 400; //The number of steps to release limit switch.bool safetyState; //State variable for releasing of limit switch.int calibration = 300; //Extra steps for calibration.

85

Page 110: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

//While scanning is true, scan until the maximum wind speed is found andthe sensor is aligned to the wind current.

while(scaning)//Switch statement for controlling logic of controller.switch(state)

/* Case 0:* Rotate the stepper motor cw until the limit switch is activated.* Then release the limit switch.*/

case 0:Serial.println("Detecting start position...");

while(startFind) //While startFind is true...stepper.step(cw); //Rotate steper motor one step cw.

//If the limit switch is activated the start position is found,change state variable to false.

if(digitalRead(_limitSwitch) == HIGH)startFind = false;

//Rotate stepper motor ccw to release the limit switch.for (int p = 0; p < LSSafteyStep; p++)

stepper.step(!cw); //Rotate ccw one step.

state = 1; //Change state and go to case 1.

Serial.println("Start position detected");

break;

/* Case 1:* Scans the span for the maximum value of the voltage from* the FS5 sensor. The scan is done when limit switch is activated.* Release the limit switch.*/

case 1:Serial.println("Scanning...");

//While limitSwitch is not activated...while(digitalRead(_limitSwitch) == LOW)

stepper.step(!cw); //Rotate one step ccw.double FS5valVolt = FS5.voltage(); //Get the current voltage.Position += 1; //Increase Position by one.stepCounter += 1; //Keep track of steps.

//If the current voltage from the FS5 is greater than the old,update the old value to the new.

if (FS5valVolt > maxFS5)

86

Page 111: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.2. CONTROLLER.CPP

maxFS5 = FS5valVolt; //Update the max voltage.maxPosition = Position; //Update position at max FS5.

//Move the stepper motor cw to release the limit switch.for (int p = 0; p < LSSafteyStep; p++)stepper.step(cw); //Rotate one step cw.

state = 2; //Go to case 2.Serial.println("Scanning complete");

break;

/* Case 2:* Rotates the stepper motor to align FS5 sensor to the wind

current.*/

case 2:Serial.println("Aligning sensor...");Position = 0; //Reset Position to zero.safetyState = true; //Reset safetyState to true.

//Rotates the stepper motor cw to the correct step to align theFS5 properly.

while((Position <stepCounter-maxPosition+LSSafteyStep+calibration) &&safetyState)

stepper.step(cw); //Rotate one step cw.Position = Position + 1; //Increase Position by one.

//If the limit switch is activated, move the stepper motorccw to release the limit switch.

if(digitalRead(_limitSwitch) == HIGH)for (int p = 0; p < LSSafteyStep; p++)

stepper.step(!cw); //Rotate one step ccw.safetyState = false; //Set safetyState to false.

//When the sensor has been aligned to the wind direction, thestate varible is set to false and the scan is done.

scaning = false;Serial.println("Alignment complete");break;

87

Page 112: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.3 Controller.h

The header file for the controller library:

/* Filename: Controller.h* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose:* Header for Controller library.** Hardware:* Stepper Motor: 28byj-48 12V* Driver: ULN2003 IC** Notes:* - In order for this library to work, please install the library* CheapStepper created by tyhenry via:* https://github.com/tyhenry/CheapStepper*/

#ifndef Controller_h //Include guard.#define Controller_h#include "Arduino.h"#include "CheapStepper.h"#include "FS5.h"

//Class for controlling the stepper motor.class Control

public:/* Constructor: Control::Control(int limitSwitch, int IN1, int IN2,

int IN3, int IN4, int pin, double U0, double U50, double v50,double n)

** Purpose: Setup for the class Control. Declaring privat* variables.** Input: Pin for limitSwitch (int limitSwitch)* Pins for stepper motor (int IN1 - int IN4)* Pin for FS5 (int pin)* Voltage at wind speed 0% (double U0)* Voltage at wind speed 50% (double U50)* Wind velocity at wind speed 50% (double v50)* Value to setup FS5 for parameter n (double n)*

88

Page 113: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.3. CONTROLLER.H

* Output: None*/Control(int limitSwitch, int IN1, int IN2, int IN3, int IN4, int pin,

double U0, double U50, double v50, double n);

/* Function: void Control::scan()** Purpose: Find the direction of, and align the sensor to, the* wind current by scanning a span of approximately* 180 degrees.** Input: None** Output: None

*/void scan();

private:int _limitSwitch; //Pin for limit switch.int _IN1; //Pin for Stepper motor.int _IN2; //Pin for Stepper motor.int _IN3; //Pin for Stepper motor.int _IN4; //Pin for Stepper motor.int _pin; //Pin for FS5.double _U0; //Voltage U at wind speed 0%.double _U50; //Voltage U at wind speed 50%.double _v50; //Wind velocity v at wind speed 50%.double _n; //Value to setup FS5 for parameter n.

;#endif

89

Page 114: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.4 FS5.cpp

The library for measuring, calculating and filtering wind velocity data with the FS5:

/* Filename: FS5.cpp* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose :* Library for the FS5 sensor.** Hardware:* Sensor: FS5 Thermal Mass Flow Sensor** Notes:* - In order for this library to work, please install the library* Filters created by hideakitai via:* https://github.com/hideakitai/Filters* - In order to get a signal from the FS5 sensor, the sensor has to be* configured in a constant temperature setup.*/

//Include libraries.#include "Arduino.h"#include "FS5.h"#include "Filters.h"

float filterFrequency = 0.3; //Set filter frequency.

//Initialize low pass filter.FilterOnePole filterOneLowPass(LOWPASS, filterFrequency);

/* Constructor: FS5sensor::FS5sensor(int pin, double U0, double U50,double v50, double n)

** Purpose: Setup for the class FS5sensor. Declaring private* variables. Calculate fluidic dependent constant k.** Input: Pin for FS5 (int pin)* Voltage U at wind speed 0% (double U0)* Voltage U at wind speed 50% (double U50)* Wind speed v at wind speed 50% (double v50)* Value to setup FS5 for parameter n (double n)** Output: None

90

Page 115: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.4. FS5.CPP

*/FS5sensor::FS5sensor(int pin, double U0, double U50, double v50, double n)

_pin = pin;_U0 = U0;_U50 = U50;_v50 = v50;_n = n;_k = (pow(U50/U0,2)-1)/pow(v50,n);

/* Function: double FS5sensor::voltage()* Purpose: Mapping the input signal from the FS5 sensor to voltage* and filter the signal.** Input: None** Output: The current voltage input from the FS5 sensor.

*/double FS5sensor::voltage()

//Mapping the signal to voltage and filter out noise.double voltage =

filterOneLowPass.input(analogRead(_pin)/_c*_maxInputVoltage);return voltage;

/* Function: double FS5sensor::velocity()* Purpose: Calculate the wind velocity.** Input: None** Output: Wind velocity

*/double FS5sensor::velocity()

double U = voltage(); //Record the current voltage.

//If the recorded voltage is lower than the voltage U0 at 0% wind speed,the current voltage is set to U0. This can happen due to errormargins in the measurement of U0.

if(U<_U0)U = _U0;

//Calculates the wind velocity from given parameters and the recordedvoltage U.

double vel =(pow(((U-_U0)*(U+_U0)),(1/_n)))/(pow(_k,(1/_n))*(pow(_U0,(2/_n))));

return vel;

91

Page 116: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.5 F5.h

The header file for the FS5 sensor library:

/* Filename: FS5.h* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose :* Header for FS5 library.** Hardware:* Sensor: FS5 Thermal Mass Flow Sensor** Notes:* - In order for this library to work, please install the library* Filters created by hideakitai via:* https://github.com/hideakitai/Filters* - In order to get a signal from the FS5 sensor, the sensor has to be* configured in a constant temperature setup.*/

#ifndef FS5_h //Include guard.#define FS5_h#include "Arduino.h"#include "Filters.h"

//Class for mapping input signal from the FS5 sensor to voltage and windvelocity.

class FS5sensor public:

/* Constructor: FS5sensor::FS5sensor(int pin, double U0, double U50,double v50, double n)

** Purpose: Setup for the class FS5sensor. Declaring private* variables. Calculate fluidic dependent constant k.** Input: Pin for FS5 (int pin)* Voltage U at wind speed 0% (double U0)* Voltage U at wind speed 50% (double U50)* Wind speed v at wind speed 50% (double v50)* Value to setup FS5 for parameter n (double n)** Output: None

*/

92

Page 117: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.5. F5.H

FS5sensor(int pin, double U0, double U50, double v50, double n);

/* Function: double FS5sensor::voltage()* Purpose: Mapping the input signal from the FS5 sensor to voltage* and filter the signal.** Input: None** Output: The current voltage input from the FS5 sensor.

*/double voltage();

/* Function: double FS5sensor::velocity()* Purpose: Calculate the wind velocity.** Input: None** Output: Wind velocity

*/double velocity();

//Private variables.private:

int _pin; //Pin for input signal for the FS5.double _U0; //Voltage U at wind speed 0%.double _U50; //Voltage U at wind speed 50%.double _v50; //Wind velocity v at wind speed 50%.double _n; //Value to setup FS5.double _k; //Fluidic dependent constant.double _c = 1023; //Parameter to map input signal.double _maxInputVoltage = 5; //Maximum input voltage from FS5.

;#endif

93

Page 118: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

I.6 quickSort.cpp

The library for sorting and averaging the measured wind velocity:

/* Filename: quickSort.cpp* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose:* Library for the quicksort algorithm.*/

//Include libraries.#include "Arduino.h"#include "quickSort.h"

/* Constructor: Sorting()* Purpose: Setup for the class Sorting.** Input: None** Output: None

*/Sorting::Sorting()

/* Function: switchElements(double* left, double* right)* Purpose: Switch two elements with each other.** Input: Pointer to the left element. double* left* Pointer to the right element. double* right** Output: None.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.* [Accessed: 01- May- 2019].

*/void Sorting::switchElements(double* left, double* right)

double temp = *left; //Temporary placeholder for the left value.*left = *right; //Overwrite the the left value with the right.*right = temp; //Overwrite the the rigth value with the left.

94

Page 119: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.6. QUICKSORT.CPP

/* Function: part(double arr[], int low, int high)* Purpose: Creates a pivot point from the last element in the array.* Arrange all elements that is lesser than the pivot point to* the left of this pivot point and all that is greater to the* right. Then done, moves the pivot point to its proper index* in the array and returns this index.** Input: An array with elements double Array[]* Lowest index in Array int farLeftIndex* Highest index in Array int farRightIndex** Output: The index for the pivot points proper position.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.* [Accessed: 01- May- 2019].

*/int Sorting::part(double Array[], int farLeftIndex, int farRightIndex)

//Creates a pivot point from the last element in array.double piv = Array[farRightIndex];

//Keeps track of index lower than the pivot points value.int i = (farLeftIndex - 1);

//Goes through every element in array and places everything smallerthan the pivot point to the left.

for (int j = farLeftIndex; j <= farRightIndex - 1; j++)if (Array[j] <= piv)

i = i + 1;switchElements(&Array[i], &Array[j]);

//When done, move the pivot point to its proper position. Noweverything that is greater than the pivot point is to the right.

switchElements(&Array[i + 1], &Array[farRightIndex]);return (i + 1);

95

Page 120: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

/* Function: quickSorting(double Array[], int farLeftIndex, intfarRightIndex)

* Purpose: Create a partiton from the given inputs and recursively do* so until list is sorted.** Input: An array with elements. double Array[]* Lowest index of partion. int farLeftIndex.* Highest index of partion. int farRightIndex** Output: None.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.* [Accessed: 01- May- 2019].

*/void Sorting::quickSorting(double Array[], int farLeftIndex, int

farRightIndex)//If the farLeftIndex is the same as the farRightIndex, there is only

one element in the array and no need to sort it.if (farLeftIndex < farRightIndex)

//Creates a partion and places the pivot point to its properposition in the array.

int partionIndex = part(Array, farLeftIndex, farRightIndex);

//Recursively do the same thing but for the left and right part ofthe array.

quickSorting(Array, farLeftIndex, partionIndex - 1);quickSorting(Array, partionIndex + 1, farRightIndex);

96

Page 121: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

I.7. QUICKSORT.H

I.7 quickSort.h

The header file for the sorting library:

/* Filename: quickSort.h* Project Name: Compact Safety system for automatic flagpole* Contributors: Carl Jensen and David Strom* Programme: Design and Product Realisation (CDEPR)* Date: 28-05-2019* University: KTH Royal Institute of Technology* Course: MF133X Degree Project in Mechatronics** Purpose :* Header for the quickSort library.*/

//Include libraries.#ifndef quickSort_h //Include guard.#define quickSort_h#include "Arduino.h"

//Class for quicksort algorithm.class Sorting

public:/* Constructor: Sorting()* Purpose: Setup for the class Sorting.** Input: None** Output: None

*/Sorting();

/* Function: part(double arr[], int low, int high)* Purpose: Creates a pivot point from the last element in the* array. Arrange all elements that is lesser than the* pivot point to the left of this pivot point and all that* is greater to the right. Then done, moves the pivot* point to its proper index in the array and returns this* index.** Input: An array with elements double Array[]* Lowest index in Array int farLeftIndex* Highest index in Array int farRightIndex** Output: The index for the pivot points proper position.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.

97

Page 122: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

CONTENTS

* [Accessed: 01- May- 2019].*/int part(double Array[], int farLeftIndex, int farRightIndex);

/* Function: quickSorting(double Array[], int farLeftIndex, intfarRightIndex)

* Purpose: Create a partiton from the given inputs and* recursively do so until list is sorted.** Input: An array with elements. double Array[]* Lowest index of partion. int farLeftIndex.* Highest index of partion. int farRightIndex** Output: None.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.* [Accessed: 01- May- 2019].

*/void quickSorting(double Array[], int farLeftIndex, int farRightIndex);

/*Function: switchElements(double* left, double* right)* Purpose: Switch two elements with each other.** Input: Pointer to the left element. double* left* Pointer to the right element. double* right** Output: None.** Source: "QuickSort - GeeksforGeeks", GeeksforGeeks, 2019. [Online].* Available: https://www.geeksforgeeks.org/quick-sort/.* [Accessed: 01- May- 2019].

*/void switchElements(double* left, double* right);

;

#endif

98

Page 123: Compact safety system for automatic flagpole Kompakt ...kth.diva-portal.org/smash/get/diva2:1373566/FULLTEXT01.pdfa prototype was developed for testing the performance of the implementation

TRITA TRITA-ITM-EX 2019:54

www.kth.se