Tải bản đầy đủ (.pdf) (28 trang)

Final Report - Bioinstrumentation.pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.78 MB, 28 trang )

<span class="text_page_counter">Trang 1</span><div class="page_container" data-page="1">

<b> </b>

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY

<b>SCHOOL OF ELECTRONICS AND TELECOMMUNICATIONS </b>

Name of instructor: Dr. Nguyen Phan Kien

</div><span class="text_page_counter">Trang 2</span><div class="page_container" data-page="2">

4. Theoretical Approach... 13-14 4.1 IoT ThingsBoard ... 15-16 4.2 Implementation ... 15-16 5. Circuit Design ... 16

5.1 Power supply circuit ... 16

5.1.1. Specification ... 16

5.1.2. Components ... 165.1.2.1. 5V Power Supply ... 16-175.1.2.1. Power Supply 3V ... 17-18

</div><span class="text_page_counter">Trang 3</span><div class="page_container" data-page="3">

5.2.1 Specification ... 19

5.2.2 Components ... 19-20 5.2.2.1 ESP32 ... 20

5.2.2.2 MPU-6050 ... 22-236. Website/Application User Interface ... 23

6.1. System Analysis ... 23

6.1.2 Actors and their relationship ... 23

6.1.3 Use Cases Diagram ... 23-246.2. Visual Studio Code ... 24

6.2.1 Visual Studio Code – Dart Flutter ... 24

6.2.2 Program ... 24-257. Interact with ThingsBoard-IoT Platform ... 25

7.1. Thingsboard - IoT platform with Web/App ...

25-267.2. Thingsboard - IoT platform with Device ...

267.2.1 MQTT Basics ... 26-277.2.2 MQTT Connect ... 27

8. Test and Evaluation ... 27

8.1 Software ... 27

8.1.1 Firmware and Server ... 28

8.1.1 Problems and Solutions ... 28

8.2 Hardware ... 28

8.2.1 Power supply circuit ... 29

8.2.2 Metering circuit ... 29-308.2 Website/Application …... 30

FUTURE DEVELOPMENT ... 31

</div><span class="text_page_counter">Trang 4</span><div class="page_container" data-page="4">

List of Figures

Fig

. (1) : Common three-tier architecture of biological databases

...14 Fig

. (2) : ThingsBoard foundation ...15 Fig

. (3) : 5V Basic Application Circuit ...17 Fig

. (4): 5V Power Circuit Schematic Design ...17 Fig

. (5) : 3.3V Basic Application Circuit ...18 Fig

. (6) : 3.3V Power Circuit Schematic Design...18 Fig

. (7) PCB Top View ...18 Fig

. (8) PCB Bottom View ...19 Fig

. (9) ESP32-WROOM-32 Pin Layout (Top view)... 20 Fig

. (10) ESP32-WROOM-32 Schematic Design... 21 Fig

. (11) PCB Top View ... 21 Fig

. (12) PCB Bottom View ... 21 Fig

. (13) QNF Package... 22Fig

. (14) Orientation of Axes of Sensitivity and Polarity of Rotation... 23Fig

. (15) MPU-60X0 Schematic Design... 23Fig

. (16) Use Cases Diagram... 24Fig

. (17) MQTT Protocol... 25Fig

. (18) PUBLISH message ... 26Fig

. (19) Telemetry upload API ... 26 Fig

. (20) Telemetry upload API ... 26

</div><span class="text_page_counter">Trang 5</span><div class="page_container" data-page="5">

List of Tables

Table 3.1 Task Table ... 9-11 Table 3.2 Resources Assigning Table ... 11-12 Table 4 .1 Power Supply Specifications ... 16Table 4 . 2 Metering Circuit Specifications ... 16

</div><span class="text_page_counter">Trang 6</span><div class="page_container" data-page="6">

<b> ABSTRACT </b>

ThingsBoard is an open-source IoT platform that allows the development,management, and scaling of IoT projects. We utilize the serverinfrastructure and Use Cases provided by the ThingsBoard platform tostore, track and analyze the data from our application. The goal of thisproject is to successfully simulate a biological database system, anddesign, and implement a monitoring system that measures and recordsthe arm rotation angle of patients recovering from fractured arms. In thisreport, the design and specifications of the system are explained. Thesystem includes a physical sensor device and a Website/Application(Web/App) user interface.

</div><span class="text_page_counter">Trang 7</span><div class="page_container" data-page="7">

<b> </b>

<b> INTRODUCTION </b>

In the Biomechanics field, capturing human motion is fundamentalfor future developments and further studies. Obtaining data defining thegeometry of human body movement in space and time, known ascapturing human motion (spatial or 3D kinematics), is subsequentlyessential.

As the result, over the past two decades, an explosion in the amountof available biological data has been observed. This growth spurt ismainly due to the development of technology, creating a gateway forbiological knowledge to expand from an exclusive industry that was theobject of interest to only a few specialized disciplines, to becomeessential resources that are utilized daily by both biologists and medicalspecialists worldwide.

In this paper, we propose a modified database system, focusing onaiding medical specialists to monitor hand recovery of patients withfractured forearms post cast removal. We took full advantage of the IoTThingsBoard and Ubuntu server with the addition of a physicalmonitoring device, comprised of a sensor and an ESP32 microprocessor,and developed further by refining the Website/Application interface. This report summarizes the building and testing process, andanalyzes, discusses, and evaluates the testing results and overallperformance of the proposed system.

<b>1. Purpose </b>

Create a working system to aid medical specialists to monitorthe hand recovery of patients with fractured forearms postcast removal.

</div><span class="text_page_counter">Trang 8</span><div class="page_container" data-page="8">

Build a sensor device that transfers data to the user interfacethrough WiFi connection.

Able to measure and record real-time data of the patient’sarm motion.

Produce a database system with smooth navigation and cleardata classification.

Familiarize with IoT ThingsBoard server platform and IoT UseCases.

Understand the structure and operation of accelerometerMPU-6050, microprocessor ESP32, and voltage regulatorLM1117MPX-3.3/NOPB.

2.1.2. Purpose and Scope

</div><span class="text_page_counter">Trang 9</span><div class="page_container" data-page="9">

This report addresses all requirements, planning, and testing neededto simulate the sensor device, the Web/App interface, and the databasesystem server and assess the overall performance of the final product.

<b>2.2. Project Description </b>

2.2.1. Project Context

The project is independent and self-contained. It is not related to anyother projects or larger systems. It should only be built to the“Biomechanics” class requirements and is to be used mainly as a basisfor students’ future research and experiments.

<b>3. Planning </b>

The next phase of this project is plan development. It takes 9 weeks to complete the project.

<b>3.1 Task Table </b>

Our project consists of 17 tasks. Each task has its own deliverables.

<b>The projec starts on May 08, and ends on July 26. </b>

<b>Task No</b>

<b>Task Name</b>

<b>Start Date</b>

<b>Format</b>

</div><span class="text_page_counter">Trang 10</span><div class="page_container" data-page="10">

cal

y 08, 2022

#2

Report Researched Material

< 1 day

May 15,2022

May15, 2022

Documented in MS Word and Powerpoint

#3

Build block diagramsfor Server, DatabaseWork, and Overall Structure

2 weeks

May16,2022

May31, 2022

Powerpoint Platform

#4

Design Use Cases diagram

2 weeks

June01,2022

June01, 2022

Create schematic design for all circuits

2 weeks

Create PCB designs for all circuits

2 daysJune01,2022

Design and set up Web/App User Interface

3 weeks

June03,2022

June242022

Dart Platform Fultteron Visual Studio Code

</div><span class="text_page_counter">Trang 11</span><div class="page_container" data-page="11">

API to transfer data to server

weeks e03,2022

17,2022

Platform

Build andtroubleshoot code for

MPU-1 weekJune 01, 2022

June08, 2022

#4 <sup>C++ on Visual </sup><sub>Studio Code </sub>

Build andtroubleshoot code to transfer data to server

1 weekJune08,2022

#2 <sup>C++ on Visual </sup><sub>Studio Code</sub>

Build andtroubleshoot ESP32 Wi-Fi Manger codes

3 weeks

June 15,2022

#2 <sup>C++ on Visual </sup><sub>Studio Code</sub>

Test and trouble -shoot system codes

2 weeks

#4 <sup>C++ on Visual </sup><sub>Studio Code</sub>

#14Test device and troubleshoot device errors

2 weeks

#15 Test finished circuit and analyze the

< 1 day

format

</div><span class="text_page_counter">Trang 12</span><div class="page_container" data-page="12">

Report in MS Word and Powerpoint format

#17 <sup>Research</sup><sub>Paper</sub> <sup>3 </sup><sub>weeks</sub>July05,2022

Table 3.1 Task Table

<b>3.2. Human Resource Table </b>

There are 5 people on our team. Since each member has different strengths and weaknesses, we have created the following task allocations table according to personal competence and preferences.

Phuong Bui

Web/App user interface

Hang Nguyen

troubleshoot code for MPU-6050

Huong Nguyen

</div><span class="text_page_counter">Trang 13</span><div class="page_container" data-page="13">

#6 Set up API to transfer data to server

Ngan Ta Huong Nguyen

troubleshoot code to transfer data to server

Ngan Ta

troubleshoot ESP32 Wi-Fi Manger codes

Tram Nguyen Ngan Ta

circuit and analyze the results

Everyone

Table 3.2 Resources Assigning Table

<b>RESEARCH METHOD 4. Theoretical Approach </b>

Biological databases store and present information about livingorganisms, which serve as essential research tools for future experimentsand research in the field of medical as they provide convenient access toprior knowledge. Due to their indispensable role in scientific research, thenumber of public biological databases has spiked over the years. Thejournal Nucleic Acid Research (NAR) recorded its biological databasesincreasing substantially from 2 in 1980 to 182 in 2016 [ CITATION Rig16 \l1033 ]. By 2021, the latest update on the NAR online Molecular BiologyDatabase Collection brought the number of database entries to a total of1641 [ CITATION Rig21 \l 1033 ]. Many of these databases are long-term,

</div><span class="text_page_counter">Trang 14</span><div class="page_container" data-page="14">

<b>Fig. (8): PCB Bottom View</b>

Recommendedoperating ambienttemperature rang

-40 °C to 85 °C

Integrated SPI flashIntegrated crystal

(802.11n up to 150Mbps)

A-MPDU and A-MSDUaggregation and 0.4μs guard intervalsupport

Center frequencyrange of operatingchannel

</div><span class="text_page_counter">Trang 15</span><div class="page_container" data-page="15">

ranging from low-power sensor networks to the most demanding tasks,such as voice encoding, music streaming and MP3 decoding.

</div><span class="text_page_counter">Trang 16</span><div class="page_container" data-page="16">

Pin Layout:

</div><span class="text_page_counter">Trang 18</span><div class="page_container" data-page="18">

<b> Fig. (15): MPU-60X0 Schematic Design</b>

<b>6. Website/Application User Interface </b>

<b>6.1 System analysis</b>

6.1.2 Actors and their relationship

Our program has 2 actors: Users (Nurses, Patients, etc) andAdministrators.

Users: Users use the program for getting information frompatients and measuring the change of their Center of Gravity(CG). User is the highest manager of the program.

Administrators: An administrator manages the database andupdates the system.

6.1.3 Use case Diagram

<b> Actors’ “Users” have the Use Cases below:</b>

Log in / Register

Add information of patientsView the results

<b> Actors’ “Administrators” have the Use Cases below:</b>

Manage the DatabaseUpdate the system

</div><span class="text_page_counter">Trang 19</span><div class="page_container" data-page="19">

The relationships are described by the General Use Cases diagrambelow:

<b> Fig. (16): Use Cases Diagram</b>

<b>6.2 – Visual Studio Code </b>

6.2.1 Visual Studio Code – Dart Flutter

Dart is a new programming language, developed by Google, nowapproved by Ecma organization. Dart is utilized to build various kind ofapplications: web, server, mobile (IOS and Android with Flutter engine).

Dart is a language that supports object-oriented programming, style syntax which can be compiled into JavaScript to run in the browser. It supports modern programming concepts such as class interfaces, abstract classes, etc. Built on Dart programming language, Google introduces the Futter SDK to develop cross-platform mobile applications (IOS and Android). In our project, we use Visual Studio Code for creating a Mobile Application.

</div><span class="text_page_counter">Trang 20</span><div class="page_container" data-page="20">

Measuring Interface:

<b>7. Interact with Thingsboard- IOT platform</b>

ThingsBoard is an open-source IoT platform that allows thedevelopment, management, and scaling of IoT projects. We utilize theserver infrastructure and Use Cases provided by the ThingsBoardplatform to store, track, and analyze the data from our application.

<b>7.1 Thingsboard - IoT platform with Web/App</b>

Thingsboard interacts with clients through the REST API, ThingsBoardREST APIs interactive documentation is available via Swagger UI. Fromthis interface page, we have learned to use the APIs necessary for ourproject to interact and design with our own website which we developourselves.

<b>API (</b>Application Programming Interface): is a set of rules andmechanisms by which an application or component interacts withanother application or component. API can return the data you need foryour application in common data types like JSON or XML.

<b>REST </b>(Representational State Transfer): is a form of data structuretransformation, an architectural style for writing APIs. It uses simple HTTPmethods to facilitate machine-to-machine communication. So, instead ofusing a URL for handling some user information, REST sends an HTTPrequest like GET, POST, DELETE, etc. to a URL to process the data.

<b>JWT Tokens: </b>ThingsBoard uses JWT tokens for representing claimssecurely between the API client (browser, scripts, etc) and the platform.When you login to the platform, your username and password isexchanged to the pair of tokens. The token lasts for a period of 24 hoursto make API calls and the token is refreshed once it expires.

</div><span class="text_page_counter">Trang 21</span><div class="page_container" data-page="21">

Device Connectivity Protocol with ThingsBoard - IOT platform: MQTTprotocol

7.2.1 MQTT basics

MQTT (Message Queueing Telemetry Transport) is a lightweightpublish - subscribe messaging protocol. It operates under the publish -subscribe mechanism according to ISO standards (ISO/IEC 20922), opensOASIS to transmit messages between devices, and performs on TCP/IPplatform. MQTT is designed for data transmission among remote devices,small devices, microcontrollers with limited resources, or in applicationswith limited network bandwidth.

3. QoS 2: Broker/client ensures that when sending data, thereceiver receives only once, this process goes through 4handshake steps.

</div><span class="text_page_counter">Trang 22</span><div class="page_container" data-page="22">

We apply QoS 0 for data transmission.7.2.2 MQTT connect

Collected data is pushed via MQTT to ThingsBoard- IOT platformserver for storage and visualization. We use access token devicecredentials called $ACCESS_TOKEN. The application sends “MQTTCONNECT” message with username that contains $ACCESS_TOKEN. Telemetry upload API: To publish telemetry data to ThingsBoardserver node, send PUBLISH message to the following topic:

<b> Fig. (18): PUBLISH message</b>

With:

The simplest supported data formats are: Json format (Payload)

"$THINGSBOARD_HOST_NAME": sv11.vshome.com.vnPort: 1883.

</div><span class="text_page_counter">Trang 23</span><div class="page_container" data-page="23">

Website/ Application8.1.1 Firmware and server

At first, we set Fi as station mode, but it only applies to fixed Fi. Therefore, we changed Wi-Fi setting as access point mode. Afterconnecting to Wi-Fi, we test transferring our device's measured data onthe ThingsBoard server. Testing time taken to transfer data from thedevice to server is one second. We attempted to transfer data to cloudserver several times and recorded the measured parameters of the

<b>Wi-MPU6050 acceleration module in Fig. (14)</b>

<b>Fig. (20): Telemetry upload API</b>

Then, we tested and recorded real-time data transfer of our device.We obtained a time of about one minute and thirty seconds for themicroprocessor ESP32 to broadcast its Wi-Fi and it takes about four tofive seconds for the data to be transferred to the server after connectedto ESP32.

8.1.2 Problems and Solutions

Two problems we stumbled upon are (1) amidst sending data to theserver, the device loses Wi-Fi connection and unable to automaticallyreconnect, (2) unable to connect to another Wi-Fi. We solved both issuesconfiguring an On and Off button for the device.

<b>8.2 Hardware</b>

The next phase of our project is testing metering circuit withaccelerometer MPU-6050 and the power supply circuit with voltage

</div><span class="text_page_counter">Trang 24</span><div class="page_container" data-page="24">

regulator LM1117MPX-3.3/NOPB. In this circuit we use 3.7V 500mAhbattery. The battery could last 1 hour before recharging is required.

8.2.1 Power supply circuit

was not equal to theoretical value of 0.6V. We fixed the problem bychanging the values of R1 and R2 so that output of the circuit wasreduced to ~ 3.3V and 5V.

8.2.2 Metering circuit

We encountered short-circuit due to too much soldering in theMPU6050, causing the pins to stuck together. We proceeded to removeand re-solder the circuit. However, the MPU6050 IC was damaged duringthe process. We replaced the IC with GY-521 MPU-6050 module.

Lastly, we test our User Interface. At first run, we were not able todisplay data on user interface. We fixed the problem by adding analgorithm to add APIs to our set-up code.

<b> </b>

<b> </b>

</div>

×