• No results found

Development of an Identification System for Modules used in Medical Environments

N/A
N/A
Protected

Academic year: 2021

Share "Development of an Identification System for Modules used in Medical Environments"

Copied!
78
0
0

Loading.... (view fulltext now)

Full text

(1)LiU-ITN-TEK-A--11/016--SE. Development of an Identification System for Modules used in Medical Environments Joakim Lindh 2011-04-15. Department of Science and Technology Linköping University SE-601 74 Norrköping , Sw eden. Institutionen för teknik och naturvetenskap Linköpings universitet 601 74 Norrköping.

(2) LiU-ITN-TEK-A--11/016--SE. Development of an Identification System for Modules used in Medical Environments Examensarbete utfört i elektroteknik vid Tekniska högskolan vid Linköpings universitet. Joakim Lindh Examinator Magnus Karlsson Norrköping 2011-04-15.

(3) Upphovsrätt Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extraordinära omständigheter uppstår. Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ Copyright The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/. © Joakim Lindh.

(4) Abstract The objective of this thesis work is to find a suitable automatic identification solution for a medical system that utilizes several types of attachments. The solution should be cost efficient and sustainable enough to endure the medical environment. The thesis work was performed for Sectra Mamea AB in Link¨oping, Sweden. Five suitable solutions where evaluated on a theoretical basis and the feasibility of three of them were also experimentally verified on a more practical level. The experiments where performed on a Xilinx Virtex-5 FPGA platform with solution specific prototype boards, which were custom designed during the thesis work. The software development was made in several environments, where programming languages C, C# and VHDL were used. It was found that a solution based on 1-Wire technology was the most cost efficient and best-suited among the candidates. This was proven by validation of the technology and a thorough comparison to the other feasible solutions. This thesis presents the theory and practical results of the research. It is meant to serve as a comprehensive foundation supporting the decisions of future development..

(5) To Myself For all the hard work I have put into my education May this document serve as a reminder and testimony of what I have learned and will carry with me into the future..

(6) Acknowledgements I Would like to thank Sectra Mamea AB and Magnus Wallblom for providing me with an opportunity to experience Sectra as an employee while gaining knowledge in a wide range of technologies. I would also like to thank my supervisor Pedro Botella and examiner Magnus Karlsson, for all the support and feedback during my thesis work. Thanks to Henrik Bohlin for his extensive programming skills which inspired me to dive into C-Sharp programming. Finally, I would like to thank my beloved Kajsa Eriksson for the tremendous support throughout the work..

(7) Acronyms AM - Attachment Module ASK - Amplitude Shift Keying CE - Conformit´e Europ´eenne CMOS - Complementary Metal Oxide Semiconductor DFN - Dual Flat No leads DCLK - Data Clock EMI - Electromagnetic Interference EMC - Electromagnetic Compatibility EPC - Electronic Product Code ESD - ElectroStatic Discharge FCC - Federal Communications Commission FIFO - First In, First Out FPGA - Field Programmable Gate Array FSK - Frequency Shift Keying GPIO - General Purpose Input Output HF - High Frequency HBLK - Horizontal Blanking ID - Identification IDC - Identification Container IDR - Identification Reader IS - Identification System ISO - International Organization for Standardization ISM - Industrial Scientific and Medical LED - Light Emitting Diode LF - Low Frequency LSB - Least Significant Bit MBP - MicroBlaze Processor MS - Medical System MW - Microwave NMOS - N type Metal Oxide Semiconductor OEM - Original Equipment Manufacturer PSK - Phase Shift Keying QR - Quick Response RFID - Radio Frequency ID SCS - Stand Control System SFN - Single-sided, Flat, No Lead SMD - Surface Mount Device SoC - System on a Chip UART - Universal Asynchronous Receiver/Transmitter UHF - Ultra High Frequency VBLK - Vertical Blanking VHDL - VHSIC Hardware Description Language VHSIC - Very High Speed Integrated Circuit TIN - Type Identification Number XEP - Xilinx Evaluation Platform i.

(8) Contents 1 Introduction 1.1 Background . 1.2 Purpose . . . 1.3 Specification . 1.4 Disposition .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. 1 1 1 1 2. 2 Theory and Background 2.1 Sectra Medical System . . . . . . . . . . . 2.2 Identification System Design . . . . . . . . 2.3 Hardware Environment . . . . . . . . . . 2.3.1 Xilinx Evaluation Platform . . . . 2.4 Software Environments . . . . . . . . . . . 2.4.1 Xilinx ISE Design Suite 12.3 . . . 2.4.2 Altium Designer Summer 09 . . . 2.4.3 Microsoft Visual C# 2010 Express 2.5 Solutions . . . . . . . . . . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. 3 3 3 4 4 6 6 6 6 6. 3 1-Wire 3.1 Theory . . . . . . . . . . . . . . . . 3.1.1 Three-State Logic . . . . . 3.1.2 Parasitic Power Supply . . 3.1.3 Protocol Timing . . . . . . 3.2 System Design . . . . . . . . . . . 3.3 Implementation . . . . . . . . . . . 3.3.1 Hardware . . . . . . . . . . 3.3.2 Software . . . . . . . . . . . 3.4 Evaluation . . . . . . . . . . . . . . 3.4.1 Read ID Data . . . . . . . . 3.4.2 Write and Read to Memory 3.5 Discussion . . . . . . . . . . . . . . 3.5.1 Usability . . . . . . . . . . 3.5.2 TIN Storage . . . . . . . . 3.5.3 Market and Cost . . . . . . 3.5.4 Sustainability . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. 8 8 9 9 9 10 10 10 11 12 13 13 14 14 14 14 15. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. ii. . . . .. . . . .. . . . . . . . . . . . . . . . .. . . . .. . . . . . . . . . . . . . . . .. . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . ..

(9) iii. 3.5.5. Software Design. . . . . . . . . . . . . . . . . . . . . . . . . .. 4 Color Code 4.1 Theory . . . . . . . . . . . . . . 4.2 System Design . . . . . . . . . 4.3 Implementation . . . . . . . . . 4.3.1 Hardware . . . . . . . . 4.3.2 Software . . . . . . . . . 4.4 Evaluation . . . . . . . . . . . . 4.4.1 Single Color Sensor . . . 4.4.2 Single Color Sensor with 4.5 Discussion . . . . . . . . . . . . 4.5.1 Usability . . . . . . . . 4.5.2 Sustainability . . . . . . 4.5.3 Market and cost . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlled Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5 Micro QR 5.1 Theory . . . . . . . . . . . . . . . 5.1.1 Quick Response Barcode . 5.1.2 Image Collector . . . . . . 5.2 System Design . . . . . . . . . . 5.3 Implementation . . . . . . . . . . 5.3.1 Hardware . . . . . . . . . 5.3.2 Software . . . . . . . . . . 5.4 Evaluation . . . . . . . . . . . . . 5.5 Discussion . . . . . . . . . . . . . 5.5.1 Usability . . . . . . . . . 5.5.2 Incomplete Datasheet . . 5.5.3 Software Design . . . . . 5.5.4 Market and cost . . . . . 5.5.5 Sustainability . . . . . . .. 15. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. 16 16 16 18 18 19 21 21 22 25 25 25 25. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. 26 26 26 28 29 29 31 32 35 36 37 37 37 38 38. 6 RFID 6.1 Theory . . . . . . . . . . . . . . . . . . . . 6.1.1 The Concept of Fields . . . . . . . 6.1.2 Inductive Coupling in Near-Field . 6.1.3 Backscatter Coupling in Far-Field 6.1.4 The Reader . . . . . . . . . . . . . 6.1.5 The Tag . . . . . . . . . . . . . . . 6.1.6 Coexistence and Interference . . . 6.1.7 Standards and Regulations . . . . 6.2 System Design . . . . . . . . . . . . . . . 6.3 Discussion . . . . . . . . . . . . . . . . . . 6.3.1 Usability . . . . . . . . . . . . . . 6.3.2 Durability . . . . . . . . . . . . . . 6.3.3 Market and Cost . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. 39 39 40 41 42 44 45 45 46 46 47 47 47 47. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. . . . . . . . . . . . . . ..

(10) iv. 6.3.4. Future Evaluation . . . . . . . . . . . . . . . . . . . . . . . .. 48. 7 Hall Effect 7.1 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 49 49 49 50. 8 Conclusions 8.1 Usability . . . . . 8.2 Sustainability . . 8.3 Cost . . . . . . . 8.4 Recommendation. 51 51 52 52 52. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. . . . .. Appendices. 56. A 1-Wire Protocol Timing. 56. B Camera Register Settings. 58. C Calculations. 59. D Pictures and Schematics. 61. E RFID Components. 64.

(11) List of Tables 1.1. Solution Specification . . . . . . . . . . . . . . . . . . . . . . . . . .. 1. 2.1. Solutions Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 7. 4.1 4.2 4.3 4.4 4.5 4.6 4.7. Color Color Color Color Color Color Color. . . . . . . .. 17 19 22 23 24 24 24. 5.1 5.2 5.3. Micro QR, Symbol version with Character Modes Samples . . . . . . Micro QR, Camera Resolutions . . . . . . . . . . . . . . . . . . . . . Micro QR, Measured Power Supply Voltages . . . . . . . . . . . . .. 27 31 32. 6.1 6.2 6.3. RFID, Common Frequency Bands . . . . . . . . . . . . . . . . . . . RFID, UHF Frequency Variations . . . . . . . . . . . . . . . . . . . . RFID, Band Regulations . . . . . . . . . . . . . . . . . . . . . . . . .. 40 44 46. 8.1. Solutions Comparison . . . . . . . . . . . . . . . . . . . . . . . . . .. 51. B.1 Micro QR, Camera Register Settings . . . . . . . . . . . . . . . . . .. 58. E.1 RFID, Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.2 RFID, Label Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 65 65. Code, Code, Code, Code, Code, Code, Code,. TIN Quantity Matrix . . . . . . . . . . . . . . . . . . Illuminance by one LED . . . . . . . . . . . . . . . . . Experiment with Sensor Data . . . . . . . . . . . . . . Experiment with Weighted Sensor Data . . . . . . . . Experiment with Reference Calibration . . . . . . . . Experiment with Relative Calibration, White Cylinder Experiment with Relative Calibration, Black Cylinder. v.

(12) List of Figures 2.1 2.2. Identification System . . . . . . . . . . . . . . . . . . . . . . . . . . . XEP System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10. 1-Wire, Package Examples of Slave Devices . 1-Wire, Parasitic Mode . . . . . . . . . . . . . 1-Wire, Protocol Phases . . . . . . . . . . . . 1-Wire, System Design . . . . . . . . . . . . . 1-Wire, Evaluation Setup . . . . . . . . . . . 1-Wire, Software Overview . . . . . . . . . . 1-Wire, State Diagram VHDL Block . . . . . 1-Wire Read ID Data, Terminal Output . . . 1-Wire, Write/Read TIN Operation . . . . . 1-Wire, Result of Write/Read TIN Operation. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. 4 5. . . . . . . . . . .. 8 9 10 10 11 11 12 13 13 14. Color Code, RBG Model . . . . . . . . . . . . . . . . . . . . . . . . . Color Code, System Design with (a) IDR and (b) IDC . . . . . . . . Color Code, Evaluation Setup . . . . . . . . . . . . . . . . . . . . . . Color Code, Sensor S9706 (a) Color Spectrum and (b) Exposure Time for High Range [9] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Color Code, Breakout Board Design . . . . . . . . . . . . . . . . . . 4.6 Color Code, Software Overview . . . . . . . . . . . . . . . . . . . . . 4.7 Color Code, State Diagram VHDL Block . . . . . . . . . . . . . . . 4.8 Color Code, ColorCodeManager . . . . . . . . . . . . . . . . . . . . . 4.9 Color Code, Initial Experiment . . . . . . . . . . . . . . . . . . . . . 4.10 Color Code, Experiment in Controlled Environment . . . . . . . . .. 17 17 18 19 20 20 20 21 22 23. 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9. 27 30 30 30 31 33 33 34 34. 4.1 4.2 4.3 4.4. QR QR QR QR QR QR QR QR QR. Code, Code, Code, Code, Code, Code, Code, Code, Code,. Data Distribution . . . . . . . . . Evaluation Setup . . . . . . . . . Symbology Examples (a) M1 and Feasible Read Distances for M1 . Data Output Timing Chart . . . Breakout Board Design . . . . . Software Overview . . . . . . . . State Diagram VHDL Block . . . Flow Chart C Block . . . . . . .. vi. . . . . (b) . . . . . . . . . . . .. . . . . . . M2 . . . . . . . . . . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . ..

(13) vii. 5.10 5.11 5.12 5.13 5.14. QR QR QR QR QR. Code, Code, Code, Code, Code,. 6.1 6.2 6.3 6.4 6.5 6.6 6.7. RFID, RFID, RFID, RFID, RFID, RFID, RFID,. 7.1. CameraManager . . . . . . . . . . . . . M1 with Different Read Ranges (a)-(d) M1 with Threshold Levels (a)-(d) . . . . M2 with Different Read Ranges (a)-(d) M2 Threshold levels (a)-(d) . . . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. 35 36 36 36 37. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. 39 40 41 42 43 47 48. Hall Effect, System Design . . . . . . . . . . . . . . . . . . . . . . . .. 49. A.1 1-Wire, Read Timing Diagram . . . . . . . . . . . . . . . . . . . . . A.2 1-Wire, Write Timing Diagram . . . . . . . . . . . . . . . . . . . . .. 56 57. C.1 Camera Range System, Mathematical Model . . . . . . . . . . . . .. 59. D.1 Footage of Assembled Printed Circuit Boards (a) Micro QR and (b) Color Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 61. System Behavior . . . . Wave Propagation . . . Near-Field and Far-Field Inductive Coupling . . . Backscatter Coupling . . System Design . . . . . HF Tag AD-770 . . . . .. . . . . . . . . . . . . . . Illustrated . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . ..

(14) Chapter 1. Introduction 1.1. Background. Sectra Mamea AB is a successful company in the medical business and they are behind a world leading medical system available for use worldwide. They are now evaluating a type of attachment to a system of theirs that supports multiple variants. They want this attachment to be automatically identified.. 1.2. Purpose. The purpose is to evaluate a set of feasible solutions for the automatic identification and evaluate them in terms of usability, sustainability and cost. The best-suited solution is presented to Sectra Mamea AB for further evaluation and implementation.. 1.3. Specification. The goal is to design and evaluate a sustainable automatic identification system for the Medical System based on the requirements seen in Table 1.1.. 1 2 3 4 5 6. Table 1.1: Solution Specification Allow simple and robust installation Ensure data integrity Allow a minimum of 32 unique IDs Read unit ID on demand Be a sustainable solution in terms of durability Maintain low cost per unit. 1.

(15) 2. 1.4. Disposition. The thesis is divided into chapters and the first two includes the introduction followed by some fundamental theory and background. Chapter three to seven presents possible solutions and the final chapter concludes the thesis work and present the best-suited solution. Complementary information such as schematics and calculations can be found in the Appendix section..

(16) Chapter 2. Theory and Background This chapter presents the theory and background needed to understand the development environment and the peripherals used during the thesis work.. 2.1. Sectra Medical System. The Medical System (MS) from Sectra is essentially a machine with several possible Attachment Modules (AM) used for different purposes. The AM is mounted mechanically with metal arms onto a wagon, which is movable vertically. Within the MS there is a Stand Control System (SCS) which is the main electronics for the system. The life expectancy of the system is 12 years in which the AMs could theoretically be changed several times per day, so the solution must handle a high amount of identifications.. 2.2. Identification System Design. The Identification System (IS) consists of two parts, the Identification Container (IDC) mounted on the AM and the Identification Reader (IDR) mounted on or within the MS, see Figure 2.1. The IDC contains a Type Identification Number (TIN) which represents a specific AM type. For some solutions this TIN is a unique serial number from the manufacturer of the specific IDC. The IDC is attached to the metal arms which is most esthetical because the IS is then hidden within the MS. Almost all the solutions require a movable cabling due to the IDR being mounted to the wagon, but that problem is handled by the mechanical department of Sectra Mamea AB. The area of the AMs metal arm, where the IDC is placed, is approximately 2x4 cm. The distance between the IDR and the IDC should be minimal, around 1-2 cm, for the IS to fit.. 3.

(17) 4. IDR. IDC. TIN. Wagon Metal Arm. Medical System. Attachment Module Figure 2.1: Identification System. 2.3. Hardware Environment. The environment to evaluate the solutions in consist of • Personal Computer (PC), HP ProBook 6450b running Windows 7 • LeCroy Waverunner 104MXi Oscilloscope • Xilinx Evaluation Platform ML505 (XEP) The PC is used as a central development platform and data handler during the evaluation cycles. The XEP is used to interface the feasible solutions to an evaluation environment. The oscilloscope is used to verify communication and electrical characteristics of the solutions.. 2.3.1. Xilinx Evaluation Platform. The XEP is an evaluation platform from Xilinx with a Virtex-5 LX50T Field Programmable Gate Array (FPGA). The XEP includes a lot of useful hardware peripherals such as serial communication to PC, LEDs and buttons. The XEP also provides General Purpose Input Output (GPIO) ports which are used to interface the IDRs. Figure 2.2 shows the setup and an overview of the XEP. GPIO The XEP is interfaced to external devices by 32 single-ended expansion I/O connectors and 16 pair differential expansion I/O connectors. There are also ground, 2.5/3.3/5 V power and other specials. All I/O pins have matched track length for high accuracy applications and can be used with 2.5 V or 3.3 V signaling [1]. FPGA The FPGA is essentially an integrated circuit built up with programmable logic components which can be configured by the designer based on the use. The logic blocks of the FPGA contain a set of options to enable, such as logic gates and memory elements. These logic blocks can be executed in parallel making the FPGA very fast and efficient. The FPGA is excellent for evaluation experiments because.

(18) 5. XEP MBP. VHDL. RS232. UART. Button. Input. Solution Design. PLB Bus. Solution Design. IO I2C. Oscilloscope GPIO. PC. FPGA Intellectual Property. Softcore. IDR. IDC Peripherals. Figure 2.2: XEP System it is reprogrammable, although it is rather expensive so there is a trade-off. The FPGA hardware description is witten in VHSIC Hardware Description Language (VHDL). UART The XEP uses Universal Asynchronous Receiver/Transmitter (UART) to communicate with the PC. UART is the hardware controller that translates data between parallel and serial forms, with shift registers. On XEP, UART is used with the Recommended Standard 232 (RS232) which is a standard that provides a serial binary interface for communication between two devices. [1]. I2 C I2 C bus is a two wire protocol with two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock (SCL). I2 C uses 7-bit address space and supports up to 112 nodes communicating on the same bus where master and slave instantiations exists for all nodes [2]. The lines are easily ported to the GPIO pins for external communication. Microprocessor The Xilinx FPGA includes an 32-bit MicroBlaze Processor (MBP), which is a softcore option with a RISC Harvard architecture. The MBP can be configured with internal memory of maximum 64 Kb and is programmable with C code. The MBP is configured with a user defined amount of general purpose registers, each with the size of 32-bit..

(19) 6. 2.4. Software Environments. The development is made with several software environments used for programming and hardware design. The programming languages used are C, C-sharp (C#) and VHDL which all have their own individual programming environment.. 2.4.1. Xilinx ISE Design Suite 12.3. The Xilinx ISE Design Suite is an environment to handle FPGA configuration and programming. The design suite provides peripheral design, microprocessor and bus configurations along with reliable simulations. The ISE Design Suite includes several useful control components, called Intellectual Property (IP), such as I2 C and UART. The Embedded Development Kit (EDK) is a development package where the MBP is configured and generated. The hardware specification including the MBP is built and synthesized through Xilinx Platform Studio (XPS). The hardware specification also includes the embedded components such as I/O peripheral and memory controllers. The bitstream is the behavioral description of the FPGA and the process of generating it is also one of the main functions in XPS. With the bitstream generated, the MBP code is written in the Software Development Kit (SDK). The design process of all these steps is controlled and performed from the ISE Project Manager.. 2.4.2. Altium Designer Summer 09. Altium Designer is a complete development environment for embedded systems but is primarily used for Printed Circuit Board (PCB) design. The software environment includes design steps from schematic level to Gerber. Gerber is a common format used for manufacturing the PCBs.. 2.4.3. Microsoft Visual C# 2010 Express. In Microsoft Visual C# 2010 Express, a windows application is easily made. The environment provides a simple and intuitive design process, suited for short development cycles. There are many libraries and functions to utilize, such as serial communication protocol and background worker. The background worker is a useful component that performs a specific task on a separate thread from the one the user interface is running on. This implies that time-consuming operations like polling a serial port can be done asynchronously.. 2.5. Solutions. The solutions presented in this report are the most promising from the different considered scientific fields. The theoretical approach for each solution varies and technical depth depends on the associated technologies. Only some of them are subject to experimental evaluation, see Table 2.1. The solutions are presented with a theoretical overview followed by a system design section. For the solutions.

(20) 7. with an experimental approach there are two additional sections; implementation and evaluation. The implementation section presents the setup of the experiments with hardware and software design and the evaluation section presents experiments performed with the technology. Each solution chapter ends with a discussion about the respective technology. Table 2.1: Solutions Solution Approach 1-Wire Experimental Color Code Experimental Micro QR Experimental RFID Theoretical Hall Effect Theoretical. Overview Technology Electromechanics Optics Optics Electromagnetics Magnetics.

(21) Chapter 3. 1-Wire 3.1. Theory. 1-Wire is a bus signaling system with the support of bidirectional communication over a single wire. It was originally designed by Dallas Semiconductor, currently owned by Maxim. The serial interface operates between a single master and multiple slaves in half-duplex. As Maxim is the owner of the 1-Wire technology, they offer several practical solutions using the technology. For every manufactured 1-wire device there is a factory-programmed 64-bit unique ID number that cannot be altered. The ID number consists of an 8-bit family code, 48-bit serial number and 8-bit Cyclic Redundancy Check (CRC), for error detection. There are several types of 1-Wire slave devices, from simple identification-only devices to advanced control devices with temperature measurement and memories, although identification is always provided. The slave devices comes in various packaging such as standard TO-92, SO-8, TSOC-6 but also Single-sided, Flat, No Lead (SFN). SFN is a special 2-contact square package suited for non-electronic peripheral environment. iButton is another type of component package which is a family of sustainable 1-Wire slave products, used primarily for tough environments. They are enclosed in stainless steel cans to assure long durability and high portability. Figure 3.1 shows the package types SFN and iButton [3].. 6.0 mm. 6.0 mm. GND. 17.4 mm. 0.9 mm. 17.4 mm. Data. 5.9 mm. GND. Data. F5 Size. SFN. iButton. Data GND F3 Size. Figure 3.1: 1-Wire, Package Examples of Slave Devices. 8. 3.1 mm.

(22) 9. 3.1.1. Three-State Logic. The master and slave device communicates with three-state logic on a high-impedance bus, using open-drain ports. A three-state logic has three states; high, low and Hi-Z, where the Hi-Z state allows the master and slave to release the signal to idle. The signal is then pulled high with a pull-up resistor. The open-drain ports also enable the pull-up resistor voltage to be independent of the chip power supply. Standard communication speed is 15.4 kbps but for time critical applications there is also an overdrive speed of 125 kbps.. 3.1.2. Parasitic Power Supply. To use 1-Wire effectively the slave is powered by a parasitic mode where the power is feed from the master through the data wire. The falling edge of the master triggers a monostable multivibrator in the slave which will during a short period become unstable. The period length depends on the intrinsic components and is described as the slave timer, which is used by the slave to sample the data line. The slave uses an 800 pF capacitor to store power as shown in Figure 3.2. The capacitor is charged when data is received and discharged at transmission. During the parasitic mode the master cannot speak to other slaves, which is no drawback since only one slave at the time will be of interest [3]. For some slave devices with memory there is usually a built-in battery to power the memory cells, hence the bigger size F5. VPU. Master Device. Slave Device. RX. VDD. uC. 800pF. TX Open Drain. RX. TX Open Drain. Interface Control Device Function Unique ID. GND. Figure 3.2: 1-Wire, Parasitic Mode. 3.1.3. Protocol Timing. The protocol has three phases and always begins with the master initiating line reset, which the slave device answers to during the device presence. If a device is present, the next phase is Device Selection, where the master identifies the slave device by obtaining the ID. The last phase is the Device Function where devicespecific operations are exercised, such as read memory. The protocol phases are shown in Figure 3.3. The three phases are performed for every task to be executed and are rerolled in rounds. Further detailed information is found in Appendix A..

(23) 10. Device Presence. Voltage. Master Reset. Device Select. 8bit Rom Command. Master. Device Function. ID. Slave. 8bit Function Command. R/W Data. Time. Pull-Up Resistor. Figure 3.3: 1-Wire, Protocol Phases. 3.2. System Design. The idea is to use a Maxim 1-Wire slave device with memory as the IDC and a probe with an interface from a control system as the IDR, see Figure 3.4. The TIN is stored in the memory, which is either a read-only or read/write memory.. Wagon IDR. IDC. Probe. Metal Arm. Medical System. Attachment Module Figure 3.4: 1-Wire, System Design. 3.3. Implementation. With the XEP and a designed test circuit connected to the oscilloscope the behavior of the protocol is analyzed as illustrated in Figure 3.5.. 3.3.1. Hardware. The iButton and SFN package slave devices are used for the evaluation. Slave Devices iButton slave device DS1993 is a 4 kbit read/write nonvolatile memory with a 256 bit scratchpad to ensure integrity of the data transfers. The scratchpad is a high-speed internal memory and operates as a buffer when data is written to the memory. Initially the data is written to the scratchpad where it can be read back. After.

(24) 11. IDR. XEP Terminal. source.c. Oscilloscope IDC. GPIO. RS232. IO. owprotocol.vhd. Probe. Figure 3.5: 1-Wire, Evaluation Setup the data has been verified, the data is copied from scratchpad to the permanent memory [4]. 1-Wire SFN slave device DS2431 is a 1 kbit EEPROM chip with a 64 bit scratchpad that is used similar to DS1993 [5]. The slave devices operate at supply voltages from 2.8 V to 5.25 V. Interface Circuit Because of the simple interface, 1-Wire is evaluated with only a small circuit connected to the XEP. The small circuit consists of a GND and data line, which is connected to 3.3 V through a Pull-Up resistor.. 3.3.2. Software. The software is designed to perform a set of commands if a 1-Wire slave device is present, such as read ID and write to memory. Figure 3.6 shows the communication between the different software blocks and also what type of information that is exchanged.. Terminal. Data Valid UART Status. MBP source.c. 32bit Data 32bit Data. Status Data 0 Data 1 TIN. VHDL owinterface.vhd. 1-Wire. 1-Wire Slave. Figure 3.6: 1-Wire, Software Overview. VHDL Block Four registers are defined in the VHDL block; one status register, two data registers and a TIN register. The status register is used to set a data valid flag and the data registers are used to buffer data from a 1-Wire slave device. The TIN register is implemented but not used. Instead the TIN is defined in the VHDL block during the evaluation. The VHDL block follows the 1-Wire protocol with a state machine.

(25) 12. and initializes a master reset each 100 ms, see Figure 3.7. If an 1-Wire slave device is present, the code follows Rom and Function commands pre-defined in the Work state. First round it is always Read Rom and Skip Function, to obtain the ID of the slave device. When the ID of the device is obtained and parsed, the CRC is calculated. If the CRC is valid and the family name is supported, the remaining rounds are performed. The remaining rounds are slave device specific, such as write to scratchpad for example, where commands Skip Rom and Write To Scratchpad Function are executed. When all the predefined commands are performed, the ID data is put in the data registers and a data valid flag is set. The code is designed for DS1993 and DS2431 and is not generic to all 1-Wire devices. The difference between function sets for other 1-Wire devices are however minimal.. Timer 100ms. Idle. Work Reset Bus Error Function Command. RX. Rom Command. TX. Figure 3.7: 1-Wire, State Diagram VHDL Block. C Block The MBP is programmed to read the status register to check for valid data. If data valid flag is set, the ID data is read from the data registers and forwarded through UART to a Terminal.. 3.4. Evaluation. Two ways to utilize 1-Wire are evaluated, first a simple read ID test followed by a memory write and read test..

(26) 13. 3.4.1. Read ID Data. The first test is to read the ID data and obtain the family code and the unique serial number from the two 1-Wire slave devices. The family codes for the two IDC candidates are obtained as hexadecimal 06 and 2D as seen in Figure 3.8. These family codes are verified as DS1993 and DS2431 family codes which is exactly the components that are used. The remaining numbers are the unique IDs that can be used to pair and identify an AM type.. Figure 3.8: 1-Wire Read ID Data, Terminal Output. 3.4.2. Write and Read to Memory. The second test is to run five commands to the DS1993 to evaluate the usability process. Firstly the Read Rom command is executed to identify the family and the unique serial number, secondly the TIN is written to the scratchpad with the Write to Scratchpad command. When the Read Scratchpad command returns the correct TIN, the Copy Scratchpad command is executed and the write to memory process is finished. Finally the TIN is read from the memory with a Read Memory command to ensure and verify that the read process was executed correctly. The communication sequence on the bus is saved through the oscilloscope and plotted as a logic representation of the signal, see Figure 3.9. The TIN is written as the number 56005, which is the decimal number for DEAD16 , seen in Figure 3.10.. Figure 3.9: 1-Wire, Write/Read TIN Operation.

(27) 14. Figure 3.10: 1-Wire, Result of Write/Read TIN Operation. 3.5. Discussion. The evaluation shows that the system design of 1-Wire is feasible and reliable, because the ID and TIN is obtained instantly1 without ever being corrupt or wrong.. 3.5.1. Usability. Depending on the slave device chosen, iButton or SFN, the possible placement varies. For iButton the side of the metal arm is the place because of the larger size. SFN is so small that it could be placed in any direction, even towards the MS. The probe is easily wired to some available and suitable pin within the SCS or an additional simple microcontroller to handle the protocol. The maximum length of the wire to maintain a reliable communication link is far longer than needed in the MS.. 3.5.2. TIN Storage. There are two different ways of storing the information that pairs a TIN to a specific AM type. The first alternative is to use read-only 1-Wire slave devices as IDCs. The TIN is represented by the factory-programmed unique ID number stored in the slave device and is manually registered in the corresponding IDR the first time. The other alternative is to use 1-Wire slave devices with a memory as IDCs, such as the ones evaluated, in which the TINs are programmed. The latter alternative enables an opportunity to save production information such as batch number, time, place and other information for tracking.. 3.5.3. Market and Cost. There is a plethora of components from Maxim and the supply of 1-Wire products from Maxim is not expected be any lower in the future. The products are used worldwide and more companies adopt the technology for simple interfaces. The 1 Less. than 25 ms.

(28) 15 cost of purchase2 varies, but for memory slave devices it is around $0.60 for a SFN and $2 for iButton. The cost of designing and introducing a durable probe could be costly, but one that is not durable enough could be even more costly.. 3.5.4. Sustainability. When the ID of the slave devices is read, the CRC is calculated and the data is trustworthy. For read and write operations, the scratchpad buffer ensures error detection. So the solution is sustainable in terms of data integrity. The metal can surrounding iButton protects the electronics from harsh environments but for SFN it is most interesting to test durability further. The probe is essentially the critical part in terms of sustainability, where dirt on the surface could cause connection failure and the probe will be greatly affected by friction for every contact. AMs will be changed several times a day and the probe will therefore be subject to a rather tough environment. The design of the probe is a mechanical matter and need to be evaluated separately. It is however fully feasible to design a sustainable probe [6].. 3.5.5. Software Design. The VHDL block should be made generic to all 1-Wire devices suitable for the solution. This is done simply by using a lookup table consisting of family code and corresponing function sets. The TIN should be set from a PC application where the read/write process also is managed.. 2 Q1. 2011.

(29) Chapter 4. Color Code 4.1. Theory. There are several types of color sensors on the market which can identify illuminance of red, green and blue (RGB) colors. Illuminance is a measure in lux (lx) which describes the luminous flux on a surface. Typical value outdoors with full daylight is 10000 lx and indoors it is between 100-1500 lx [7]. The luminous flux can be interpreted as light intensity which is based on a wavelength, interpreted as visible color. The visible color spectrum is a subset of the electromagnetic spectrum and does not contain any definite boundaries between the colors. There are however approximations of the boundaries, called color models. One of them is the CIE1931 model, which was the first model of color space. The model is used in terms of defining certain colors to their wavelengths. For this thesis it is more suitable to use a simplified model, the RGB color model [8].. 4.2. System Design. A label with a square color pattern is used as IDC, where each color corresponds to a part of the TIN. A set of color sensors operating as one IDR detects the colors and in that way interprets and identifies the complete TIN. The optimal use is to define the IS into boxes. A box is defined as a color sensor together with a Light Emitting Diode (LED) facing a colored surface which has a fixed set of different colors. By expanding to several boxes, the number of possible unique TINs increases. To ensure many TINs there are two alternatives, either many boxes and less colors or a greater variety of colors with less boxes. The quantity of TINs can be calculated by raising the number of colors to the power of boxes quantity, see Table 4.1. To get a good spread of the colors, the main colors used in the boxes are red, green and blue. The RGB model, seen in Figure 4.1, gives that the extended colors preferably are yellow, magenta or cyan [8]. If four data boxes are used with a set of three colors each; red, green and blue, it means that 81 possible TINs are available. With two extra boxes, error detection. 16.

(30) 17. Blue Magenta. Cyan. White. Green. Black. d. Re. Yellow. Figure 4.1: Color Code, RBG Model Table 4.1: Color Code, TIN Quantity Matrix Unique Colors 1 2 3 4 5 2 4 9 16 25 3 8 27 64 125 Boxes 4 16 81 256 625 5 32 243 1024 3125 6 64 729 4096 15625. and presence feature are introduced. The error detection is enabled with a set of two colors used as a parity bit and the presence feature is used by the IDR to detect that an IDC is present. The presence box can also be used as a reference for calibration. So six boxes are sufficient for a reliable IS system that meets the TIN requirements. With the boxes arranged in two rows with three sensors a row, the size is optimal for the label to be placed on the AM’s metal arm. Four sensors are used as data collector, whilst the other two are parity and presence, see Figure 4.2.. 12mm 8mm. Data. Parity. Data. Data. Presence. Data. 19mm. 40mm. (a). (b). Figure 4.2: Color Code, System Design with (a) IDR and (b) IDC.

(31) 18. 4.3. Implementation. To evaluate the IS candidate, one box is used. The setup is then theoretically extended to multiple boxes to fulfill the TIN requirements. The evaluation setup is illustrated in Figure 4.3, where single colored surfaces are also exemplified.. XEP. ColorCode Manager. IDR IO. source.c. GPIO. RS232. ccprotocol.vhd. IDC IDCIDC IDC IDC IDC. S9706. Figure 4.3: Color Code, Evaluation Setup. 4.3.1. Hardware. A color sensor assembled on a breakout board is the main hardware design. Color Sensor The S9706 color sensor from Hamamatsu is a 3.3 V operating a CMOS monolithic photo integrated circuit with the possibility of simultaneously measuring RGB colors. The color sensor is controlled by three signals; Clock, Range and Gate. The color sensor is set for high or low sensitivity (Range) for each measurement with an exposure time (Gate) between 10 us to 100 s. The exposure time depends on the illuminance from the surroundings, see Figure 4.4(b). The measurement is represented by a 36-bit digital serial output, which is clocked immediately after Range and Gate has been set. The color sensor consists of a 9x9 matrix with elements sensitive to red, green and blue. The elements are also sensitive to some adjacent colors in the color spectrum, see Figure 4.4(a). For example, the blue element is also sensitive to violet and green. The green element is more relatively sensitive than blue and red and reacts also on blue, red and yellow colors. The red element detects yellow as well. So, for example, if red and green data are relatively larger than blue, a yellow color could be present [9]. Breakout Board The prototype is a breakout board for two color sensors and a light circuit, designed in Altium Designer, seen in Figure 4.5. The light circuit is designed for two types of LEDs, Surface Mount Device (SMD) 0805 and axial 5mm, depending on the illuminance needed. The SMD LEDs are smaller and cheaper but not as strongly.

(32) 19. (a). (b). Figure 4.4: Color Code, Sensor S9706 (a) Color Spectrum and (b) Exposure Time for High Range [9] Table 4.2: Color Code, Illuminance by one LED Name Type Ityp [mcd] Apex angle [◦ ] L5-W601-STBC Axial 5mm 14000 22 17-21/W1D-P2R1/TR8 SMD 0805 150 22. Emax [lx] 1122300 12025. illuminating as axial LEDs. The maximum expected illuminance (Emax ) from a LED exposed to the colored surface is approximated by Equation (4.1),  2πItyp 1 − cos α2 Emax = (4.1) A , where Ityp is lumen, α is apex angle and the active area of the sensor is A=1.2mm2 [9], see Table 4.2. The light circuit is controlled externally by the XEP through a N-type Metal Oxide Semiconductor (NMOS) transistor used as a switch. For small distances between the colored surface and the color sensor, one SMD LED is sufficient. The color sensors do not need any external circuitry but a decoupling capacitor is added parallel to the power supply pin of the component to ensure noise tolerance [10]. Standard headers are used to attach and interface the breakout board to the XEP. The schematic and a photograph of the assembled board are found in Appendix D.. 4.3.2. Software. The software initiates proper settings for color sensor, collects data and provides an evaluation environment. The communication between the software blocks and the data flow are seen in Figure 4.6..

(33) 20. Axial LED SMD LED Interface Headers. S9796. NMOS. Figure 4.5: Color Code, Breakout Board Design ColorCode Manager. 128bit Color Data Package. UART. MBP source.c. Range and Gate 30bit Color Data +2bit OF. Control Data. VHDL ccprotocol.vhd. Settings 32bit Color Data. Color Sensor. Figure 4.6: Color Code, Software Overview VHDL Block The VHDL block interfaces the color sensor to the XEP. Two registers are utilized in the VHDL block, one control register and one data register. The control register contain the exposure time and sensitivity settings, which is read during the Idle state, for each measurement cycle. After the range and gate settings are executed, the 36-bit serial data is collected, as the state diagram shows in Figure 4.7. The data is parsed and 10 bits for each color element is put in a 32-bit data register together with overflow bits. These overflow bits are a result of a simple OR operation between the unused bits of the color data and indicate if data is lost.. Idle. Set Range. Set Gate. Collect. Figure 4.7: Color Code, State Diagram VHDL Block. C Block Initiation data is written to the control register and the color data is then read from the data register. If the overflow bits indicate lost data, the data is thrown..

(34) 21. Otherwise, the data is forwarded through a serial link to the PC packaged as the RGB R3 R2 R1 R0 G3 G2 G1 G0 B3 B2 B1 B0 sequence, where each color representation is a value between 0-1024. This process is performed continuously from start-up to power-down. C# Application ColorCodeManager is a Windows application written in Microsoft Visual C# to collect and evaluate sensor output data, see Figure 4.8. The program opens a serial communication port and collects color data. The data can be modified with multiplying weights for calibration of the color data. The default value on the weights passes the data unchanged.. Figure 4.8: Color Code, ColorCodeManager. 4.4 4.4.1. Evaluation Single Color Sensor. The color sensor is initially evaluated with a set of red, green and blue colors printed on labels, simply to understand the behavior of the component, see Figure 4.9. There is a weak and a strong color hue representation of each color. The label is held 2 cm from the sensor with the specific color and the sensor is set to high range with a 10 ms exposure time, which corresponds to a sensitivity of approximately 2.5-9000 lx, see Figure 4.4(b), which is sufficient for indoor environments. The color.

(35) 22. IDR. S9706. IDC Figure 4.9: Color Code, Initial Experiment Table 4.3: Color Code, Experiment with Sensor Data Label Red Data Green Data Blue Data Red 167.0 17.0 15.0 Light Green 91.0 188.0 52.0 Blue 79.0 142.0 78.0 Red 38.0 4.0 3.0 Strong Green 15.0 36.0 10.0 Blue 14.0 27.0 17.0. representation is based on the level of illuminance and is therefore relatively low in the initial measurements where no external light is applied to the color labels. The measurements presented in Table 4.3 shows that the color sensor cannot be used directly to identify a specific color because the RGB color representation is not relatively equal to each other. For example, two blue colored labels with different hue will result in blue data, where the stronger hue is represented by a lower value, which is true. However, compared to the green and red data, these values are too low to represent a dominant blue color. For all these measurements, red and green data will dominate with higher values even if it is the blue colored label that is present. If comparing the results of the blue data for different colored labels it is obvious that the blue data is more dominant for a blue colored surface. In order to use the sensor as the IDR, the software must handle not only decision of what color is dominant but which is present. The individual RGB color values for each color needs calibration and by introducing relative weights this problem is solved, See Table 4.4. The relative weights are set manually but the equilibrium is different depending on the surrounding light.. 4.4.2. Single Color Sensor with Controlled Light. The sensor is very sensitive to surrounding environmental light, such as lamps or sunshine, and experiments are therefore performed in a light isolated environment. By encapsulating a color sensor with a LED in a cylinder, calibration is carried out independently of the ambient light and measurements become more accurate..

(36) 23. Table 4.4: Color Code, Experiment with Weighted Sensor Data Label Red Data Green Data Blue Data Weight: 0.4 Weight: 0.4 Weight: 1 Red 66.8 6.8 15.0 Light Green 36.4 75.2 52.0 Blue 31.6 56.8 78.0 Red 15.2 1.6 3.0 Strong Green 6.0 14.4 10.0 Blue 5.6 10.8 17.0. IDR. LED S9706. IDC Figure 4.10: Color Code, Experiment in Controlled Environment Five cylinders are used with various depths from 1-5 cm and has an inner diameter of 11 mm, see Fig4.10. The cylinders are initially white on the inside to preserve illuminance. For each measurement, the color data is first calibrated with weights to a white reference label, which represents the presence surface. This calibration process can easily be made automatic because calibration to a chromatic color such as white means that the red, green and blue data is represented by the same value. With the exposure time set to 3 ms at high sensitivity, which is the maximum exposure time to ensure no overflow, the sensor measures RGB colors with illuminance of 7-13000 lx. Table 4.5 shows that the red color is dominant for larger distances and the experiment is approached with several methods to reduce the dominance. The white calibration label may not be a pure mix of all colors and therefore several gray calibration labels are tested as well, with similar results. The automatic calibration is abandoned and the calibration is made manually as in the previous experiment with the uncontrolled light environment. The manual calibration is done for lower distances but for higher distances it is impossible to find an equilibrium, shown in Table 4.6. The white cylinder is changed to black and a higher exposure time of 30 ms is used, because of the absorbing nature of darker colors. This results in higher, but still limited, allowed distances seen in Table 4.7..

(37) 24. Table 4.5: Color Code, Experiment with Reference Calibration Dominant Color According to Sensor Distance [cm] True/False Red Label Green Label Blue Label 1 Red Green Blue T 2 Red Green Blue T 3 Red Green (Red) F 4 Red (Red) (Red) F 5 Red (Red) (Red) F. Table 4.6: Color Code, Experiment with Relative Calibration, White Cylinder Distance Weights Dominant Color According to Sensor True/ [cm] [RGB] Red Label Green Label Blue Label False 1 1.00 0.96 0.85 Red Green Blue T 2 1.00 0.90 0.71 Red Green Blue T 3 N/A N/A N/A N/A F. Table 4.7: Color Code, Experiment with Relative Calibration, Black Cylinder Distance Weights Dominant Color According to Sensor True/ [cm] [RGB] Red Label Green Label Blue Label False 1 1.00 0.96 0.85 Red Green Blue T 2 0.98 1.00 0.90 Red Green Blue T 3 0.97 1.00 0.87 Red Green Blue T 4 0.97 1.00 0.87 Red Green Blue T 5 N/A N/A N/A N/A F.

(38) 25. 4.5. Discussion. The evaluation shows that Color Code is a feasible solution for short isolated distances only with a minor change in the system design.. 4.5.1. Usability. Because of the uncertainties with the automatic calibration it is more suitable to skip the presence box, which would act as a calibration surface, and use an additional data box instead. With five data boxes and the set of colors reduced to two, the quantity of 32 TINs are still sufficient. The color sensors are encapsulated within black delimiters together with SMD LEDs, as described in the system design section as the IDR, and operate with a distance of less than 4cm from the IDC.. 4.5.2. Sustainability. The solution must be calibrated for the usage environment which must be isolated from ambient light. There are no records of how the color sensor’s behavior changes over time and how this affects the possible IS. The colored surfaces could change hue over time and thus become unrecognizable.. 4.5.3. Market and cost. There are several manufacturers which provide color sensors with various sensitivities and interfaces and the price of purchase1 begin at $20 [11]. With six color sensors and breakout board with components the cost is easily over $120. The manual calibration also means a high cost due to the single treatment for every unit.. 1 Q1. 2011.

(39) Chapter 5. Micro QR 5.1. Theory. Barcode is a commonly used technology for storing information and originally it was made up by vertical dark bars with various widths on a white background. These bars corresponded to 1s and 0s depending on the widths and they could therefore easily be read and interpreted. Barcodes are used everywhere which indicates that the technology is working and it implies that there are a lot of resources on the market. Two dimensional (2D) barcodes are a more common type nowadays where data is stored both vertically and horizontally, in so called modules.. 5.1.1. Quick Response Barcode. Quick Response (QR) is a 2D barcode symbology, consisting of square modules in a square matrix pattern. The module dimension is user defined to ensure support of varying production techniques. Unique finder patterns are found in three corners to enable location of the position, size and inclination [12]. As a Complement to the QR code there is a simplified version, Micro QR, that is smaller to both size and capacity. The Micro QR contains a simplified version of the position detection pattern, with only one unique finder pattern. The QR symbology is an open standard and the patent right owned by Denso Wave is not exercised at the moment [13]. There are four symbol versions of Micro QR, specified in Table 5.1. The symbol version to use depends on the requirements of data capacity and error correction level whilst the module’s physical size is chosen based on the printer and scanner resolution. The error correction levels are L, M and Q which corresponds to that 7 %, 15 % and 25 % of data1 can be restored. Some of the character modes that Micro QR support, see Table 5.1, are the numeric mode with three data characters per 10 bits, alpha numeric mode with two characters per 11 bit and Byte mode with 8 bit characters. The QR code may contain mixed combination of these, but that is a rather complex matter. Figure 5.1 shows the data distribution of a Micro QR symbol of type M1. 1 8bit. codewords.. 26.

(40) 27. Table 5.1: Micro QR, Symbol version with Character Modes Samples Symbol Number of Error Numeric Alpha Byte Version Modules Correction (0-9) Numeric M1 11 5 L 10 6 M2 13 M 8 5 L 24 14 9 M3 15 M 18 11 7 L 35 21 15 M4 17 M 30 18 13 Q 21 13 9. The pattern is made up of black and white squares called modules. These modules are arranged as a position detection pattern, timing pattern, format pattern and data pattern, as seen in Figure 5.1. There is also a securing margin around the symbol which is two modules wide for Micro QR.. Position Detection Pattern Timing Pattern Margin Format information Data. Figure 5.1: QR Code, Data Distribution. Encoding Procedure To create an authentic QR code symbol, the encoding procedure must be followed. The encoding procedure is initiated with a data analysis, to identify which character mode to use, see Table 5.1. Usually the smallest version, sufficient for a specified data amount including error detection and correction level, is selected. The data characters are then converted into a bit stream which is split into 8 bit codewords. Padding characters are then added to fill the remaining codewords required for the version. The codeword sequence is divided into blocks for error correction coding.

(41) 28 algorithms2 to process. The error correction codewords are interleaved with the codeword sequence to generate the codeword modules, which is the final message. Together with the position detection pattern the data is masked to find the optimized dark/light module balance. Finally the format and version information is added to the format pattern [12]. Decoding Procedure The decoding procedure is initiated by obtaining a digital image of the symbol. By recognizing the dark and light modules as an array of 0s and 1s, the position detection pattern is found. The position detection pattern is the ratio of 1:1:3:1:13 in any direction and gives the position, size and inclination of the QR Code. When the position detection pattern is known, some image processing fixates the modules and data can be parsed. The format information is read followed by the version information. When the version of the symbol is known, the masking can be released and the symbol characters can be read according to the format and version data. Error correction codewords are read as well and then used for error detection of the data received. Finally, the data characters are decoded in accordance to the mode in use [12].. 5.1.2. Image Collector. To decode a Micro QR symbol there must be a digital image source to interpret. Essentially there are two technologies to capture an image digitally. Charge Coupled Device (CCD) and Complementary Metal Oxide Semiconductor (CMOS) image sensors, where the latter one is most often used for these purposes. Typical characteristics of CMOS are low power consumption and high noise tolerance [14]. The CCD and CMOS are implemented differently but the choice of which one to use is more based on vendor and price rather than technology. Add a lens and an interface circuitry and it is defined as a camera. The resolution of the camera is a very important property for symbology interpretation, because enough details must be distinguished in order to identify all data. Also, the macro is interesting when designing a close-footage environment. Objects too close to the camera lens results in rather blurry images, but that can be processed with sharpening algorithms or threshold filters. There are different color modes for cameras, such as RBG and YUV. RGB565 Color Model RGB565 is a color model using 16 bits data for each pixel. The bits corresponds to 5 red, 6 green and 5 blue bits, which is a result of a Bayer filter pattern used on the sensor. The Bayer filter is the arrangement of four colors detectors per square where each color has a detector and the green has an extra to gain more illuminance. 2 Reed-Solomon 3 Black,. error correction. white, black, black, black, white and black..

(42) 29. The green detector is more luminance-sensitive whilst the red and blue are more chrominance-sensitive [8]. YUV422 Color Model The YUV is a color model used for pipelining color images and its digital term is usually YCbCr. YUV422 uses 8 bit components of Yn ,Un ,Vn and Yn+1 where Y is the luminance component. U and V are the chrominance components. This means that for each macro pixel of 32 bits only 2 pixels are completely defined. For grayscale the brightness is only interesting, which is the luminance component Y [8].. 5.2. System Design. The system design is based on using a camera together with the XEP as the IDR and a printed M1 Symbol as the IDC, see Figure 5.3. The metal arm with 2 cm height gives that the label size should not be any bigger than that, nor to small so that the camera resolution is sufficient. It is important that there are enough pixels per module on the IDC for a given read distance. The pixel density (ρpixel ) per module for each pixel line can be calculated by Equation (5.1), ρpixel =. min(Psensor ) dlabel 2D tan α + dsensor M. (5.1). where dlabel is the diagonal size of the IDC, dsensor is the CMOS sensor diagonal size, α is the apex angle, Psensor is the resolution of the sensor, D is the read distance and M is the number of modules used in the QR code. See Appendix C for the mathematical derivation. The ρpixel should fulfill a criteria similar to the Nyquist criteria, twice pixels per module for each pixel line. But to have fully reliable data there should be four or more sensor pixels per module for each pixel line, which means 16 sensor pixels per module. With the need of only 35 unique TINs it is sufficient with symbology type M1, with the storage of five numerical values. One value is used as a control number and the others represents the TIN numbers 0 to 9999.. 5.3. Implementation. The evaluation setup based on the system design is illustrated in Figure 5.2. For the implementation, a CMOS camera from Toshiba is used with resolutions up to 1280x1024 and an apex angle of 42.4◦ . For the experiments, the two smallest Micro QR symbologies are used, which are generated online [15], see Figure 5.3. The printed Micro QR Symbol M1 contains the numerical value 90001 and M2 contain the alpha numeric string T1. M1 do not support alpha numerical character so M2 is useful when text should be stored as well. The labels are due to the size of the AM’s metal arm specified to be smaller than 2x2 cm so a symbology with the.

(43) 30. Button. IDR. IDC. TCM8240MD. IO. source.c. GPIO. XEP camera interface.vhd RS232. Camera Manager. Figure 5.2: QR Code, Evaluation Setup. (a). (b). Figure 5.3: QR Code, Symbology Examples (a) M1 and (b) M2 physical size 1.9x1.9 cm is used. It is suitable to use as high resolution as possible although a higher resolution means more data. In Figure 5.4 the read range for some different resolutions based on Equation 5.1 are plotted. For a grayscale image with the resolution 640x480 (VGA), the image is 2458 kb uncompressed and the available memory in the FPGA is 2160 kb [16] so either an external memory is used or a compression of the data is made. The figure also shows that a resolution of 320x240 (QVGA) is sufficient as well, in terms of pixel density. For QVGA the grayscale image is 614 kb uncompressed which is small enough to be buffered within the FPGA, which simplifies the evaluation.. Figure 5.4: QR Code, Feasible Read Distances for M1.

(44) 31. Table 5.2: Micro QR, Camera Resolutions Type Resolution [HxV] SXGA 1280x1024 4VGA 1028x960 VGA 640x480 QVGA 320x240 QQVGA 160x120 CIF 352x288 QCIF 176x144 subQCIF 128x96. 5.3.1. Hardware. Camera The CMOS color image sensor TCM8240MD from Toshiba is a 1.3 Mega-pixel camera with a signal processor. The optical format is 1/3.3 inch which refers to the diagonal size of the imaging area. The output data can be formatted as JPEG, RGB565 or YUV422, in a variety of resolutions presented in Table 5.2. For this application either RGB565 or YUV422 mode is preferred. The solution does not need any color information, so either the RGB data is compressed to 8bit using only the gray components or the chromatic component Y of YUV is used. The latter is the simplest solution and therefore implemented. The initiation is made through an I2 C bus, where proper camera registers are set, see Appendix B. After the initiation, the image frames are continuously feed as multiplexed 8 bit parallel data along with data clock (DCLK), vertical blanking (VBLK) and horizontal blanking (HBLK). A positive flank on the VBLK signal indicates that there is a new frame and a positive flank on the HBLK signal indicate that a new pixel line can be read. For every positive flank on the DCLK, where both VBLK and HBLK are high, there are eight bits of data on the data out pins, see Figure 5.5. The DCLK is approximately a quarter of the camera clock, which operates at 6-20 MHz.. VBLK HBLK Data Time. Figure 5.5: QR Code, Data Output Timing Chart.

(45) 32. Table 5.3: Micro QR, Measured Power Supply Voltages Name Ideal [V] Tolerance [V] Recommended [V] Measured [V] DVDD 1.6 ±0.1 1.5-1.7 1.6242 IOVDD 2.5 ±0.2 2.3-2.7 2.6685 PVDD 2.8 ±0.2 2.6-3.0 2.6690. Breakout Board The breakout board is designed to interface the camera to the XEP together with a flash circuit. The flash circuit is the same used for the Color Code breakout board but it uses four LEDs instead. The datasheet of the camera specifies that the ideal power supply (PVDD) and the signal input/output voltage (IOVDD) should be either 2.5 V or 2.8 V, although the recommended voltage levels for PVDD and IOVDD separates those ideal levels, see Table 5.3, and the fact that the PVDD and IOVDD are short circuited within the camera does not make any clarifications of the ideal voltage levels. Because the XEP supports signal levels of either 2.5 V or 3.3 V, a trade-off is made and a 2.6 V power level is used, which the XEP tolerates. The digital voltage supply (DVDD) should be 1.6 V. To achieve these different voltage supplies, 2.6 V and 1.6 V, two Low-Dropout Regulators are used. The power requirement is at least 100 mA for the camera and some extra for the flash circuit, so a Texas Instruments TPS76701QD voltage regulator of 1 A is sufficient. The voltage regulator operates with an input voltage of 5 V and the output voltage is decided by calculating values on two resistors in a small tuning circuit, see Equation 5.2, where Vref =1.1834 V.   RtoV CCOU T Vout = Vref 1 + (5.2) RtoGN D The breakout board is designed in Altium Designer, see Figure 5.6. The footprint of the camera is custom made whilst the others are generated through the builtin footprint wizard. Some decoupling capacitors are added to reduce the transient noise from the power supply [10]. Standard headers are used to attach and interface the breakout board to the XEP. The power measurements for the final design are seen in Table 5.3. The clock used for the camera is generated with software in the FPGA. The schematic and a photograph of the assembled board are found in Appendix D.. 5.3.2. Software. The software initiates the camera, collects data and provides an image processing application. The camera is initiated via I2 C protocol from the MBP on start up. The system then waits for a request (button on XEP) to start collecting image data from the camera. Because of the slow serial link to the PC, and the relative fast parallel link to the camera, the VHDL block uses a 1Mbit First in, First Out (FIFO) component to buffer a frame. The frame is transferred to the PC in a speed of 128.

(46) 33. LDO. TCM8240MD. Interface Headers. Axial LED. SMD LED. NMOS. Figure 5.6: QR Code, Breakout Board Design kbit/s and therefore the transmission of a frame takes 4.8 s which is far more than the transmission time from the camera to the VHDL block of 33 ms at 30 fps. The data flow and a communication overview are seen in Figure 5.7.. Button Camera Manager. MBP source.c. Request Handler 614Kbit Data. UART. Initiation Function. I2C Peripheral Control. Camera. FE, SR Control. FIFO. Status 32bit Data. Request. Data. Status. VHDL Camerainterface.vhd. Data Control. 8bit parallel data. Figure 5.7: QR Code, Software Overview. VHDL Block The camera clock is generated in the VHDL block, at a speed of 16.67 MHz. Three registers are utilized in the VHDL block; one request register with a request flag, one data register for pixel data and a status register with several status flags. The main status flags used are for fifo empty and flash request. The other status flags are used for debug. The VHDL block uses a state machine to control the operations, see Figure 5.8. When a request is triggered, the state is changed from Idle to Wait For New Frame and the code wait until a new frame is available. When a positive flank of the VBLK signal is triggered, the state is changed to Frame RX, and the data is obtained in parallel and stored in a FIFO. The output of the FIFO is connected to the data register and as soon as data has been read from the register, new is added. During the Frame RX state, only every other 8 bit data received is saved because of the YUV model, where only the Y component is interesting..

(47) 34. Idle. Frame RX/TX. Wait For New Frame. Figure 5.8: QR Code, State Diagram VHDL Block C Block The C block handles the camera initiation, external request and image forwarding as the flow chart shows in Figure 5.9. On startup, the initiation function is executed and the register settings are written to the camera. When the button on the XEP is pushed, the request flag in the request register is set. As long as the FIFO is not empty, the code will continue to read data from the data register. When the FIFO has been empty for a specific amount of time, the frame is regarded as fully received and the status register is read and forwarded as well. The status register is used for error control to see if the frame is corrupt. Start Camera. Initiate Camera No. External Request?. Send Status Register to UART. Yes Set Request Flag Timeout Cnt FIFO Empty?. No. Yes. No Timout?. Yes. Read Data Register. Send Data to UART. Figure 5.9: QR Code, Flow Chart C Block.

(48) 35. C# Application The CameraManager is an application designed to fetch a frame from the serial port and provide some basic image processing tools for evaluation, see Figure 5.10. The tools provided are threshold, sharpening and sobel edge detection. The sobel edge detection is based on a double 9x9 kernel filtering using an open-source convolution algorithm. These kernels can be custom defined for other kind of filtering as well.. Figure 5.10: QR Code, CameraManager. 5.4. Evaluation. The evaluation of the QR Code is more of an evaluation of the camera and is performed by analyzing images taken on a QR Symbol from different read ranges. Figure 5.11 and Figure 5.13 shows pictures taken from different distances. They are cropped in order to compare the pixel density. The threshold filter cleans the symbology for further analyze. The threshold level is determined by first isolating the symbol and finding the mean value of the pixels. The mean value sets the.

(49) 36. threshold level for the symbology, see Figure 5.12 and Figure 5.14. When the threshold is applied, the finder pattern is located by detecting the 1:1:3:1:1 sequence and the decoding procedure is initiated.. (a) D = 5 cm. (b) D = 10 cm. (c) D = 15 cm. (d) D = 20 cm. Figure 5.11: QR Code, M1 with Different Read Ranges (a)-(d). (a) T = 35 %. (b) T = 50 %. (c) T = 50 %. (d) T = 50 %. Figure 5.12: QR Code, M1 with Threshold Levels (a)-(d). (a) D = 5 cm. (b) D = 10 cm. (c) D = 15 cm. (d) D = 20 cm. Figure 5.13: QR Code, M2 with Different Read Ranges (a)-(d). 5.5. Discussion. The evaluation did not reach the point of decoding the symbology because the evaluation was concentrated on the capability of the camera and the conclusions were drawn based on image analysis..

(50) 37. (a) T = 35 %. (b) T = 50 %. (c) T = 50 %. (d) T = 50 %. Figure 5.14: QR Code, M2 Threshold levels (a)-(d). 5.5.1. Usability. The evaluation shows that a camera of a QVGA resolution is good enough and can be used reliably for distances from 5-20 cm, utilizing M1 or M2 symbology. This implies that the Nyqvist criteria do not have to be satesfied in order to obtain reliable data. The reliable range of up to 20 cm also opens oppertunities to other system designs where the camera is mounted from other angles or longer distances to the symbol. Equation 5.1 can be used for future calculations regarding read ranges for cameras. The pixel density corresponds to the calculations in Figure 5.4 although with sophisticated image processing algorithms the feasible read ranges can be improved. What is not taken into account in the calculations is the focus, which worsens the image quality closer to the camera. However, this can be digitally processed by functions like sharpen and threshold. For really small distances, less than 5 cm, the camera is not capable of capturing 1.9x1.9 cm Micro QR symbologies, because the symbol becomes bigger than the imaging area. For labels with an even smaller physical size, the images are too blurry to be able to analyze data, or even find the symbol. This can be solved with a macro lens but that would increase the cost a lot.. 5.5.2. Incomplete Datasheet. To maintain a low development cost and an efficient workflow it is very important to possess necessary information of how the camera works. The datasheet for the camera is incomplete in many ways. How the initiation registers should be set are not completely provided and the formulas for calculating some values are wrong as well. By trying different register settings, see Appendix B, images are eventually obtained.. 5.5.3. Software Design. There are open-source libraries to encode and decode QR code, but not for Micro QR. The similarities are however so many that the existing libraries could be modified to support Micro QR..

(51) 38. 5.5.4. Market and cost. This solution is cheap regarding the IDC but can be quite expensive depending on the requirements of the camera. It could possibly be difficult to find a reliable source on a standard camera module that is cheap enough with a sufficient product life cycle. One safe solution for this problem is to use a camera module with standard serial interface, which could easily be replaced if necessary. That however would cost more. The camera used for the evaluation is a low-cost camera, probably mass produced for a mobile phone manufacturer that where dead on arrival because of the vast expanding technology. Many of these cameras can be purchased from $7 [17], the availability and quality should however be questioned. The Micro QR Symbols can easily be generated online and printed with a simple label printer.. 5.5.5. Sustainability. The disadvantages for this solution are smudge on the lens or scratches on the label. Error correction is not available for symbol type M1, but for M2 up to approximately 25% data can be restored..

(52) Chapter 6. RFID 6.1. Theory. Radio Frequency Identification (RFID) is at the moment one of the biggest research topics regarding automatic identification, replacing traditional technologies such as barcodes. The technology uses electromagnetic waves for wireless communication between two devices, a transceiver and a transponder. More commonly these devices are called reader and tag [18]. The reader sends a request signal to the tag, which answers with the same, but modulated, signal. RFID can operate on several. Energy + Request. Reader. Tag Data. Figure 6.1: RFID, System Behavior frequencies depending on the application and the desired functionality, but most often globally available standardized frequency bands are used, see Table 6.1. These frequencies are operated by different technical solutions with different performances and parameter trade-offs. The RF noise and other environmental parameters are seen as input when choosing frequency band which in turn affects the reading distance. Some of the frequency bands are included in the Industrial, Scientific and Medical (ISM) bands. The ISM bands are specified for purposes other than communication, because of the possible electromagnetic interference that ISM equipment can cause. Such equipment could be microwave ovens or medical machines [18].. 39.

References

Related documents

Part of R&D project “Infrastructure in 3D” in cooperation between Innovation Norway, Trafikverket and

This article hypothesizes that such schemes’ suppress- ing effect on corruption incentives is questionable in highly corrupt settings because the absence of noncorrupt

The evidences to be sought in the case study that will test if the hypothesis and proposition can be rejected or not, is what kind of waste the mining operations seek to

We were able to conclude that sending data in larger packets will reduce the overall transmission time drastically, but since most of the data sent will be small, around 7 bytes,

The benefit of using cases was that they got to discuss during the process through components that were used, starting with a traditional lecture discussion

To explore if the subjective ratings of individual SA (ISA) or the subjective ratings of individual performance (IP) differed between the two conditions (shared vision/not

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in