PC-INTERFACED GONIOMETER FOR KNEE AND ELBOW JOINT ANGULAR MEASUREMENTS USING ACCELEROMETER AND ZIGBEE TECHNOLOGY by Miguel Carlo P. Ang Anthony Joe P. Melgarejo Nikko L. Tamaña A Design Report Submitted to the School of Electrical Engineering, Electronics Engineering, and Computer Engineering in Partial Fulfillment of the Requirements for the Degree Bachelor of Science in Computer Engineering Mapua Institute of Technology September 2011 ii ACKNOWLEDGEMENT Hardships, trials, failures and obstacles, the group won‟t be able to make this design a success without the help of these persons who gave us support, advices and courage to make it to the end. Our deepest thanks to our professor, Engr. Noel B. Linsangan for giving us chances in finishing this design and to our adviser, Engr. Analyn N. Yumang for supporting and believing in us and for guiding us to take the right path. These two people have been with us in the beginning and until the end of this design. To our beloved parents, who supported us all the way financially and emotionally. They encourage us that being competitive is an asset for success. To our friends, classmates, teachers, and panels, thank you for trusting and helping us to complete all of the learning materials that we needed as we went along this the design. To the persons behind this project, thanks for the camaraderie, unity and cooperation. Thanks for the time spent and sacrificed. This experience shaped us to be better individuals. And lastly, to God Almighty, for making everything possible and for keeping us strong when we thought of giving up. Miguel Carlo P. Ang Anthony Joe P. Melgarejo Nikko L. Tamaña iii TABLE OF CONTENTS TITLE PAGE i APPROVAL SHEET ii ACKNOWLEDGEMENT iii TABLE OF CONTENTS iv LIST OF TABLES vi LIST OF FIGURES vii ABSTRACT Chapter 1: viii DESIGN BACKGROUND AND INTRODUCTION Background Statement of the Problem Objectives of the Design Impact of the Design Design Constraints Definition of Terms Chapter 2: REVIEW OF RELATED DESIGN LITERATURES AND STUDIES Chapter 3: DESIGN PROCEDURES Hardware Development Software Development Prototype Development Bill of Materials Chapter 4: TESTING, PRESENTATION, AND INTERPRETATION OF DATA Wireless Technology Using ZigBee Signal Range Test Accelerometer Output Scale Test Precision Test Output Test 1 1 3 3 4 4 5 8 16 16 21 30 33 34 34 36 42 44 iv Chapter 5: CONCLUSION AND RECOMMENDATION Conclusion Recommendation 46 46 47 REFERENCES 48 APPENDIX 49 Appendix A: Operation‟s Manual Appendix B: Pictures of Prototype Appendix C: Program Listing (in BASIC) Appendix D: Data Sheets PIC16F877A Data Sheet ADXL335 Data Sheet ZigBee Module Data Sheet MAX232 Data Sheet L1682 Hitachi LCD Data Sheet LM7805 Data Sheet SPX2815 Data Sheet Appendix E: IEEE Format Document 49 54 58 84 85 97 108 110 116 125 152 162 v LIST OF TABLES Table 3.1 Bill of Materials 33 Table 4.1 Wireless Data Transmission Proximity Test 35 Table 4.2 Distal Scaling (Positive) 37 Table 4.3 Distal Scaling (Negative) 38 Table 4.4 Proximal Scaling (Negative) 40 Table 4.5 Proximal Scaling (Positive) 41 Table 4.6 Elbow Joint Angle Precision Test 43 Table 4.7 Knee Joint Angle Precision Test 43 Table 4.8 Sent Data Output Test 45 vi List of Figures Figure 3.1 System Block Diagram of PC-Interfaced Goniometer for Knee and Elbow Angular Measurements using Accelerometer and ZigBee Technology 16 Figure 3.2 Schematic Diagram of the Transmitter with the Accelerometer, Microcontroller and Zigbee Module 18 Figure 3.3 ZigBee Module Schematic Diagram (Receiver Side) 20 Figure 3.4 Transmitter-side Program Flowchart 21 Figure 3.5 Receiver-side Program Flowchart 23 Figure 3.6 Database Schema 24 Figure 3.7 General Information - Findings Relationship 25 Figure 3.8 General Information – Past Medical History Relationship 26 Figure 3.9 Wireless Goniometer Use Case 27 Figure 3.10 Activity Diagram 28 Figure B.1 Invalid Port Number Error 52 Figure B.2 Receiver Connected to the Laptop via USB and RS232 54 Figure B.3 Accelerometers Attached to Goniometer and Transmitter Device 54 Figure B.4 Transmitter Device with Arm and Leg Straps 55 Figure B.5 Sample Picture of Whole Design 55 Figure B.6 Sample Output of Angle Reading in LCD Display 56 Figure B.7 Output Interface of the Design (Patient Information Database) 56 Figure B.8 Patient Information Database Software 57 vii ABSTRACT The main goal of the group is to design a device that addresses the drawbacks of using a common goniometer. The group presents in this documentation an alternative method for measuring human joint angles, specifically knee and elbow joint angles. The digital goniometer consists of two accelerometers, a digital signal processing element, and a wireless communication component. Accelerometers are commonly used to sense leg or arm movement for monitoring the progress of the patient during rehabilitation. Joint angles are directly calibrated using the output of the accelerometers; therefore, angles displayed is similar to the common goniometer. The angles measured are then stored into the patient information database for ease of evaluation by the rehabilitation doctor. Keyword: Goniometer, accelerometer, ZigBee technology, wireless transmission viii CHAPTER 1 DESIGN BACKGROUND AND INTRODUCTION Background Measuring the range of motion (ROM) is vital in rehabilitation medicine. Each specific joint has a normal range of motion that is expressed in degrees. Limited range of motion refers to a joint that has a reduction in its ability to move, caused by injury, operation, or diseases such as osteoarthritis, rheumatoid arthritis, or other types of arthritis. Pain, swelling, and stiffness associated with the injury, operation, and said diseases can limit the range of motion of a particular joint and impair function and the ability to perform usual daily activities. Devices used to measure the ROM of various joints in the human body are the goniometer and inclinometer. Both devices use a stationary arm, protractor, fulcrum, and movement arm to measure angle from axis of the joint. The goniometer is used by rehabilitation doctors to measure ROM as a way to monitor a patient‟s progress while undergoing physical therapy. This device aims to address the health and safety of a patient. In physical therapy and occupational therapy, a goniometer is an instrument which measures an axis and range of motion. If a patient experiences decreased range of motion in a joint (e.g a knee or elbow) caused by an operation or fracture, for example, the therapist can use a goniometer to assess what the range of motion is prior to intervention. Using the information produced by the goniometer, the 1 therapist can monitor the range of motion after every therapy session. From this range of motion, the therapist is able to plan the appropriate exercise to achieve the target joint range of motion suitable for the mobility of the patient. It focuses on measuring the ROM of the elbow and knee joints. The angle measured using the device is displayed using a desktop computer or a laptop. The use of a computer also allows an adequate recording of the data for each patient using the device, which may be later analyzed with ease, precision and readability as compared to the conventional method. It is also much smaller in size compared to the electrogoniometer since it would only be attached to the patient‟s leg or arm using straps. Due to its smaller size, it is easier for the physical therapist to set up the device, and the patient is more comfortable during the measurement process. The device consists of two dual axis accelerometers, a digital signal processing element, and a wireless communication component. The accelerometers are used to determine the angular position of the knee or elbow joint. The digital signal processing element calculates the joint angle. This information is then sent by ZigBee communication to a PC which displays the joint angle. 2 Statement of the Problem As the patient flexes, for example, his elbow, the movable arm is moved by the physician with the forearm of the patient while the stationary arm is held still. This procedure and the conventional protractor goniometer have the following disadvantages: 1) the mechanical goniometer is a bulky apparatus; 2) patients with severe joint dislocation will find the conventional procedure very painful; 3) measuring the angle while holding the protractor in position throughout the measurement is a difficult task for the examiner; 4) and holding the arm/limb in one position for the entire time of procedure is a problem for the patient too. Objectives of the Design The group aims to design a device that addresses the said drawbacks of using a common goniometer. The group also considered the following to be able to implement the device: 1. to interface ZigBee to the PC-Interfaced Goniometer; 2. to display the angular measurements of the knee or elbow with the LCD display in the device; and 3. to record the angular joint measurement in a database with the same reading displayed in the device. 3 Impact of the Design The PC-Interfaced Goniometer for Knee and Elbow Joint Angular Measurements Using Accelerometer and ZigBee Technology synchronizes with the trend of swift development of technology in the medical field. The design‟s significance directly applies to rehabilitation medicine practitioners such as rehabilitation doctors and physical therapists as it helps them to come up with a more accurate way of getting the knee and elbow angular joint measurements. Since it is wirelessly connected to a computer, it allows an adequate recording of data for each patient, which may be later analyzed with ease, precision and readability as compared to the conventional method. The PC-Interfaced Goniometer for Knee and Elbow Joint Angular Measurements Using Accelerometer and ZigBee Technology‟s major impact can be seen in the health and safety of patients specifically in the field of physical therapy and occupational therapy. With its added ease of use and functionalities, it is a better replacement of the common goniometer used by rehabilitation doctors in clinics in the Philippines, and all over the world. Design Constraints Health expenditures continue to grow very rapidly as technology plays a big part in improving the delivery of medical care. But the benefits technology brings outweigh the additional expenses as it significantly improves medical and surgical procedures (e.g. CT scanners, implantable defibrillators) and new 4 support systems (e.g. electronic medical records and transmission of information, telemedicine). The same concept applies in the group‟s design. The PC-Interfaced Goniometer will be more expensive than the common goniometer because of the materials used. Therefore, mass manufacturing of the device will be difficult as the prices of the materials remain expensive, most especially the accelerometers and ZigBee modules. Also, in the Philippines, not many hospitals have the budget for newer devices due to their budget restraints. If the economy in the Philippines does not improve, the purchasing power of the potential buyers of the device (e.g. hospitals, physical therapists) will be low. The device can only be used for measuring the angle of the knee and elbow joints as the title of the design implies due to the design by which it is manufactured. Definition of Terms 1. Goniometer – an instrument that either measures an angle or allows an object to be rotated to a precise angular precision (Encarta World English Dictionary). 2. Accelerometer – an instrument or device for measuring acceleration, especially one in which a sensor converts acceleration into an electrical signal (Encarta World English Dictionary). 5 3. Range of motion (ROM) – The range through which a joint can be moved, usually its range of flexion and extension. Due to an injury, the knee may for example lack 10 degrees of full extension (Webster‟s New World Medical Dictionary). 4. Physical medicine and rehabilitation (Rehabilitation medicine) – a branch of medicine which aims to enhance and restore functional ability and quality of life to those with physical impairments or disabilities. Practitioners of this field are called rehabilitation doctors (Webster‟s New World Medical Dictionary). 5. Physical therapy – A branch of rehabilitative health that uses specially designed exercises and equipment to help patients regain or improve their physical abilities. Physical therapists work with many types of patients, from infants born with musculoskeletal birth defects, to adults suffering from after-effects of injury, to elderly post-stroke patients (Webster‟s New World Medical Dictionary). 6. Occupational therapy – a profession concerned with promoting health and well being through occupation. The primary goal of occupational therapy is to enable people to participate in the activities of everyday life. Occupational therapists achieve this outcome by enabling people to do things that will enhance their ability to participate or by modifying the environment to better support participation. 7. Supine - lying on the back (Webster‟s New World Medical Dictionary). 6 8. Flexion - The act of flexing or bending, bending of a joint to approximate the parts it connects (Webster‟s New World Medical Dictionary). 9. Axis - A straight line joining two opposing poles of a spheric body, about which the body may revolve. (Webster‟s New World Medical Dictionary). 10. PCB – Printed Circuit Board, a rigid, flat board that holds chips and other electronic components. The board is made of layers, typically 2 - 10, that interconnect components via copper pathways (PC Magazine Encyclopedia). 11. PIC – Programmable Interrupt Controller, special purpose integrated circuit that functions as an overall manager in a interrupt driven system (Webster‟s Encyclopedia). 12. Wireless – using radio signals: using radio signals rather than wire (Encarta World English Dictionary). 13. ZigBee - A wireless network used for home, building and industrial control. It conforms to the IEEE 802.15.4 wireless standard for low data rate networks. With a maximum speed of 250 Kbps at 2.4 GHz, ZigBee is slower than Wi-Fi and Bluetooth, but is designed for low power so that batteries can last for months and years. The typical ZigBee transmission range is roughly 50 meters, but that can vary greatly depending on temperature, humidity and air quality (PC Magazine Encyclopedia). 7 Chapter 2 REVIEW OF RELATED DESIGN LITERATURES AND STUDIES This chapter includes compiled research works and studies that are related to the design. The content of this chapter are used as reference for the development of the design. The group used the following related articles, research works, and inventions as reference which will aid in having an in-depth understanding about the design that the group is working on. A related article entitled “Goniometer Based to Computer”[1] from the IEEE issued last April 5, 2004 cited a goniometer that was designed based on the computer‟s focus on the measurements of angles of the arms. The article cited that universal goniometers are commonly used during physical assessments of patients under physiotherapeutic treatments, but the measurement accuracy is influenced by its own quality and also the differences among articulations being assessed. In order to ease the specialist‟s work, a goniometer based to a computer fixed to the patient has been designed to give the angle of the arms, allowing a faster evaluation of the patient‟s progress. The angle is measured using an optical encoder and its value is properly interpreted by the PC and presented on the monitor. The use of a computer also allows an adequate recording of data which may be analyzed with ease, precision and readability compared to the conventional method. 8 The group will use their design as guide for the PC-interfacing of the group‟s design. The article discussed the procedure on how their goniometer is interfaced but the goniometer is wired into the computer on which the group‟s design aims to enhance into wireless data communication. One of the objectives of the design is to display the angular joint measurement in a PC monitor. The PC-interfacing is discussed in the first article cited while the angular joint measurements computation is based in the next article. In the article “A New Flexible Optical Fiber Goniometer for Dynamic Angular Measurements: Application to Human Joint Movement Monitoring,” development of a substitute for the common goniometers [3] and electrogoniometers are implemented. The article discussed the major drawback in using such devices including the presence of a fixed hinge that imposes a fixed center of rotation. This causes problems in measuring the bending angle in some joints like human joints which have a variable rotation center. Instead of using a fixed center of rotation, they used optical fiber, a sensor measuring the relative angle in a rotating joint. It makes use of the intensity modulation of a laser beam propagating in a single-mode optical-fiber, due to the changes of its polarization status originated by the rotation of contiguous portions of fiber, where controlled birefringence has been induced by a fixed radius fiber loop. A prototype of this sensor has been developed with a range of relative angle of 90deg with a resolution of less than 0.01deg and a standard deviation of 0.1deg. Main advantages of this innovative sensor are lightness, flexibility, high speed of 9 reaction and high accuracy. This paper describes the implemented sensor, the equipment implemented for the test, and the results of laboratory activities are reported and discussed. This article[3] will serve as the basis for the computation of the angle. Instead of using optical fibers, the group will use two accelerometers which have the same advantage as the optical fiber. How to Measure Range of Motion[5] The range of motion (ROM) of a joint is an angular measure of that joint's movement between the fully extended and fully flexed position. The measurement of a joint's ROM is a common method of assessing a joint's recovery after an injury or surgery. This procedure requires a goniometer, which may be any device that measures angles. However, the specific purpose of a medical goniometer is to measure a joint's ROM. 1) A medical goniometer consists of a central portion that joins two arms made of a stiff material. One arm is fixed with respect to the central portion, and the other arm is able to rotate freely about the central portion. The central portion also has a hole in its center. The central portion of the goniometer measures the angle of separation between the two arms of the goniometer. 2) In measuring the ROM between the lower and upper arm, the point of rotation is the elbow. 10 3) The hole should be placed in the central portion of the goniometer directly over the joint's point of rotation. In the case of the elbow, this is the point on the elbow where the lower arm joins to the elbow. 4) The goniometer's stationary arm should be aligned along the reference line for that joint while keeping the goniometer's hole over the joint's point of rotation. The reference line is the line that will indicate a movement of 0 degrees. In the case of the elbow, the reference line is the upper arm. 5) The subject is instructed to extend the joint as far as he can without experiencing pain. Align the goniometer's rotating arm with the limb that moved in this extension. In the case of the elbow, this limb is the lower arm. The central portion of the goniometer will now show the joint's ROM in degrees. In the present design, this procedure is followed in order to emulate the procedure used in clinical situations. Measuring Tilt with Low-g Accelerometers This application note[6] describes how accelerometers are used to measure the tilt of an object. Accelerometers can be used for measuring both dynamic and static measurements of acceleration. Tilt is a static measurement where gravity is the acceleration being measured. Therefore, to achieve the highest degree resolution of a tilt measurement, a low-g, high sensitivity accelerometer is required. In measuring the angle, the change in degrees of tilt directly corresponds to a change in the acceleration due to a changing component of 11 gravity acted on the accelerometer. In order to determine the angle of tilt, θ, the A/D values from the accelerometer are sampled by the ADC channel on the microcontroller. The acceleration is compared to the zero g offset to determine if it is a positive or negative acceleration. One solution can measure 0° to 90° of tilt with a single axis accelerometer, or another solution can measure 360° of tilt with two axis configuration (XY, X and Z), or a single axis configuration (e.g. X or Z), where values in two directions are converted to degrees and compared to determine the quadrant that they are in. A tilt solution can be solved by either implementing an arccosine function, an arcsine function, or a look-up table depending on the power of the microcontroller and the accuracy required by the application. The group included this paper[6] as a reference in computing for the angle. The method included in this paper can serve as an alternative solution for the computation of the angle. Since the concept in computing the angle of tilt is roughly the same for this method (comparing values in different degree of tilt), the group considered this article as a related literature. Furthermore, the solution presented in this article can serve as a backup to ensure that if the solution the group used does not live up to its expectation or yielded poor test results, the group can still use the solution in this article to fix the problem. 12 ZigBee Technology The design will use the analog signals from the movement of the accelerometers, convert it into digital signal, then transmit it using the ZigBee wireless technology. According to an article entitled “Networked Wireless Meter Reading System Based on ZigBee Technology”[4] (Liting Cao, Wei Jiang, Zhaoli Zhang) from IEEE issued last July 2008 the ZigBee, namely IEEE802.15.4 technology standard is one of the WPAN IEEE802.15 technology standard. ZigBee bend itself to realize a short distant double direction wireless communication protocol which is lower in complexity, lower cost and lower speed. In this article[4] the ZigBee technology was used to solve the problems existed in meter reading systems. The structure of the system employs distributed structure the measure meters, sensor nodes, data collectors, server and wireless communication network. For a short distance transmission the data collector collects data using ZigBee communication. Another article supports the use of wireless technology. The article which is entitled, “5.5mA 2.4-GHz two-point modulation ZigBee transmitter”, by Rui Yu Theng-Tee, Yeo Kwang-Hung, Tan Shouxian,MouYike, Cui Haifeng, Wang HwaSeng, and Yap Ting from IEEE issued last September 2009 describes a 2.4-GHz two-point modulation IEEE 802.15.4 (ZigBee) compliant transmitter presented. The sigma-delta fractional-N PLL based transmitter is optimized for both lowpower and low-cost purposes. A novel closed-loop calibration scheme is 13 proposed to minimize the gain mismatch between two modulation points, which is the main source of error in two-point modulation. With these articles, the group concludes that ZigBee wireless Technology has advantages with the other RF modules with its low power consumption, low cost, and a wider range. PIC16F877A Microcontroller In an article entitled ¨Network model based automation of thermal processes using an embedded digital controller”, by Ganesh, A.B. Sangeetha, A.L. Ravi, V.R. issued last Dec. 2009 from IEEE, a microcontroller is used. The article describes the network architectures of both WAN and LAN based real time control and monitoring of thermal process station using an embedded digital controller. The function of the microcontroller in this design is a temperature controller that communicates directly with the temperature transmitter. The design uses the PIC16F877A microcontroller. The group‟s design will use two microcontroller units, one for the transmitter, and the other is for the receiver part. The article above shows that microcontrollers can interact with transmitters, thus it can also interact with receivers. Microchip Programmable Interface Controller (PIC) are popular with both industrial developers and designers due to their low cost, wide availability, large user base, and serial programming (and re-programming with flash memory) 14 capability. Different levels of on-board features are being associated to each type of microcontrollers. The smallest ones can add some simple automation to a project, while huge devices have the capabilities of a microprocessor system, offering much more than simple control. 15 CHAPTER 3 DESIGN PROCEDURES This chapter discusses the procedures that were followed in the development of the design. This also includes the block diagram, schematic diagram and the system flow chart. Hardware Development Block Diagram TRANSMITTER Accelerometer (Upper Limb) Accelerometer (Lower Limb) ZigBee Technology MCU/ADC 9V Battery RECEIVER ZigBee Technology MAX232 COMPUTER Figure 3.1 System Block Diagram of PC-Interfaced Goniometer for Knee and Elbow Angular Measurements using Accelerometer and ZigBee Technology 16 Figure 3.1 shows the basic block diagram of the overall system design. The system is composed of two divisions: the transmitter and the receiver. The primary input of the system will be coming from the two accelerometers. From the figure, the accelerometers are connected to the MCU that interprets the analog signal, then converts it into digital signal. The ZigBee Module will be responsible for the wireless transmission. The main output of the system is the angular measurement reading that is shown in the LCD attached to the device. The last block in the diagram represents the Computer to where the angular measurement is stored in the patient‟s database. That completes the process of the designed system. 17 Schematic Diagram Figure 3.2 Schematic Diagram of the Transmitter with the Accelerometer, Microcontroller and Zigbee Module 18 Figure 3.1 shows the schematic diagram of the device. Power is supplied by the 9v battery which is controlled by a switch. It passes through a diode which serves as a protection in case the battery is improperly connected. Opamp then regulates the voltage to 3.3V which is to be used by the accelerometers. In parallel, another voltage regulator gives the 5V which the microcontroller and the LCD need. The accelerometer outputs analog voltage which is connected to a debouncer circuit, seen as a collection of capacitors to keep the voltage stable. The debouncer circuit stabilizes the voltage to be passed into the microcontroller, since the accelerometer output is analog. The voltage then passes through a precision resistor, which is like a potentiometer that sets the reference voltage to be used by the ADC in the conversion from analog signal to digital. The conversion of the voltage and calculation of the angle is done inside the microcontroller. The output is passed to the LCD, which displays the output into readable text, and to the ZigBee, for transmission. Before the signal reaches the ZigBee, it passes through a voltage divider. Since the input voltage of the microcontroller is 5v, the output can reach 5V, which is a problem to the ZigBee. The ZigBee can only accommodate 3.3V, which explains the need for a voltage divider. 19 Figure 3.3 Zigbee Module Schematic Diagram (Receiver Side) Figure 3.2 shows the receiver side of the device. The signal is received by ZigBee. The signal is digital when it leaves the module. It then passes through MAX232 which amplifies the signal so no loss is incurred due to line resistance. The capacitors are needed as stated in its datasheet. The 5V supply came from the 1st USB connection and is then regulated down to 3.3V which the IC needs. The signal is then passed through the serial-to-USB cable to send the data. 20 Software Development System Flowchart Start Initialize values Get analog signal from accelerometer End No Convert analog signal to digital Scale values Trim values for distal and proximal Perform addition/ subtraction of proximal and distal values Send button pressed Yes Pass data to zigbee(transmitter) Send data to zigbee(receiver) Figure 3.4 Transmitter-side Program Flowchart 21 Figure 3.4 illustrates how the device works. First, the values are initiated when the device is turned on. These initiations cover the initial values of the registers like the TRIS, necessary control bits of the ADC, and initialization of the values that will be used. When done initiating, the analog signal that the accelerometers generate is being taken by the microcontroller. The microcontroller has a built-in ADC that converts analog signals to digital. The resulting digital signal will be in the form of numbers usually in the range of hundreds. These values are then scaled because the values that the accelerometers produce are too unstable because of sensitivity. Scaling will provide a much more workable set of values that the designers need in the conversion of the angles. After scaling the values, the designers subtract a certain number to the value to produce the angle. This is based on the value that the designers get when they put the accelerometer perfectly flat so that it produces a 0 angle and that the value that makes it zero is the one subtracted to get the angles. Since the designers are using 2 accelerometers to compensate for the angle of the other, they are either added or subtracted to one another depending on the orientation to get the final angle. The result is then passed to the receiver side when the button is pressed. 22 Start Receive Data from transmitter Convert to Digital Signal (ZigBee module) Signal Amplification by MAX232 Data is read by the PC-side software End Figure 3.5 Receiver-side Program Flowchart Figure 3.5 shows that after receiving the signal, an IC converts the signal to RS232, which is the standard when using serial cable. This is then converted to USB so that the signal can be transferred to the PC to be used by the program. 23 Database Schema Figure 3.6 Database Schema Figure 3.6 shows that the database relationship used is one to many, as ID from General Information table, can have multiple links to other tables. This relationship is applied because the database was made to record the details of the patient and the results of the test only. A simple database design means less work for the program. This relationship ensures that the program will run efficiently and ensures that the data will be stored correctly. 24 Entity Relationship Diagram ID Referring Doctor Patient Name Date of Referral General Information Date of Evaluation Age Gender Patients have Address Religion ID Ocular Findings Range of Motion (Arm) Palpatation Range of Motion (Leg) Figure 3.7 General Information-Findings Relationship 25 ID Referring Doctor Date of Referral Patient Name General Age Date of Evaluation Gender Patients have Address Religion ID Operation Past Medical History Medication Figure 3.8 General Information-Past Medical History Relationship Figures 3.7 and 3.8 shows the relationship between the tables in the database. The general information table stores the basic information needed to identify the patient. This is where all data from the patient‟s identity is being stored. A patient may have past medical history like operations and medications. This is why there is a relationship between the tables. The link that binds the two tables is the ID from the general information table. In every consultation, there will be findings or results. The relationship of the two tables can be seen in figure 3.6, where the linking element is also the ID from the general information table. 26 Use Case Wireless Goniometer Software Add Record Delete Record Edit Record User Get measurements Figure 3.9 Wireless Goniometer Use Case Figure 3.9 illustrates the use case of the software. The software is designed to record the measurements that the device will pass to it. The software does not need any more users since it will be only be used by doctors and in order to simplify the use of the device. This results to a single user as can be seen in the use case. 27 Activity Diagram Start Select Record Edit Record Add Record Delete Record Get Measurements End Select Mode Leg Arm Record Angle Figure 3.10 Activity Diagram 28 Figure 3.10 shows the activity diagram of the program. This basically shows the flow of all options that the user will face when using the program. First, since there are no other accounts to log in, the user is faced with options to add, delete, or make an examination. The process of adding and deleting records are straight forward; the user enters the name of the patient to be deleted and the program deletes it from the database. In adding, the user inputs the necessary information and adds it to the database. In selecting a patient, the user may opt to edit the record or make an examination. In editing, the user simply adds or deletes information from the patient in the database. In making an examination, the user is free to choose which mode to use. If it is an arm examination, the user simply clicks record button on the section that is labelled “arm.” The user clicks record on the leg section otherwise. The program automatically receives the data from the device and records the angle. This angle is then recorded in the database. 29 Prototype Development The design procedure will show the step-by-step procedure on how the design was built. It will describe the detailed information about the conceptualization of the design project. 1. Conceptualization After knowing how the design will work as a whole, the conceptualization of the transmitter and receiver part must be equated to simplify the design hardware and software. 2. Simplified design requirement It is also important to create an initial drafting of materials required as the development of the project proceeds. This will give the researchers an overview of the project. 3. Illustrate the block diagram This defines the major composition of the design and shows how each block is related with each other. The block diagram for the transmitter consists of the Microcontroller Unit (MCU), Accelerometer for Upper Limb, Accelerometer for Lower Limb, Wireless technology using ZigBee, and 9V Battery. The block diagram of the receiver consists of the ZigBee technology, MAX232, and Computer. 30 4. Draw schematic diagram Schematic diagram of this design shows how each device was interconnected. It contains major components such as the Microcontroller Unit (MCU), Accelerometer for Upper Limb, Accelerometer for Lower Limb, Wireless technology using ZigBee, and 9V Battery for the transmitter. On the other hand, the receiver of the system uses components such as the wireless technology using ZigBee Module and the Computer. In developing the design, the following materials were used each, with a brief discussion: PIC16F877A This type of microcontroller was used in the design primarily because of its many inputs. PIC16F877A has a maximum of 40 I/O pins which is very much suitable for the design. It has a maximum of 256 bytes for its register which is also much appropriate for the design to be possible. It also has built – in UART (Universal Asynchronous Receiver Transmitter) that can communicate with peripheral devices such as personal computers or laptops. 31 ZigBee Wireless Technology The ZigBee technology was used because it has greater range and is widely used in today‟s wireless technology. The group used this because of its low consumption of power and wide range of transmission. MAX232 The MAX232 is a dual driver/receiver that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits and vice versa. MAX232 operates at 5V DC input voltage and connected to V s pin of the IC. The MAX232 IC is used to interface the central computer and the Zigbee module in the receiver side. HD44780U (LCD) The HD44780U dot-matrix liquid crystal display controller and driver LSI displays alphanumeric, Japanese characters, and symbols. It can be configured to drive a dot-matrix liquid crystal display under the control of a 4- or 8-bit microprocessor. The HD44780U character generator Rom is extended to generate 208 5x8 dot character fonts and 32 5x10 character fonts for a total of 240 different character fonts. The low power supply (2.7V to 5.5V) of the HD44780U is suitable for any portable battery-driven product requiring low power dissipation. 32 ADXL335 (3-axis Accelerometer) The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal conditioned voltage outputs. ADXL335 measures acceleration with a minimum full-scale range of g. It can measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion, shock, or vibration. In the design, it is used as a motion sensor. Bill of Materials QTY 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 1 3 1 1 1 1 1 2 2 1 - MATERIALS ACRYLIC SENSOR CASING WOODEN STAND CONTROLLER CASING RECEIVER CASING MCU PIC16F877 ACCELEROMETER ZIGBEE PUSH BUTTON LCD 2X16 MULTI-TURN TRIMMER RESISTOR MAX232 DRIVER USB TO RS232 CABLE 9PIN RS232 CONNECTOR RA USB CABLE 33PG9 3.3V VOLTAGE REGULATOR LM7805 CAPACITORS 9V BATTTERY 9V BATTTERY HOLDER 9V BATTERY CLIP TOGGLE SWITCH PCB ARM STRAPS LEG STRAPS VELCRO TAPE MISCELLANEOUS TOTAL PRICE 170 300 300 100 300 1,800 3,800 15 1,400 75 150 200 65 50 70 16 75 135 18 13 25 200 400 400 50 2150 12,277 Table 3.10 Bill of Materials 33 Chapter 4 TESTING, PRESENTATION AND INTERPRETATION OF DATA This chapter presents various tests performed by the designers to determine the effectiveness of the design. The tests are conducted with relevance to the design objectives. Wireless Technology using ZigBee Signal Range Test The researchers conducted a signal range test to determine the capability of the wireless technology. Goniometers are intended for clinical use in very close proximity which commonly has an area of 5 sq. m but still, the designers decided to test the full capability of the ZigBee in case it is necessary to be used in larger proximity. Here are the procedures in conducting this test: 1. Set-up and turn on the apparatus and run the software. 2. Separate the transmitter and receiver side 10m – 50m away from each other with 10m intervals after every 5 trials. Make sure they are in line of sight. 3. While in the 'Edit' menu, click the 'Record' button in either arm or leg measurements. This signifies that the software is ready to receive and add the data in the database. 4. While the 'Record' button is active, push the 'Send' button in the 34 transmitter side. Take note of the angle reading sent. 5. Observe the angle reading received and added in the database displayed in the PC interface. Also, take note of the speed of data transmission. The following table shows the results gathered based on the signal range test. TRIAL 1 2 3 4 5 10m Good Good Good Good Good 20m Good Good Good Good Good 30m Good Good Good Good Good 40m Good Good Good Good Good 50m Poor Poor Poor Poor Poor Table 4.1 Wireless Data Transmission Proximity Test The designers tested the wireless proximity within a 10m – 40m range. The testing was done in an area wherein the receiver is in line of sight and a few meters away from the transmitter. An angle reading will be sent to the database by pushing the „Send‟ button in the apparatus and clicking the „Record‟ button in the PC interface. The results show that within 40m, the data transmission is „Good‟ which means that there is no delay and the sent data is correct. In a distance of 50m, the data transmission is „Poor‟ meaning that there is no received data. 35 Accelerometer Output Scale Test In this test, there will be four tables presented. These are for the positive and negative distal, and positive and negative proximal scaling. The values presented in these tables are analog to digital conversions which are outputs from the accelerometers with corresponding angle measurements from the goniometer. The following are steps to scale the digital output: Distal Accelerometer Test: 1. Attach the two accelerometers in a conventional goniometer. It is recommended to use a stand for support and stability to be able to put one accelerometer in 0° position. 2. Modify the code in the microcontroller so that the actual digital decimal output of the accelerometer will be displayed in the LCD. 3. While one accelerometer is in 0° position, tilt the other accelerometer slowly and record the digital output every 5° interval for 5 trials. 4. The direction in which the distal arm is moving will determine the sign of the angle. 5. Record output. 36 TRIAL 1 2 3 4 5 5° 362 362 362 362 362 10° 363 363 363 364 364 15° 364 364 365 365 365 20° 366 366 366 366 368 25° 370 370 370 370 371 30° 372 372 372 372 376 35° 377 377 378 378 380 40° 381 381 381 381 383 45° 384 386 386 386 389 50° 390 391 392 393 395 55° 396 397 397 398 402 60° 403 404 405 405 408 65° 409 410 411 412 415 70° 416 417 419 419 422 75° 423 423 425 426 429 80° 430 430 432 433 436 85° 437 438 440 441 444 90° 445 446 448 448 451 95° 452 453 455 457 459 100° 460 461 463 465 467 105° 468 469 471 472 475 110° 476 477 479 481 484 115° 485 486 487 488 491 120° 492 493 495 495 498 125° 499 500 501 502 505 130° 506 507 509 509 512 135° 513 514 514 515 518 140° 519 519 524 532 538 Table 4.2 Distal Scaling (Positive) 37 The values presented in the preceding table are analog to digital conversions which are outputs from the accelerometer with corresponding angle measurements from the goniometer. These values are the direct result of analog to digital conversion done inside the PIC. These numbers represents the tilt of the accelerometers that is used to get the angle of the device. The numbers that is shown in the table is the output from the Y-axis of the accelerometer. TRIAL 1 2 3 4 5 5° 2 2 2 2 2 10° 3 3 3 3 3 15° 4 4 4 4 4 20° 5 5 5 6 6 25° 7 7 7 7 9 30° 10 10 10 11 12 35° 13 13 14 14 16 40° 17 17 18 18 20 45° 21 21 22 23 25 50° 26 27 28 29 31 55° 32 33 33 35 38 60° 39 40 42 42 44 65° 45 46 48 50 52 70° 53 54 56 56 58 75° 59 60 62 65 67 80° 68 69 71 72 74 85° 75 76 78 80 82 90° 83 84 86 88 90 Table 4.3 Distal Scaling (Negative) 38 The values presented in the preceding table are analog to digital conversions which are outputs from the same accelerometer with corresponding angle measurements from the goniometer. These values are the direct result of analog to digital conversion done inside the PIC and are the same in the way that the values are being fetched as the positive distal scaling test. The reason for the difference in value despite the same concept in producing the result is in the way it is programmed. The process of producing these results is simply subtracting 360 (which is the ADC value at 0 degree) from the ADC value of the negative distal scaling. This is to avoid confusion with positive distal scaling which can cause confusion in programming and testing. Proximal Accelerometer Test: 1. Attach the two accelerometers in a conventional goniometer. It is recommended to use a stand for support and stability to be able to put one accelerometer in 0° position. 2. Modify the code in the microcontroller so that the actual digital decimal output of the accelerometer will be displayed in the LCD. 3. While one accelerometer is in 0° position, tilt the other accelerometer slowly and record the digital output every 5° interval for 5 trials. 4. The direction in which the proximal arm is moving will determine the sign of the angle. 5. Record output. 39 TRIAL 1 2 3 4 5 80 451 451 451 451 451 75° 450 450 450 449 449 70° 448 446 446 445 445 65° 444 443 442 442 442 60° 441 439 438 438 437 55° 436 435 432 432 430 50° 431 429 429 428 427 45° 426 423 422 421 421 40° 420 420 417 415 415 35° 414 410 409 408 408 30° 407 405 404 401 401 25° 400 395 394 393 393 20° 392 390 388 386 386 15° 385 381 379 378 377 10° 376 374 373 371 371 5° 370 367 365 362 361 Table 4.4 Proximal Scaling (Negative) The values presented in the preceding table are analog to digital conversions which are outputs from the accelerometer with corresponding angle measurements from the goniometer. These values show the proximal scaling that is needed in the determination of the angle. The different values at different trials show that the in a certain angle, there can be different values corresponding to it. These values can have a range of up to 9 or 10. This is important to know since less sensitivity in the measurement means that there will be more workable data to be processed. 40 TRIAL 1 2 3 4 5 5° 359 358 356 354 352 10° 350 349 347 345 343 15° 342 341 340 338 336 20° 334 334 332 330 328 25° 325 323 322 322 320 30° 318 316 315 314 314 35° 310 309 308 307 305 40° 304 303 302 301 299 45° 298 297 296 295 293 50° 292 292 291 389 387 55° 286 286 285 285 283 60° 282 282 281 280 278 65° 277 277 277 276 275 70° 274 274 273 271 271 75° 270 270 270 269 269 80° 268 268 268 268 268 85° 267 267 267 267 267 90° 266 266 266 266 266 Table 4.5 Proximal Scaling (Positive) The values presented in the preceding table are analog to digital conversions which are outputs from the accelerometer with corresponding angle measurements from the goniometer. The values in this test, like in the distal scaling test, are similar in the way it is being produced. The values between the angles of both positive and negative scaling are just separated with a small margin, showing that the procedure is the same. 41 Precision Test Precision Testing was conducted by the designers to verify the reliability of the design's angle measurements. It is not necessary to have an accuracy of 100% with the angle measurement. Since, it is only intended for monitoring the improvement of the range of motion of the patients‟ joints. A very close reading to the actual angle measurement is needed, nonetheless. To conduct the test, the following steps are used: 1. Attach the two accelerometers in a conventional goniometer. It is recommended to use a stand for support and stability to be able to put one accelerometer in 0° position. 2. Turn on the transmitter side of the device. 3. For the arm measurement, tilt the Distal in 10° interval starting from 0°. For the leg measurement, tilt both the Distal and Proximal until they meet just like an actual leg with the same interval and starting point. 4. Record the result from the LCD display 5 trials each interval. 42 TRIAL 1 2 3 4 5 0° 0° 0° 2° 0° 1° 10° 0° 7° 0° 10° 15° 20° 18° 20° 21° 20° 18° 30° 30° 31° 29° 30° 30° 40° 39° 40° 40° 41° 39° 50° 51° 52° 50° 49° 50° 60° 59° 61° 61° 60° 60° 70° 71° 70° 70° 70° 69° 80° 82° 79° 81° 80° 79° 90° 90° 89° 90° 91° 91° 100° 101° 101° 100° 100° 101° 110° 109° 111° 110° 110° 110° 120° 120° 120° 120° 120° 120° 130° 129° 130° 130° 131° 130° 140° 140° 140° 140° 139° 140° Table 4.6 Elbow Joint Angle Precision Test TRIAL 1 2 3 4 5 0° 2° 0° 0° 0° 1° 10° 12° 7° 8° 10° 9° 20° 20° 20° 21° 20° 21° 30° 30° 31° 30° 30° 30° 40° 40° 41° 40° 40° 39° 50° 50° 50° 49° 50° 49° 60° 60° 60° 61° 61° 60° 70° 70° 69° 70° 70° 70° 80° 81° 79° 80° 80° 80° 90° 89° 90° 91° 91° 90° 100° 99° 100° 100° 101° 100° 110° 110° 110° 110° 110° 110° 120° 120° 120° 120° 120° 120° 130° 131° 130° 130° 131° 130° 140° 140° 139° 140° 139° 140° Table 4.7 Knee Joint Angle Precision Test 43 As seen from Tables 4.6 and 4.7 and in reflection to the Accelerometer Output Scale Test, small angles from 0° to 20° have discrepancies but as stated earlier, these are negligible. There is also a ± 3 tolerance in the angle measurements but these are not a problem because the purpose of the design is to monitor the improvement of the patients' joints' range of motion, not the accuracy of measurements. Overall, the design's measurements are precise, nonetheless. Output Test Output Testing is conducted to determine if the sent data from the apparatus is received successfully by the database. Procedure for Output Test: 1. Set-up and turn on the apparatus and run the software. Make sure the transmitter and receiver side are in close proximity. 2. While in the 'Edit' menu, click the 'Record' button in either arm or leg measurements. This signifies that the software is ready to receive and add the data in the database. 3. Tilt the Distal upward starting from 0° to 140° with 10° interval. 4. While the 'Record' button is active, push the 'Send' button in the transmitter side. Make sure the angle is correct in every trial. 5. Record the data received in the database and displayed in the PC interface. Do 5 trials each interval. 44 TRIAL 1 2 3 4 5 0° 0° 0° 0° 0° 0° 10° 10° 10° 10° 10° 10° 20° 20° 20° 20° 20° 20° 30° 30° 30° 30° 30° 30° 40° 40° 40° 40° 40° 40° 50° 50° 50° 50° 50° 50° 60° 60° 60° 60° 60° 60° 70° 70° 70° 70° 70° 70° 80° 80° 80° 80° 80° 80° 90° 90° 90° 90° 90° 90° 100° 100° 100° 100° 100° 100° 110° 110° 110° 110° 110° 110° 120° 120° 120° 120° 120° 120° 130° 130° 130° 130° 130° 130° 140° 140° 140° 140° 140° 140° Table 4.8 Sent Data Output Test The „Send‟ button in the apparatus is to be pushed and the „Record‟ button in the PC interface should be pressed to successfully send and receive data. The sent data displayed in the apparatus should be equal to the received data displayed in the PC interface. The results in Table 4.8 show that the data transmission is perfect given that the transmission range is within 40m. Whatever the reading is in the goniometer when the 'Send' button is pressed, the ZigBee will send and receive the correct data. Then, the PC interface will output the transmitted data if the 'Record' button is clicked. 45 Chapter 5 CONCLUSION AND RECOMMENDATION This chapter contains the general conclusion of the development of the design in relation to its objectives. The results of the various tests performed should also be clearly defined in this chapter. Recommendation for the improvement of the design is also stated in this chapter. CONCLUSION In the design PC-Interfaced Goniometer for Knee and Elbow Joint Angular Measurements Using Accelerometer and ZigBee Technology, the designers were able to develop a device that addresses the drawbacks of using a conventional goniometer. The designers were able to design a functional goniometer that is less bulky and more portable than conventional goniometers such as electrogoniometers and mechanical goniometers by using accelerometers and straps instead of the hinged protractor and arms. The design of the device enables the examiner to freely guide the patient‟s limbs since he does not need to hold the goniometer and keep it in place during the procedure, making it easier for the examiner. Since the procedure will be much easier and faster, the patient will be more comfortable during the procedure. The design is incorporated with ZigBee Technology in transmitting the captured data from the accelerometers and receiving the data to be stored in the 46 Patient Information database. The software serves as the database where the patient‟s information and angle measurements are stored. RECOMMENDATION The researchers suggest replacing ZigBee with other wireless technology that offers more features such as lower power consumption and wider range of data communication. It is also suggested to add further enhancements to the software where implementation of the accelerometer will enable the user to achieve more accurate readings in any orientation possible. Also, it is suggested to make it the device flexible in terms of functionality by making it possible for the device to measure other human joints as well. Other than using the computer desktop or laptop as the information storage, it is suggested to use a Personal Digital Assistant (PDA) or other handheld devices such as iPad and iTouch to make the device more portable. The researchers also recommend performing further research to make the application run on other operating systems other than the Windows platform such as Linux to provide software portability. 47 REFERENCES 1. Barreiro, M.S. Frere, A.F. Theodorio, N.E.M. Amate, F.C. (2004). Goniometer Based to Computer, Engineering in Medicine and Biology Society Journal, IEEE 2. Jeong-Whan, Lee Lee-Yon, Hong Jae-Hoon (2007). A Simple Optical Angular Sensors to Measure the Human Joint Angle, SICE-ICASE, IEEE 3. Donno, M. Palange, E. Di Nicola, F. Bucci, G. Ciancetta, F. (2008). A New Flexible Optical Fiber Goniometer for Dynamic Angular Measurements: Application to Human Joint Movement Monitoring, Instrumentation and Measurement, IEEE Transactions 4. Liting C., Wei J., Zhaoli Z. (2008). Networked Wireless Meter Reading System Based on Zigbee Technology. Wireless Technology, IEEE, page(s): 3455 5. Rui Yu Theng-Tee, Yeo Kwang-Hung, Tan Shouxian,MouYike, Cui Haifeng, Wang Hwa-Seng, and Yap Ting (2009). 5.5mA 2.4-GHz two-point modulation ZigBee transmitter. Wireless Technology, IEEE 6. Ganesh, A.B. Sangeetha, A.L. Ravi, V.R. (2009). Network Model Based Automation of Thermal Processes Using an Embedded Digital Controller. IEEE 7. C. C. Norkin, D.J. White (2003). Measurement of Joint Motion: A Guide to Goniometry, 3rd Edition, F.A. Davis Company, Philadelphia 8. Michelle Clifford, Leticia Gomez (2005) Freescale Semiconductor: Measuring Tilt with low-g Accelerometers, Sensor Products, Temple, AZ 48 APPENDIX A Operation’s Manual 1. System Requirement a. Windows XP or higher version of OS b. 9V Battery c. RS232 to USB port cable 2. Installation Procedures a. Provide a 9V Battery for the transmitter device b. Flick the switch to ON to enable transmitter device. c. Connect the receiver device to a computer using a RS232 to USB port cable. d. Install the driver for the RS232 to USB port. e. Fit straps onto the patient. f. Attach accelerometers to the straps. 3. User’s Manual Preparing the Device Before starting, it is better to be familiar with the device. The device has two parts, one is the transmitter and the other is the receiver. The transmitter is incorporated with two accelerometers which are attached to the straps fitted to the upper and lower limb of the patient. The receiver has a USB power source supply that directly gets its power source to the computer. 49 After distinguishing the devices we now proceed with fitting the accelerometers. Straps are fitted to the upper and lower limb of the patient‟s leg or arm. After securing the straps, the accelerometers are attached to the straps using Velcro. a.) Press the switch located at the side to enable the device and make sure that the initial reading on the device is 0 degrees. b.) Connect the receiver to the USB port of the computer to access its power source. Using a RS232 to USB port cable, connect the device to the computer. Measurement Procedure (Elbow) 1) Fit the straps onto the patient‟s arm. 2) Position the patient in supine position and the arm is close to the side of the body. 3) Attach the accelerometers into each strap. 4) Set the accelerometer so that the reading in the LCD display is 0 degrees. 5) Flex the elbow by moving the hand toward the shoulder. Maintain the forearm supination during the motion. 6) The end of flexion ROM occurs when resistance to further motion is felt and attempts to overcome the resistance cause flexion of the shoulder. 7) Press the SEND button to record the reading into the patient information database. 50 Measurement Procedure (Knee) 1) Fit the straps onto the patient‟s leg. 2) Position the patient in supine position with the knee in extension. 3) Attach the accelerometers into each strap. 4) Set the accelerometer so that the reading in the LCD display is 0 degrees. 5) Hold the patient‟s ankle in one hand and move the thigh with the other hand. 6) The end of flexion ROM occurs when resistance to further motion is felt and attempts to overcome the resistance cause additional hip flexion. 7) Press the SEND button to record the reading into the patient information database. Using the Software Before using the application make sure that the driver for the RS232 USBto-Serial Port Cable is installed. a.) Open “Digital_Goniometer.exe”. b.) The user will be prompted to the main page. c.) The user can opt to add New Patient Information or Open Patient Information. 51 d.) To add/edit Patient Information including the joint angular measurements, click Edit. e.) To close the program, press the File from the Menu bar and click Exit. 4. Troubleshooting Guides and Procedures Scenario: Invalid Port Number Figure B.1 Invalid Port Number Error Solution A. Check if Port Number in the program is correct. - The port number corresponds to the port where the receiver device should be attached. 52 Solution B. Check if receiver is connected. - The receiver is connected via a RS232 serial to USB port. Check if the connection is proper. The receiver‟s power is also supplied via USB port. Check also if it is connected. 53 APPENDIX B Pictures of Prototype RECEIVER RS232 Serial-to-USB Cable Figure B.2 Receiver Connected to the Laptop via USB and RS232 ACCELEROMETERS LCD DISPLAY SEND BUTTON Figure B.3 Accelerometers Attached to Goniometer and Transmitter Device 54 ARM & LEG STRAPS Figure B.4 Transmitter Device with Arm and Leg Straps Figure B.5 Sample Picture of Whole Design 55 Figure B.6 Sample Output of Angle Reading in LCD Display Figure B.7 Output Interface of the Design (Patient Information Database) 56 Figure B.8 Patient Information Database Software 57 APPENDIX C Program Listing (in BASIC) ' 4 LINER LCD ' XYZ MONITOR ' Y and Z-axis Device = 16F877A ' Were using 8bitmicro PIC16F877 XTAL = 4 ' 4mhz resonator/crystal is used. DelayMS 500 Declare ADIN_RES 10 ' Set the resolution to 10 bit Declare ADIN_TAD FRC ' Choose the RC osc for ADC samples Declare ADIN_STIME 150 ' Allow 150us for charge time UNSIGNED_DWORDS = On ' remove negative values LCD_DTPIN = PORTB.0 ' Used for 4 data line interface. LCD_RSPIN = PORTB.4 line will attach to. ' Assigns the Port and Pins that the LCD's RS LCD_ENPIN = PORTB.5 line will attach to. ' Assigns the Port and Pin that the LCD's EN LCD_INTERFACE = 4 required by the LCD. ' Inform the compiler 4-line interface is LCD_LINES = 2 has. ' Inform the compiler how many lines the LCD LCD_TYPE = 0 alphaNUMERIC. ' Inform the compiler that the type of LCD is 58 HSERIAL_BAUD = 9600 ' Baud rate (transmission speed) HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive HSERIAL_TXSTA = %00100100 ' Enable transmit and asynchronous mode HSERIAL_CLEAR = On PORTB_PULLUPS = On ADCON1 = %10001010 result ' Enable Internal pullup resistor ' Set PORTA.0,1,2 to 4 analog and right justify TRISA = %111111 ' Set PortA as analog Input TRISB = %01000000 ' Set PortB as all bits Output (LCD) TRISC = %00000000 (ACCELEROMETERS) ' Set PortC as all bits Output (ZIGBEE) Dim Z_axis_U As Word ' Declare variable "Z_axis_U / Proximal" Dim Y_axis_U As Word ' Declare variable "y_axis_U / Proximal" Dim Z_axis_L As Word ' Declare variable "Z_axis_L / Distal" Dim Y_axis_L As Word ' Declare variable "Y_axis_L / Distal" Dim angle As Word Dim var1 As Word Dim neg_distal As Bit Dim neg_proximal As Bit Clear PORTA ' Clear portA Clear PORTB ' Clear portB Clear PORTC ' Clear portC Clear PORTE ' Clear portC Clear Y_axis_U ' Clear Variable 59 Clear Z_axis_U ' Clear Variable Clear Y_axis_L ' Clear Variable Clear Z_axis_L ' Clear Variable BEGIN: Cls ' CLEAR SCREEN DelayMS 500 Print At 1,1," GONIOMETER " Print At 2,1," 2011 " DelayMS 3000 DISPLAY: Cls Loop: Clear neg_proximal Y_axis_L = ADIn 0 'Place the conversion into variable "Y_axis_Lower" DelayMS 15 Y_axis_U = ADIn 1 „Place the conversion into variable "Y_axis_Upper" DelayMS 15 Z_axis_U = ADIn 2 'Place the conversion into variable "Z_axis_Lower" DelayMS 15 Z_axis_L = ADIn 4 'Place the conversion into variable "Z_axis_Upper" DelayMS 15 60 Y_axis_U = Y_axis_U - 93 ' compensation '-------------------------------------' (+) DISTAL SCALING '-------------------------------------Clear neg_distal If Z_axis_L > 454 Then Select Y_axis_L Case 362 Y_axis_L = 365 '5 Case 363 To 364 Y_axis_L = 370 ' 10 Case 364 To 365 Y_axis_L = 375 ' 15 Case 366 Y_axis_L = 378 Case 367 To 368 Y_axis_L = 380 ' 20 Case 369 Y_axis_L = 383 Case 370 To 371 Y_axis_L = 385 ' 25 Case 372 Y_axis_L = 387 61 Case 373 To 376 Y_axis_L = 390 ' 30 Case 377 Y_axis_L = 392 Case 378 Y_axis_L = 394 Case 379 To 380 Y_axis_L = 395 ' 35 Case 381 Y_axis_L = 397 Case 382 To 383 Y_axis_L = 400 ' 40 Case 384 To 385 Y_axis_L = 402 Case 386 Y_axis_L = 404 Case 387 To 389 Y_axis_L = 405 ' 45 Case 390 To 391 Y_axis_L = 407 Case 392 To 393 Y_axis_L = 408 Case 394 To 395 Y_axis_L = 410 ' 50 62 Case 396 To 397 Y_axis_L = 412 Case 398 Y_axis_L = 414 Case 399 To 402 Y_axis_L = 415 ' 55 Case 403 To 404 Y_axis_L = 417 Case 405 Y_axis_L = 418 Case 406 To 408 Y_axis_L = 420 ' 60 Case 409 To 410 Y_axis_L = 422 Case 411 To 412 Y_axis_L = 424 Case 413 To 415 Y_axis_L = 425 ' 65 Case 416 To 417 Y_axis_L = 427 Case 418 To 419 Y_axis_L = 428 Case 420 To 422 Y_axis_L = 430 ' 70 63 Case 423 Y_axis_L = 432 Case 424 To 425 Y_axis_L = 433 Case 426 Y_axis_L = 434 Case 427 To 429 Y_axis_L = 435 ' 75 Case 430 Y_axis_L = 437 Case 431 To 432 Y_axis_L = 438 Case 433 Y_axis_L = 439 Case 434 To 436 Y_axis_L = 440 ' 80 Case 437 To 438 Y_axis_L = 442 Case 439 To 440 Y_axis_L = 443 Case 441 Y_axis_L = 444 Case 442 To 444 Y_axis_L = 445 ' 85 64 Case 445 To 446 Y_axis_L = 447 Case 447 To 448 Y_axis_L = 448 Case 449 To 451 Y_axis_L = 450 ' 90 Case 452 To 453 Y_axis_L = 452 Case 454 To 455 Y_axis_L = 453 Case 456 To 457 Y_axis_L = 454 Case 458 To 459 Y_axis_L = 455 ' 95 Case 460 To 461 Y_axis_L = 457 Case 462 To 463 Y_axis_L = 458 Case 464 To 465 Y_axis_L = 459 Case 466 To 467 Y_axis_L = 460 ' 100 Case 468 To 469 Y_axis_L = 462 65 Case 470 To 471 Y_axis_L = 463 Case 472 Y_axis_L = 464 Case 473 To 475 Y_axis_L = 465 ' 105 Case 476 To 477 Y_axis_L = 467 Case 478 To 479 Y_axis_L = 468 Case 480 To 481 Y_axis_L = 469 Case 482 To 484 Y_axis_L = 470 ' 110 Case 485 To 486 Y_axis_L = 472 Case 487 To 488 Y_axis_L = 474 Case 489 To 491 Y_axis_L = 475 ' 115 Case 492 To 493 Y_axis_L = 477 Case 494 To 495 Y_axis_L = 478 66 Case 496 To 498 Y_axis_L = 480 ' 120 Case 499 To 500 Y_axis_L = 482 Case 501 To 502 Y_axis_L = 484 Case 503 To 505 Y_axis_L = 485 ' 125 Case 506 To 507 Y_axis_L = 487 Case 508 To 509 Y_axis_L = 488 Case 510 To 512 Y_axis_L = 490 ' 130 Case 513 To 514 Y_axis_L = 492 Case 515 Y_axis_L = 494 Case 516 To 518 Y_axis_L = 495 ' 135 Case 519 Y_axis_L = 497 Case 520 To 550 '522 Y_axis_L = 500 ' 140 67 EndSelect EndIf Y_axis_L = Y_axis_L - 360 ' ZERO POINT '-------------------------------------' (-) DISTAL SCALING '-------------------------------------If Z_axis_L < 454 Then ' NEGATIVE DISTAL CONVERSION neg_distal = 1 Select Y_axis_L Case 2 Y_axis_L = 5 Case 3 Y_axis_L = 10 Case 4 Y_axis_L = 15 Case 5 To 6 Y_axis_L = 20 Case 7 Y_axis_L = 23 Case 8 To 9 Y_axis_L = 25 Case 10 68 Y_axis_L = 27 Case 11 To 12 Y_axis_L = 30 Case 13 Y_axis_L = 32 Case 14 Y_axis_L = 34 Case 15 To 16 Y_axis_L = 35 Case 17 Y_axis_L = 37 Case 18 Y_axis_L = 38 Case 19 To 20 Y_axis_L = 40 Case 21 Y_axis_L = 42 Case 22 Y_axis_L = 43 Case 23 Y_axis_L = 44 Case 24 To 25 Y_axis_L = 45 Case 26 To 27 69 Y_axis_L = 47 Case 28 Y_axis_L = 48 Case 29 Y_axis_L = 49 Case 30 To 31 Y_axis_L = 50 Case 32 To 33 Y_axis_L = 52 Case 34 To 35 Y_axis_L = 54 Case 36 To 38 Y_axis_L = 55 Case 39 To 40 Y_axis_L = 57 Case 41 To 42 Y_axis_L = 58 Case 43 To 44 Y_axis_L = 60 Case 45 To 46 Y_axis_L = 62 Case 47 To 48 Y_axis_L = 63 Case 49 To 50 70 Y_axis_L = 64 Case 51 To 52 Y_axis_L = 65 Case 53 To 54 Y_axis_L = 67 Case 55 To 56 Y_axis_L = 68 Case 57 To 58 Y_axis_L = 70 Case 59 To 60 Y_axis_L = 72 Case 61 To 62 Y_axis_L = 73 Case 63 To 65 Y_axis_L = 74 Case 66 To 67 Y_axis_L = 75 Case 68 To 69 Y_axis_L = 77 Case 70 To 71 Y_axis_L = 78 Case 72 Y_axis_L = 79 Case 73 To 74 71 Y_axis_L = 80 Case 75 To 76 Y_axis_L = 82 Case 77 To 78 Y_axis_L = 83 Case 79 To 80 Y_axis_L = 84 Case 81 To 82 Y_axis_L = 85 Case 83 To 84 Y_axis_L = 87 Case 85 To 86 Y_axis_L = 88 Case 87 To 88 Y_axis_L = 89 Case 89 To 120 '90 Y_axis_L = 90 EndSelect EndIf '-------------------------------------' (-) PROXIMAL SCALING '-------------------------------------If Y_axis_U > 360 Then neg_proximal = 1 Select Y_axis_U 72 Case 451 ' 80 Y_axis_U = 80 Case 449 To 450 ' 75 Y_axis_U = 75 Case 446 To 448 ' 70 Y_axis_U = 70 Case 445 Y_axis_U = 67 Case 443 To 444 ' 65 Y_axis_U = 65 Case 442 Y_axis_U = 63 Case 439 To 441 ' 60 Y_axis_U = 60 Case 437 To 438 ' 57 Y_axis_U = 55 Case 435 To 436 ' 55 Y_axis_U = 55 Case 433 To 434 Y_axis_U = 54 Case 432 Y_axis_U = 52 Case 430 To 431 ' 50 Y_axis_U = 50 73 Case 429 Y_axis_U = 48 Case 427 To 428 Y_axis_U = 47 Case 425 To 426 ' 45 Y_axis_U = 45 Case 423 To 424 Y_axis_U = 44 Case 421 To 422 Y_axis_U = 42 Case 419 To 420 ' 40 Y_axis_U = 40 Case 417 To 418 Y_axis_U = 38 Case 415 To 416 Y_axis_U = 37 Case 412 To 414 ' 35 Y_axis_U = 35 Case 410 To 411 Y_axis_U = 34 Case 408 To 409 Y_axis_U = 32 Case 405 To 407 ' 30 Y_axis_U = 30 74 Case 403 To 404 Y_axis_U = 28 Case 401 To 402 Y_axis_U = 27 Case 398 To 400 ' 25 Y_axis_U = 25 Case 395 To 397 Y_axis_U = 24 Case 393 To 394 Y_axis_U = 22 Case 390 To 392 ' 20 Y_axis_U = 20 Case 388 To 389 Y_axis_U = 18 Case 386 To 387 Y_axis_U = 17 Case 383 To 385 ' 15 Y_axis_U = 15 Case 381 To 382 Y_axis_U = 14 Case 379 To 380 Y_axis_U = 13 Case 377 To 378 Y_axis_U = 12 75 Case 374 To 376 ' 10 Y_axis_U = 10 Case 373 Y_axis_U = 8 Case 371 To 372 Y_axis_U = 7 Case 369 To 370 Y_axis_U = 5 '5 Case 367 To 368 Y_axis_U = 4 Case 365 To 366 Y_axis_U = 3 Case 362 To 364 Y_axis_U = 2 Case 361 Y_axis_U = 1 '-------------------------------------' (+) PROXIMAL SCALING '-------------------------------------Case 360 Y_axis_U = 0 Case 359 Y_axis_U = 1 Case 357 To 358 76 Y_axis_U = 2 Case 355 To 356 Y_axis_U = 3 Case 353 To 354 Y_axis_U = 4 Case 351 To 352 Y_axis_U = 5 '5 Case 350 Y_axis_U = 6 Case 348 To 349 Y_axis_U = 7 Case 346 To 347 Y_axis_U = 8 Case 344 To 345 Y_axis_U = 9 Case 342 To 343 Y_axis_U = 10 ' 10 Case 341 Y_axis_U = 12 Case 339 To 340 Y_axis_U = 13 Case 337 To 338 Y_axis_U = 14 Case 335 To 336 77 Y_axis_U = 15 ' 15 Case 333 To 334 Y_axis_U = 17 Case 331 To 332 Y_axis_U = 18 Case 329 To 330 Y_axis_U = 19 Case 326 To 328 Y_axis_U = 20 ' 20 Case 323 To 325 Y_axis_U = 22 Case 321 To 322 Y_axis_U = 24 Case 319 To 320 Y_axis_U = 25 ' 25 Case 316 To 318 Y_axis_U = 27 Case 314 To 315 Y_axis_U = 28 Case 311 To 313 Y_axis_U = 30 ' 30 Case 309 To 310 Y_axis_U = 32 Case 307 To 308 78 Y_axis_U = 34 Case 305 To 306 Y_axis_U = 35 ' 35 Case 303 To 304 Y_axis_U = 37 Case 301 To 302 Y_axis_U = 38 Case 299 To 300 Y_axis_U = 40 ' 40 Case 297 To 298 Y_axis_U = 42 Case 295 To 296 Y_axis_U = 44 Case 293 To 294 Y_axis_U = 45 ' 45 Case 292 Y_axis_U = 47 Case 290 To 291 Y_axis_U = 48 Case 287 To 289 Y_axis_U = 50 ' 50 Case 286 Y_axis_U = 52 Case 285 79 Y_axis_U = 54 Case 283 To 284 Y_axis_U = 55 ' 55 Case 282 Y_axis_U = 57 Case 281 Y_axis_U = 58 Case 278 To 280 Y_axis_U = 60 ' 60 Case 277 Y_axis_U = 63 Case 275 To 276 Y_axis_U = 65 ' 65 Case 274 Y_axis_U = 67 Case 271 To 273 Y_axis_U = 70 ' 70 Case 269 To 270 Y_axis_U = 75 ' 75 Case 268 Y_axis_U = 80 ' 80 Case 267 Y_axis_U = 85 ' 85 Case 266 80 Y_axis_U = 90 ' 90 Case Else Y_axis_U = 0 EndSelect Print At 1,1,"D=",DEC4 Y_axis_L," P=",DEC4 Y_axis_U," " If neg_distal = 0 And neg_proximal = 0 Then angle = Y_axis_L + Y_axis_U ElseIf neg_distal = 1 And neg_proximal = 0 Then If Y_axis_L > Y_axis_U Then angle = Y_axis_L - Y_axis_U Else angle = Y_axis_U - Y_axis_L EndIf ElseIf neg_distal = 0 And neg_proximal = 1 Then If Y_axis_L > Y_axis_U Then angle = Y_axis_L - Y_axis_U Else angle = Y_axis_U - Y_axis_L EndIf Else angle = Y_axis_L + Y_axis_U 81 EndIf If angle > 360 Then Clear angle ' angle = 0 Print At 2,1,"Angle= ",Dec angle,"'Deg. " DelayMS 310 If PORTB.6 = 0 Then SEND GoTo Loop SEND: DelayMS 1100 HSerOut [Dec angle] ' SEND ANGLE VALUE TO PC Print At 1,1," Data Sent! " Clear PORTA ' Clear portA Clear PORTC ' Clear portC DelayMS 1000 While PORTB.6 = 0 DelayMS 50 Wend Clear PORTA ' Clear portA Clear PORTB ' Clear portB Clear PORTC ' Clear portC Clear PORTE ' Clear portC 82 DelayMS 50 ' EndIf GoTo DISPLAY End 83 APPENDIX D (Datasheets) 84 PIC16F877A Data Sheet 85 86 87 88 89 90 91 92 93 94 95 96 ADXL335 Datasheet 97 98 99 100 101 102 103 104 105 106 107 ZigBee Module Datasheet 108 109 MAX232 Datasheet 110 111 112 113 114 115 L1682 Hitachi LCD Datasheet 116 117 118 119 120 121 122 123 124 LM7805 Datasheet 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 SPX2815 Datasheet 152 153 154 155 156 157 158 159 160 161 PC-Interfaced Goniometer for Knee and Elbow Joint Angular Measurements Using Accelerometer and ZigBee Technology Miguel Carlo P. Ang, Anthony Joe P. Melgarejo, Nikko L. Tamaña Analyn N. Yumang, Adviser BS in Computer Engineering – School of EECE, Mapua Institute of Technology Abstract— The main goal of the group is to design a device that addresses the drawbacks of using a common goniometer. The group presents in this documentation an alternative method for measuring human joint angles, specifically knee and elbow joint angles. The digital goniometer consists of two accelerometers, a digital signal processing element and a wireless communication component. Accelerometers are commonly used to sense leg or arm movement for monitoring the progress of the patient during rehabilitation. Joint angles are directly calibrated using the output of the accelerometers therefore angles displayed is similar to the common goniometer. The angles measured are then stored into the patient information database for ease of evaluation of the rehabilitation doctor. Index Terms— Goniometer, accelerometer, ZigBee Technology, wireless transmission I. INTRODUCTION Measuring the range of motion (ROM) is vital in rehabilitation medicine. Each specific joint has a normal range of motion that is expressed in degrees. Limited range of motion compared to the normal refers to a joint that has a reduction in its ability to move caused by injury, operation or diseases such as osteoarthritis, rheumatoid arthritis, or other types of arthritis. Pain, swelling and stiffness associated with the injury, operation and said diseases can limit the range of motion of a particular joint and impair function and the ability to perform usual daily activities. Devices used to measure the ROM of various joints in the human body are the goniometer and inclinometer. Both devices use a stationary arm, protractor, fulcrum and movement arm to measure angle from axis of the joint. The goniometer is used by rehabilitation doctors to measure ROM as a way to monitor a patient’s progress while undergoing physical therapy. This device aims to address the health and safety of a patient. In physical therapy and occupational therapy, a goniometer is an instrument which measures an axis and range of motion. If a patient experiences decreased range of motion in a joint (e.g a knee or elbow) caused by an operation or fracture, for example, the therapist can use a goniometer to assess what the range of motion is prior to intervention. Using the information produced by the goniometer, the therapist can monitor the range of motion after every therapy session. From this range of motion, the therapist is able to plan the appropriate exercise to achieve the target joint range of motion suitable for the mobility of the patient. It focuses on measuring the ROM of the elbow and knee joints. The angle measured using the device is displayed using a desktop computer or a laptop. The use of a computer also allows an adequate recording of the data for each patient using the device, which may be later analyzed with ease, precision and readability as compared to the conventional method. It is also much smaller in size compared to the electrogoniometer since it would only be attached to the patient’s leg or arm using straps. Due to its smaller size, it is easier for the physical therapist to set up the device and the patient is more comfortable during the measurement process. The device consists of two dual axis accelerometers, a digital signal processing element and a wireless communication component. The accelerometers are used to determine the angular position of the knee or elbow joint. The digital signal processing element calculates the joint angle. This information is then sent by ZigBee communication to a PC which displays the joint angle. II. REVIEW OF RELATED DESIGN LITERATURE AND STUDIES A related article entitled “Goniometer Based to Computer” from IEEE issued last April 5, 2004 designed a goniometer based to computer focused on the measurements of angles of the arms. The article discussed that universal goniometers are commonly used during physical assessments of patients under physiotherapeutical treatments, but the measurement accuracy is influenced by its own quality and also the differences among articulations being assessed. In order to ease the specialist’s work, a goniometer based to 162 computer fixed to the patient has been designed to give the angle of the arms, allowing a faster evaluation of the patient’s progress. The angle is measured using an optical encoder and its value is properly interpreted by the PC and presented on the monitor. The use of a computer also allows an adequate recording of data which may be analyzed with ease, precision and readability compared to the conventional method. Measuring Tilt with Low-g Accelerometers This application note describes how accelerometers are used to measure the tilt of an object. Accelerometers can be used for measuring both dynamic and static measurements of acceleration. Tilt is a static measurement where gravity is the acceleration being measured. Therefore, to achieve the highest degree resolution of a tilt measurement, a low-g, high sensitivity accelerometer is required. In measuring the angle, the change in degrees of tilt directly corresponds to a change in the acceleration due to a changing component of gravity acted on the accelerometer. In order to determine the angle of tilt, θ, the A/D values from the accelerometer are sampled by the ADC channel on the microcontroller. The acceleration is compared to the zero g offset to determine if it is a positive or negative acceleration. One solution can measure 0° to 90° of tilt with a single axis accelerometer, or another solution can measure 360° of tilt with two axis configuration (XY, X and Z), or a single axis configuration (e.g. X or Z), where values in two directions are converted to degrees and compared to determine the quadrant that they are in. . A tilt solution can be solved by either implementing an arccosine function, an arcsine function, or a look-up table depending on the power of the microcontroller and the accuracy required by the application. We included this paper as a reference in computing for the angle. The method included in this paper can serve as an alternative solution for the computation of the angle. Since the concept in computing the angle of tilt is roughly the same for our method (comparing values in different degree of tilt), we considered this article as a related literature. Furthermore, the solution presented in this article can serve as a backup to ensure that if the solution we used does not live up to its expectation or yielded poor test results, we can still use the solution in this article to fix the problem. ZigBee Technology The design will use the analog signals from the movement of the accelerometers and convert it into digital signal then transmit it using the ZigBee wireless technology. According to an article entitled “Networked Wireless Meter Reading System Based on ZigBee Technology” (Liting Cao, Wei Jiang, Zhaoli Zhang) from IEEE issued last July 2008 the ZigBee, namely IEEE802.15.4 technology standard is one of WPAN IEEE802.15 technology standard. ZigBee bend itself to realize a short distant double direction wireless communication protocol which is lower complexity, lower cost and lower speed. In this article the ZigBee technology was used to solve the problems existed in meter reading systems. The structure of the system employs distributed structure the measure meters, sensor nodes, data collectors, server and wireless communication network. For a short distance transmission the data collector collects data using ZigBee communication. Another article supports the use of wireless technology, the article which is entitled, “5.5mA 2.4-GHz two-point modulation ZigBee transmitter”, by Rui Yu ThengTee, Yeo Kwang-Hung, Tan Shouxian,MouYike, Cui Haifeng, Wang Hwa-Seng, and Yap Ting from IEEE issued last September 2009 describes that a 2.4-GHz two-point modulation IEEE 802.15.4 (ZigBee) compliant transmitter is presented. The sigma-delta fractional-N PLL based transmitter is optimized for both low-power and low-cost purposes. A novel closed-loop calibration scheme is proposed to minimize the gain mismatch between two modulation points, which is the main source of error in two-point modulation. With these articles, the group can say that ZigBee wireless Technology has advantages with the other RF modules with its low power consumption, low cost and has a wider range. PIC16F877A Microcontroller In an article entitled ¨Network model based automation of thermal processes using an embedded digital controller”, by Ganesh, A.B. Sangeetha, A.L. Ravi, V.R. issued last Dec. 2009 from IEEE, a microcontroller is used. The article describes the network architectures of both WAN and LAN based real time control and monitoring of thermal process station using an embedded digital controller. The function of the microcontroller in this design is a temperature controller that communicates directly with the temperature transmitter. The design uses the PIC16F877A microcontroller. The group’s design will use two microcontroller units, one for the transmitter and the other is for the receiver part. The article above shows that microcontrollers can interact with transmitters, thus it can also interact with receivers. Microchip Programmable Interface Controller (PIC) are popular with both industrial developers and designers due to their low cost, wide availability, large user base, and serial 163 programming (and re-programming with flash memory) capability. Different levels of on-board features are being associated to each type of microcontrollers. The smallest ones can add some simple automation to a project, while the huge devices have the capabilities of a microprocessor system, offering much more than simple control. III. DESIGN PROCEDURES This chapter discusses the procedures that were followed in the development of the design. This also includes the block diagram, schematic diagram and the system flow chart. Hardware Development Block Diagram TRANSMITTER Accelerometer Accelerometer (Upper Limb) (Lower Limb) MCU/ADC ZigBee Technology Schematic Diagram of the Transmitter with the Accelerometer, Microcontroller and Zigbee Module (See last page) Power is supplied by the 9v battery which is controlled by a switch. It passes through a diode which serves as a protection in case the battery is improperly connected. Then an op-amp then regulates the voltage to 3.3V which is to be used by the accelerometers. In parallel, another voltage regulator gives the 5V which the microcontroller and the LCD needs. The accelerometer outputs analog voltage which is connected to a debouncer circuit seen as a collection of capacitors to keep the voltage stable. The debouncer circuit stabilizes the voltage to be passed into the microcontroller since the accelerometer output is analog. The voltage then passes through a precision resistor, which is like a potentiometer that sets the reference voltage to be used by the ADC in the conversion from analog signal to digital. The conversion of the voltage and calculation of the angle is done inside the microcontroller. The output is passed to the LCD, which displays the output into readable text, and to the ZigBee, to be transmitted. Before the signal reaches the ZigBee, it passes through a voltage divider. Since the input voltage of the microcontroller is 5v, the output can reach 5V, which is a problem to the ZigBee. The ZigBee can only accommodate 3.3V, which explains the need for a voltage divider. 9V Battery Zigbee Module Schematic Diagram (Receiver Side) RECEIVER ZigBee Technology MAX232 COMPUTER Figure 3.1 System Block Diagram of PC-Interfaced Goniometer for Knee and Elbow Angular Measurements using Accelerometer and ZigBee Technology The system is composed of two divisions the transmitter and the receiver. The primary input of the system will be coming from the two accelerometers. From the figure, the accelerometers are connected to the MCU that interprets the analog signal then converts it into digital signal. The ZigBee Module will be responsible for the wireless transmission. The main output of the system is the angular measurement reading that is shown in the LCD attached to the device. The last block in the diagram represents the Computer to where the angular measurement is stored in the patient’s database. That completes the process of the designed system. (See last page) The signal is received by the receiver ZigBee. The signal is digital when it leaves the module. It then passes through MAX232 which amplifies the signal so no loss is incurred due to line resistance. The capacitors are needed as stated by its datasheet. The 5V supply came from the 1 st USB connection and is then regulated down to 3.3V which the IC needs. The signal is then passed through the serial-to-USB cable to send the data. Prototype Development The design procedure will show the step-by-step procedure on how the design was built. It will describe the detailed information about the conceptualization of the design project. 164 1. Conceptualization After knowing the design will work as a whole, the conceptualization of the transmitter and receiver part must be equated to simplify the design hardware and software. 2. Simplified design requirement It is also important to create initial drafting of materials required as the development of the project proceeds. This will give the researchers an overview of the project. 3. Illustrate the block diagram Defines the major composition of the design and shows how each block is related with each other. The block diagram for the transmitter consists of the Microcontroller Unit (MCU), Accelerometer for Upper Limb, Accelerometer for Lower Limb, Wireless technology using ZigBee, and 9V Battery. The block diagram of the receiver consists of the ZigBee technology, MAX232 and Computer. 4. Draw schematic diagram Schematic diagram of this design shows how each device was interconnected. It contains major components such as the Microcontroller Unit (MCU), Accelerometer for Upper Limb, Accelerometer for Lower Limb, Wireless technology using ZigBee, and 9V Battery for the transmitter. On the other hand, the receiver of the system uses components such as the wireless technology using ZigBee Module and the Computer. In developing the design, the following materials are used each with its brief discussion: PIC16F877A This type of microcontroller is used in the design primarily because of its many inputs. PIC16F877A has a maximum of 40 I/O pins which is very much suitable for the design. It has a maximum of 256 bytes for its register which is also much appropriate for the design to be possible. It also has built – in UART (Universal Asynchronous Receiver Transmitter) that can communicate with peripheral devices such as personal computers or laptops. Max232 The MAX232 is a dual driver/receiver that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits and vice versa. MAX232 operates at 5V DC input voltage and connected to Vs pin of the IC. The MAX232 IC is used to interface the central computer and the Zigbee module in the receiver side. HD44780U (LCD) The HD44780U dot-matrix liquid crystal display controller and driver LSI displays alphanumerics, Japanese characters, and symbols. It can be configured to drive a dotmatrix liquid crystal display under the control of a 4- or 8-bit microprocessor. The HD44780U character generator Rom is extended to generate 208 5x8 dot character fonts and 32 5x10 character fonts for a total of 240 different character fonts. The low power supply (2.7V to 5.5V) of the HD44780U is suitable for any portable battery-driven product requiring low power dissipation. ADXL335 (3-axis Accelerometer) The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal conditioned voltage outputs. ADXL335 measures acceleration with a minimum full-scale range of g. It can measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion, shock, or vibration. In the design, it is used as a motion sensor. IV. TESTING, PRESENTATION AND INTERPRETATION OF DATA This chapter presents various tests performed by the designers to determine the effectiveness of the design. The tests are conducted with relevance to the design objectives. Wireless Technology using ZigBee Signal Range Test ZigBee Wireless Technology The ZigBee technology was used because it has greater range and it is widely used in today’s wireless technology. The group used this because of its low consumption of power and wide range of transmission. The researchers conducted a signal range test to determine the capability of the wireless technology. The testing was done in an area wherein the receiver is in line of sight and a few meters away from the transmitter. The following table shows the results gathered based on the signal range test. 165 TRIAL 1 2 3 4 5 10m Good Good Good Good Good 20m Good Good Good Good Good 30m Good Good Good Good Good 40m Good Good Good Good Good 50m Poor Poor Poor Poor Poor The designers tested the wireless proximity within 10m – 40m range. Even if it is only designed for clinical use with very close proximity which commonly has an area of 5 sq. m, the designers decided to test the full capability of the Zigbee in case it is necessary for larger proximity use. The results show that within 40m, the data transmission is good which means that there is no delay and the sent data is correct. In a distance of 50m, the data transmission is poor meaning that there is no received data. Accelerometer Output Scale Test In this test, there will be four tables presented. These are for the positive and negative distal and positive and negative proximal scaling. The values presented in these tables are analog to digital conversions which are outputs from the accelerometers with corresponding angle measurements from the goniometer. TRIAL 1 2 3 4 5 1° - 5° 362 362 362 362 362 6° - 10° 363 363 363 364 364 11° - 15° 364 364 365 365 365 16° - 20° 366 366 366 366 368 21° - 25° 369 369 369 369 371 26° - 30° 372 372 372 372 376 31° - 35° 377 377 378 378 380 36° - 40° 381 381 381 381 383 41° - 45° 384 386 386 386 389 46° - 50° 390 391 392 393 395 51° - 55° 396 397 397 398 402 56° - 60° 403 404 405 405 408 61° - 65° 409 410 411 412 415 66° - 70° 416 417 419 419 422 71° - 75° 423 423 425 426 76° - 80° 430 430 432 433 81° - 85° 437 438 440 86° - 90° 445 446 91° - 95° 452 96° - 100° Based on the scaling test, the accelerometer's output is not evenly distributed with every tilt. Small angles from 0° to 20° in some cases have a few discrepancies but these are negligible as this range is small for clinical observations. Precision Test TRIAL 1 2 3 4 5 0° 0° 0° 2° 0° 1° 10° 0° 7° 0° 10° 15° 20° 18° 20° 21° 20° 18° 30° 30° 31° 29° 30° 30° 40° 39° 40° 40° 41° 39° 50° 51° 52° 50° 49° 50° 60° 59° 61° 61° 60° 60° 70° 71° 70° 70° 70° 69° 80° 82° 79° 81° 80° 79° 90° 90° 89° 90° 91° 91° 100° 101° 101° 100° 100° 101° 110° 109° 111° 110° 110° 110° 120° 120° 120° 120° 120° 120° 130° 129° 130° 130° 131° 130° 140° 140° 140° 140° 139° 140° Precision Testing was conducted by the designers to verify the reliability of the design's angle measurements. As seen from the results and in reflection to the Accelerometer Output Scale Test, small angles from 0° to 20° have discrepancies but as stated earlier these are negligible. There is also a ± 3 tolerance in the angle measurements but these are not a problem because the purpose of the design is to monitor the improvement of the patients' joints' range of motion, not the accuracy of measurements. Overall, the design's measurements are precise, nonetheless. Output Test TRIAL 1 2 3 4 5 0° 0° 0° 0° 0° 0° 10° 10° 10° 10° 10° 10° 429 20° 20° 20° 20° 20° 20° 436 30° 30° 30° 30° 30° 30° 441 444 40° 40° 40° 40° 40° 40° 448 448 451 50° 50° 50° 50° 50° 50° 453 455 457 459 460 461 463 465 467 60° 60° 60° 60° 60° 60° 101° - 105° 468 469 471 472 475 70° 70° 70° 70° 70° 70° 106° - 110° 476 477 479 481 484 80° 80° 80° 80° 80° 80° 111° - 115° 485 486 487 488 491 90° 90° 90° 90° 90° 90° 116° - 120° 492 493 495 495 498 100° 100° 100° 100° 100° 100° 121° - 125° 499 500 501 502 505 126° - 130° 506 507 509 509 512 131° - 135° 513 514 514 515 518 136° - 140° 519 519 524 532 538 110° 110° 110° 110° 110° 110° 120° 120° 120° 120° 120° 120° 130° 130° 130° 130° 130° 130° 140° 140° 140° 140° 140° 140° 166 The results show that the data transmission is perfect given that the transmission range is within 40m. Whatever the reading is in the goniometer when the 'Send' button is pressed, the ZigBee will send and receive the correct data. Then, the PC interface will output the transmitted data if the 'Record' button is clicked. V. CONCLUSION AND RECOMMENDATION This chapter contains the general conclusion of the development of the design in relation to its objectives. The results of the various tests performed should also be clearly defined in this chapter. Recommendation for the improvement of the design is also stated in this chapter. CONCLUSION In the design PC-Interfaced Goniometer for Knee and Elbow Joint Angular Measurements Using Accelerometer and ZigBee Technology, the designers were able to develop a device that addresses the drawbacks of using a common goniometer. The design is incorporated with ZigBee Technology in transmitting the captured data from the accelerometers and receiving the data to be stored in the Patient Information database. The software serves as the database where the patient’s information and angle measurements are stored. systems other than the Windows platform such as Linux to provide software portability. References Barreiro, M.S. Frere, A.F. Theodorio, N.E.M. Amate, F.C. (2004). Goniometer Based to Computer, Engineering in Medicine and Biology Society Journal, IEEE Jeong-Whan, Lee Lee-Yon, Hong Jae-Hoon (2007). A Simple Optical Angular Sensors to Measure the Human Joint Angle, SICE-ICASE, IEEE Donno, M. Palange, E. Di Nicola, F. Bucci, G. Ciancetta, F. (2008). A New Flexible Optical Fiber Goniometer for Dynamic Angular Measurements: Application to Human Joint Movement Monitoring, Instrumentation and Measurement, IEEE Transactions Liting C., Wei J., Zhaoli Z. (2008). Networked Wireless Meter Reading System Based on Zigbee Technology. Wireless Technology, IEEE, page(s): 3455 C. C. Norkin, D.J. White (2003). Measurement of Joint Motion: A Guide to Goniometry, 3rd Edition, F.A. Davis Company, Philadelphia RECOMMENDATION The researchers suggests replacing ZigBee with other wireless technology that offers more features such as lower power consumption and wider range of data communication. It is suggested to add further enhancements to the software where implementation of the accelerometer will enable the user to achieve more accurate readings in any orientation possible. Also, it is suggested to make it the device flexible in terms of functionality by making it possible for the device to measure other human joints as well. Other than using the computer desktop or laptop as the information storage, it is suggested to use a Personal Digital Assistant (PDA) or other handheld devices such as iPad and iTouch to make the device more portable. The researchers also recommend performing further research to make the application run on other operating 167 Schematic Diagram of the Transmitter with the Accelerometer, Microcontroller and ZigBee Module ZigBee Module Schematic Diagram (Receiver Side) 168