Bachelor Thesis of Liu (2017) [18]
Total Page:16
File Type:pdf, Size:1020Kb
Abstract of Thesis Zusammenfassung der Arbeit Abstract of Thesis Fachbereich: Electrical Engineering and Computer Science Department: : Studiengang: Information Technology University course: : Thema: Raspberry Pi Programming with Windows IoT using C# and Subject: Xamarin.Forms – Hardware connections with I²C Zusammenfassung: Abstract: The aim of this thesis is to investigate the possibilities and limitations of Raspberry Pi programming with Windows IoT operating system and Xamarin.Forms – a cross-platform development toolkit in C#. The thesis was conducted in May 2018 at Fachhochschule Lübeck. This topic is of interest because the Raspberry Pi, Windows IoT and Xamarin.Forms are new technologies for software development. This study did several programming experiments. These programs were connected to I²C devices to fulfil their tasks such as run time comparison to Python, converting Windows Forms applications to Xamarin.Forms applications, automation control program for temperature and balance, and remote control with Android smartphone. In addition, some C# external libraries like “Microcharts” for chart display and “MicroTimer” for high-performance timer were also investigated and used in the programs. The results show that Raspberry Pi with Windows IoT is capable of performing the automation control as expected, the “Microcharts” and “MicroTimer” can be easily implemented by Xamarin.Forms. Furthermore, the conversion of the old C# applications as well as the cross- platform programming in Xamarin.Forms is considerably convenient. Despite of its limitation of compatibility problems and lack of UI elements, the Xamarin.Forms with Raspberry Pi and Windows IoT has shown their potential and they may be a suitable platform for software development. This thesis may be useful in providing an alternative way of Raspberry Pi programming and cross-platform application development. Verfasser: Author: Qiwen Gu Betreuender Professor/in: Attending Professor: Prof. Dr. Jörg Bayerlein WS / SS: SS <2018> iv Table of Contents Table of Contents Abstract of Thesis ............................................................................................................................ iv Table of Contents ............................................................................................................................. v 1 Introduction .............................................................................................................................. 1 1.1 Motivation ......................................................................................................................... 1 1.2 Goal ................................................................................................................................... 1 1.3 Organization ...................................................................................................................... 2 2 Basic information and technologies ......................................................................................... 3 2.1 Hardware and development environment .......................................................................... 3 2.2 Background knowledge ..................................................................................................... 3 2.2.1 Raspberry Pi ............................................................................................................... 3 2.2.2 I²C devices .................................................................................................................. 4 2.2.3 Xamarin.Forms and C# .............................................................................................. 5 2.2.4 Microsoft Visual Studio ............................................................................................. 6 3 Design of the main applications ............................................................................................... 7 3.1 Functional requirements of the main applications ............................................................. 7 3.1.1 Analog and digital convertor voltage measurement ................................................... 7 3.1.2 Chart display .............................................................................................................. 7 3.1.3 Temperature automation control ................................................................................ 7 3.1.4 Android smartphone remote control .......................................................................... 7 3.1.5 Balance automation control ........................................................................................ 7 3.1.6 Page navigation .......................................................................................................... 8 3.2 Non-functional requirements of the main applications ..................................................... 8 3.2.1 Usability ..................................................................................................................... 8 3.2.2 Reliability ................................................................................................................... 8 3.2.3 Compatibility .............................................................................................................. 8 3.2.4 Programming and human interface design ................................................................. 8 3.2.5 Extensibility ............................................................................................................... 8 3.3 Device connection design for experiment ......................................................................... 9 3.4 Software structure .............................................................................................................. 9 3.4.1 Human interface design .............................................................................................. 9 3.4.2 Use case diagram ...................................................................................................... 10 v Table of Contents 3.4.3 Class diagram ........................................................................................................... 11 4 Implementation of the applications ........................................................................................ 16 4.1 Setting up Raspberry PI 3 ................................................................................................ 16 4.1.1 Cable connection with peripherals ........................................................................... 16 4.1.2 Windows 10 IoT installation and software configuration ........................................ 17 4.1.3 Visual Studio configuration ..................................................................................... 18 4.1.4 Cable connection with I²C devices ........................................................................... 20 4.2 Timing performance comparison ..................................................................................... 21 4.2.1 Install Raspbian operating system on Raspberry Pi ................................................. 21 4.2.2 Timing performance application programming ....................................................... 21 4.2.3 Result of timing performance comparison ............................................................... 22 4.3 Timer component in Raspberry Pi ................................................................................... 24 4.3.1 Problem and timer components in C# ...................................................................... 24 4.3.2 Principle of the “MicroTimer” ................................................................................. 24 4.3.3 Implementation of the “MicroTimer” with “DependencyService” .......................... 25 4.3.4 Hardware connection with voltage meter ................................................................. 26 4.3.5 Result of “MicroTimer” output ................................................................................ 27 4.4 Xamarin.Forms programming with 2 ADCs and 2 DACs hardware .............................. 28 4.4.1 Hardware connection with Raspberry Pi .................................................................. 28 4.4.2 Original application introduction ............................................................................. 29 4.4.3 Human interface programming ................................................................................ 29 4.4.4 Functional programming .......................................................................................... 31 4.4.5 Result of “ADC-DAC” application .......................................................................... 32 4.5 Chart display in Raspberry Pi .......................................................................................... 33 4.5.1 Problem and solution of chart display on Raspberry Pi ........................................... 34 4.5.2 Implementation of the “Microcharts” ...................................................................... 34 4.5.3 Result of “Microcharts” display on Raspberry Pi .................................................... 36 4.6 Temperature automation control program ....................................................................... 37 4.6.1 Raspberry Pi hardware connection ........................................................................... 37 4.6.2 Temperature control program development ............................................................. 39 4.6.3 Result