DEVELOPMENT OF AUTOMATED PILLBOX WITH IOT FEATURES FOR PT. PHAROS INDONESIA
By
Alvin Tri Hartono 11601043
BACHELOR’S DEGREE in
MECHANICAL ENGINEERING – MECHATRONICS CONCENTRATION FACULTY OF ENGINEERING AND INFORMATION TECHNOLOGY
SWISS GERMAN UNIVERSITY The Prominence Tower
Jalan Jalur Sutera Barat No. 15, Alam Sutera Tangerang, Banten 15143 - Indonesia
Revision after Thesis Defense on 7 July 2020
Alvin Tri Hartono STATEMENT BY THE AUTHOR
I hereby declare that this submission is my own work and to the best of my knowledge, it contains no material previously published or written by another person, nor material which to a substantial extent has been accepted for the award of any other degree or diploma at any educational institution, except where due acknowledgement is made in the thesis.
Alvin Tri Hartono
_____________________________________________
Student Date
Approved by:
Leonard P. Rusli, B.Sc., M.Sc, Ph.D.
_____________________________________________
Thesis Advisor Date
Rudijanto, S.Kom.
_____________________________________________
Thesis Co-Advisor Date
Dr. Maulahikmah Galinium, S.Kom., M.Sc.
_____________________________________________
Dean Date
Alvin Tri Hartono ABSTRACT
DEVELOPMENT OF AUTOMATED PILLBOX WITH IOT SYSTEM FOR PT.
PHAROS INDONESIA
By
Alvin Tri Hartono
Leonard P. Rusli, B.Sc., M.Sc, Ph.D.
Rudijanto, S.Kom.
SWISS GERMAN UNIVERSITY
Medication error cases still often occur, even though the intention is to cure but instead, it gets even worse, especially for the elderly and disabled, they often suffer because of this problem. In this regard, PT. Pharos Indonesia as a leading manufacturer in health care technology in South-East Asia would develop a smart system in the form of a pillbox that can help to monitor patients during their medication consumption. Their vision is not impossible, reminded that technological progress has been rapid at this time. Automation and IoT becomes a standout solution of this matter, by applying RDBMS to a machine, it can store a large-scale data and manage it, by applying RFID system to a machine, it can identify every object that has an RFID tag on it, and by applying a microcontroller to a machine, it can handle every task given according to its written program. Therefore the combination of these elements will result in a smart system that is ready to use and is believed to cut-off the medication error cases.
Keywords: Medication error, pillbox, Automation, IoT, RDBMS, RFID, microcontroller, smart system
Alvin Tri Hartono
© Copyright 2020 by Alvin Tri Hartono
All rights reserved
Alvin Tri Hartono DEDICATION
For the elderlies, people with disabilities, and the future of the health care field in my beloved country: Indonesia.
Alvin Tri Hartono ACKNOWLEDGEMENTS
First and foremost, I would like to praise God, for His endless blessing and kindness towards me, because of His divine protection, I was avoided from the coronavirus which was a pandemic during this thesis work, even though I often leave the house to do the thesis in the office.
Secondly, I would like to give appreciation to whom makes this thesis possible;
For him who never ran out of ideas during the development of this thesis and also very encouraging especially if my progress was praised, Mr. Leonard P. Rusli, B.Sc., M.Sc, Ph.D., as my thesis advisor in Swiss German University.
For him who wasn’t talk much but every one of his advice is valuable and meaningful, Mr. Rudijanto, S.Kom., as my thesis advisor in PT. Pharos Indonesia.
For them who willing to take overtime to help me with my thesis, my mentors and colleagues, Ivan Kurnia, Ko Steven, Ko Micahel, Ko Chris, Adit, Pak Pram, Mas Reynaldi, and people in the Pharos workshop, you guys are the real hero. Also not forget to mention, Gabrielle Glenda Yauwira my snack supplier.
For Pak Marjuky and Pak Andre Lembong as the user of this thesis project, who gave me the opportunity to do this and have a little industry experience.
For my family, especially my mother for her endless moral support.
Last but not least, I want to thank all of my lecturers and friends from Mechatronics batch 2016 for the roller coaster rides of the university life in Swiss German University, I can’t contain all of your names in this paper because the page will be over soon, but keep in mind, your names will always be contained in my heart.
I hope that my thesis work will be useful.
Alvin Tri Hartono TABLE OF CONTENTS
Page
STATEMENT BY THE AUTHOR ... 2
ABSTRACT ... 3
DEDICATION ... 5
ACKNOWLEDGEMENTS ... 6
TABLE OF CONTENTS ... 7
CHAPTER 1 - INTRODUCTION ... 14
1.1 Background ... 14
1.2 Thesis Objectives ... 15
1.3 Thesis Problems ... 16
1.4 Significance of Thesis... 16
1.5 Hypothesis ... 16
1.6 Thesis Structure ... 17
CHAPTER 2 - LITERATURE REVIEW ... 19
2.1 Medicine Reminder and Monitoring System for Secure Health Using IoT ... 19
2.2 Google Patents Review ... 21
3.3.1. US6294999B1 – Systems and Methods for Monitoring Patient Compliance with Medication Regimens ... 21
3.3.2. US5480062A – Vacuum Operated Medicine Dispenser ... 23
2.3 Instructable Article Review ... 27
2.3.1. DailyDose: Smart Pill Dispenser ... 27
2.3.2. IDC2018IOT IoPill Box ... 30
2.3.3. Smart Pill Box (IDC2018IOT) ... 33
2.4 Previous Pharos’ Smart Pillbox... 36
2.5 ESP32 ... 39
2.6 Radio Frequency Identification (RFID) ... 42
2.7 RESTful API ... 43
2.8 Software Used ... 43
2.8.1. PlatformIO Ecosystem and IDE ... 44
2.8.2. MySQL and SQLyog ... 44
2.8.3. ArduinoJson ... 45
CHAPTER 3 – RESEARCH METHODS ... 46
3.1 Component Selection ... 46
3.1.1. Stepper Motor with A4998 Driver ... 46
3.1.2. Micro Servo Motor SG90 ... 48
3.1.3. Optical Limit Switch ... 49
Alvin Tri Hartono
3.1.5. Micro SD Card Module ... 51
3.1.6. RTC DS1307 ... 52
3.1.7. Laser Module and Photoresistor Sensor ... 52
3.1.8. Momentary Push Button with LED ... 53
3.2 Design Justification ... 54
3.2.1. Cartridge System ... 55
3.2.2. Carousel Mechanism ... 57
3.2.3. Dispensing Actuator – Push-out Mechanism ... 59
3.2.4. MFRC522 RFID Module and Limit Switch Bracket ... 61
3.2.5. Slide for Medication Output Funnel ... 63
3.2.6. Upper Base Plate ... 64
3.2.7. Stepper Motor Transmission ... 66
3.3 Electrical Section ... 71
3.3.1. Wiring Diagram ... 71
3.3.2. Power Supply ... 72
3.4 Program ... 73
3.4.1. Void Setup ... 74
3.4.2. Medication Recognition ... 75
3.4.3. Data Parsing... 75
3.4.4. Void Loop... 77
3.5 Testing Method ... 78
3.5.1. Medication Dispensing Accuracy Test ... 78
CHAPTER 4 – RESULTS AND DISCUSSIONS ... 79
4.1 System Overview ... 79
4.2 System Demonstration ... 81
4.3 Medication Dispensing Accuracy Test ... 92
4.3.1. Medication Dispensing Accuracy Test – Repeatability ... 92
4.3.2. Medication Dispensing Accuracy Test – Variations in the Type and Size of the Medication ... 97
4.4 Troubleshooting... 103
CHAPTER 5 – CONCLUSIONS AND RECCOMENDATIONS ... 106
5.1 Conclusions ... 106
5.2 Recommendations ... 106
GLOSSARY ... 108
REFERENCES ... 109
CURRICULUM VITAE ... 111
APPENDIX ... 111
Alvin Tri Hartono LIST OF FIGURES
Figures Page
Figure 2.1 Medicine Reminder Working Flowchart ... 20
Figure 2.2 Smart Tray for Monitoring Patient ... 21
Figure 2.3 System Communication Network Topology ... 22
Figure 2.4 Medication Recognition Flowchart Diagram ... 23
Figure 2.5 Device Top View ... 24
Figure 2.6 Device Side View ... 25
Figure 2.7 Rotating Carousel Mechanism ... 25
Figure 2.8 Cartridge Mechanism ... 26
Figure 2.9 DailyDose Smart Pill Dispenser ... 27
Figure 2.10 System Database Relationship Table Diagram ... 28
Figure 2.11 Daily Dose Device Design ... 29
Figure 2.12 Device Appearance ... 29
Figure 2.13 Medication Dispensing Actuator ... 30
Figure 2.14 IDC2018IOT IoPill Box ... 31
Figure 2.15 IFTTT Configuration ... 31
Figure 2.16 IFTTT Simple Conditional Program ... 32
Figure 2.17 Additional IFTTT Temperature Program ... 33
Figure 2.18 Array of Medication Schedule ... 34
Figure 2.19 System’s Software Node-RED Program ... 35
Figure 2.20 PT. Pharos Indonesia Smart Pillbox First Prototype Left: Front view, right: Side view ... 36
Figure 2.212.21 Pill Bank ... 37
Figure 2.22 ESP32 Development Board ... 39
Figure 2.23 ESP32 Function Block Diagram ... 40
Figure 2.24 ESP32 Development Board Pinout Diagram ... 41
Figure 2.25 RFID system ... 42
Figure 2.26 Architectural of REST ... 43
Figure 2.27 PlatformIO Ecosystem and IDE Logo ... 44
Figure 2.28 MySQL Logo ... 44
Alvin Tri Hartono
Figure 2.30 ArduinoJson Logo... 45
Figure 3.1 Stepper Motor and A4988 Stepper Driver ... 46
Figure 3.2 Micro Servo Motor SG90 ... 48
Figure 3.3 Optical Limit Switch ... 49
Figure 3.4 MFRC522 RFID Reader/Writer Module ... 50
Figure 3.5 RFID Tag Sticker ... 50
Figure 3.6 Micro SD Card Module ... 51
Figure 3.7 RTC DS1307 ... 52
Figure 3.8 Laser Module and Photoresistor Sensor... 52
Figure 3.9 Momentary Push Button with LED ... 53
Figure 3.10 Smart Pillbox Final Assembly Design in Isometric View ... 54
Figure 3.11 Smart Pillbox Final Assembly Design Left: Front View, Right: Side View ... 54
Figure 3.12 Medication Cartridge Left: Isometric Front View, Right: Isometric Back View ... 55
Figure 3.13 Inner Cartridge Left: Pill with 6-7 mm Diameter Sized, Middle: Pill with 12-13 mm Diameter Sized, Right: Capsule with 23 mm Length ... 56
Figure 3.14 Inserting the Inner Cartridge into the Outer Cartridge ... 57
Figure 3.15 Carousel Base Left: Isometric View, Right: Top View ... 57
Figure 3.16 Inserting the Medication Cartridge into the Carousel Base ... 58
Figure 3.17 Dispensing Actuator – Push-out Mechanism Left: Isometric View, Right: Rack and Pinion Mechanic Inside the Actuator ... 59
Figure 3.18 Dispensing Actuator in Initial Position ... 60
Figure 3.19 Dispensing Actuator in Fully Extended Position... 60
Figure 3.20 MFRC522 RFID Module and Optical Limit Switch Bracket ... 61
Figure 3.21 Installed MFRC522 RFID Module and Optical Limit Switch Bracket ... 62
Figure 3.22 Homing Point Marker ... 62
Figure 3.23 Slide for Medication Output Funnel ... 63
Figure 3.24 Upper Base Plate Left: Top View, Right: Isometric View ... 64
Figure 3.25 Igus iglide® G300, Sleeve Bearing with Flange ... 64
Figure 3.26 Installation of the Upper Base plate in the System ... 65
Alvin Tri Hartono
Figure 3.27 Stepper Motor Transmission ... 66
Figure 3.28 GT2 Timing Pulley 20T and 60T ... 66
Figure 3.29 Closed-loop GT2 Timing Belt ... 67
Figure 3.30 KFL08 Pillow Block Flange Bearing ... 67
Figure 3.31 Contacted Sleeve of the Plain Bearing ... 68
Figure 3.32 Belt Length Calculation Diagram ... 70
Figure 3.33 Wiring Diagram of the Smart Pillbox ... 71
Figure 3.34 Power Supply of 12 Volt DC 3 Ampere ... 72
Figure 3.35 LM2596 DC-DC Step-Down Converter ... 72
Figure 3.36 PlatformIO Ecosystem and IDE Workspace ... 73
Figure 3.37 Void Setup Program Work Flow ... 74
Figure 3.38 Medication Recognition Program Work Flow ... 75
Figure 3.39 Medication Information File in CSV ... 75
Figure 3.40 Data Parsing Program ... 76
Figure 3.41 Void Loop Program Work Flow ... 77
Figure 4.1 Actual image of the Smart Pillbox ... 80
Figure 4.2 User Information Table ... 81
Figure 4.3 Medication Information Table ... 81
Figure 4.4 Schedule and Dosage Table ... 82
Figure 4.5 Custodiol 5 mg Tablets ... 82
Figure 4.6 Stored Custodiol in the Cartridge ... 83
Figure 4.7 Cartridge Installation to the Carousel Base ... 84
Figure 4.8 Initialization Process – Connecting to Wi-Fi ... 85
Figure 4.9 RGB Led ... 85
Figure 4.10 JSON Package ... 86
Figure 4.11 Initialization Process – Medication Recognition Feature ... 87
Figure 4.12 Medication Information Email ... 88
Figure 4.13 Notification Email ... 88
Figure 4.14 Reminder Email ... 89
Figure 4.15 Blue Luminous Pushbutton ... 89
Figure 4.16 Actual Image of Working Laser Interrupt Sensor ... 90
Figure 4.17 Dispensed Custodiol ... 90
Alvin Tri Hartono Figure 4.19 PCB of the Smart Pillbox ... 103 Figure 4.20 Optocoupler Schematic Diagram ... 104 Figure 4.21 Laser Interrupt Sensor with Optocoupler ... 105
Alvin Tri Hartono LIST OF TABLES
Table Page
Nema 17 Stepper Motor 17HS4401 42BYGH Datasheet ... 47 Medication Dispensing Accuracy Test – Repeatability Result ... 93 Sample Medication List ... 97 Medication Dispensing Accuracy Test – Variations in the Type and Size of the
Medication Result ... 102