Top Banner
TELEMEDICINE PLATFORM By Neetika Malhotra Bharat Poddar Sreenivas Rao Belavadi Satish ECE 445, SENIOR DESIGN PROJECT SPRING 2010 TA: Kieran Levin Date: 05/05/2010 Project No. 34 1
35
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: TABLE OF CONTENTS

TELEMEDICINE PLATFORM

ByNeetika Malhotra

Bharat PoddarSreenivas Rao Belavadi Satish

ECE 445, SENIOR DESIGN PROJECTSPRING 2010

TA: Kieran Levin

Date: 05/05/2010

Project No. 34

1

Page 2: TABLE OF CONTENTS

I. ABSTRACT

Our telemedicine platform is a user-friendly biometrics-measuring unit. It includes peripherals to measure ECG (Electrocardiogram), body temperature and Blood Pressure. It wirelessly transmits the data to the nearby doctor for medical support. The usage of the GSM network for transmission enhances the flexibility of usage. Since cellular technology is very common, GSM enables providing service in remote areas. The data transmitted to the doctor is encrypted to maintain the privacy of the patient. The estimated cost of a currently available fully functional unit ranges above $799. The existing devices in the market are used only in private networks such as hospitals and clinics. We aim to provide a cheaper option by simplifying the circuit to a lower cost and hence being able to provide the same to common household.

Apart from the exorbitant cost of health care, a lot of time and resources are spent by frequent hospital visitors on general check-ups including ECG and blood pressure. A system that can be used as effectively to monitor health and keep the doctor up to date might prove useful to lower expenses and save time.

2

Page 3: TABLE OF CONTENTS

II. TABLE OF CONTENTS

1. INTRODUCTION....................................................................................................................41.1 Usefulness..................................................................................................................................................... 41.2 Project functions........................................................................................................................................ 41.3 Subprojects................................................................................................................................................... 4

2. PERIPHERALS..................................................................................................................................................... 72.1 ECG................................................................................................................................................................... 72.2 Blood Pressure......................................................................................................................................... 122.3 Temperature............................................................................................................................................. 14

3. MICROCONTROLLER.................................................................................................................................... 163.1 Architecture and Programming........................................................................................................163.2 Software Designing and Testing.......................................................................................................183.3 Problems Encountered.........................................................................................................................20

4. GSM MODULE................................................................................................................................................... 204.1 Design Procedures..................................................................................................................................204.2 Design Details........................................................................................................................................... 214.3 Testing......................................................................................................................................................... 224.4 Encryption and Decryption................................................................................................................23

5. COST..................................................................................................................................................................... 255.1 Parts.............................................................................................................................................................. 255.2 Labor............................................................................................................................................................ 25

6. CONCLUSIONS................................................................................................................................................. 26

REFERENCES

3

Page 4: TABLE OF CONTENTS

1. INTRODUCTION

We had proposed to build a telemedicine platform for our senior design project. The goal of this project was to design a system that would record the biometrics of a patient and send them to a doctor as an email attachment. We had planned to make a low cost device for assistance in remote areas with no medical facilities. The biometric units that we implemented for our project are:

1. Electrocardiograph (ECG)

2. Blood Pressure/ Heart rate

3. Temperature

1.1 USEFULNESS

With the increasing cost of health care throughout the world, it is very important to provide general health care facilities to patients who need continuous monitoring by a doctor. We designed this platform to eliminate a patient’s need of going to the hospital on a regular basis for a check-up such as blood pressure and ECG and cut out on these expenses. Our project would benefit people in the remote areas who have no or very little access to medical facilities and require immediate attention in case of emergency.

1.2 PROJECT FUNCTIONS

1. Wirelessly transmits biometric measurements using GSM technology.2. Accurate biometric measurement.3. GSM compatible with AT&T and T-mobile SIM cards.4. Uses ultra-low power micro-controller.5. Runs on one D (9V) battery.6. Data encryption before transmission.

1.3 SUBPROJECTS

Our project consists of the following units:1. BV513 PIC 32 micro controller

2. Hardware for all biometric measuring units

Electrocardiogram (ECG)

Blood Pressure

Temperature

3. GSM unit for data transmission

4

Page 5: TABLE OF CONTENTS

1.3.1 BLOCK DIAGRAM

5

PIC 32MX340F512

Wireless Transmission Unit

Web Server

BV513

I/OPORT

3V3

Micro SD Card

Temperature

ECG

Blood Pressure

GM862

Sim Card Slot

Figure 1: Block Diagram

Page 6: TABLE OF CONTENTS

1.3.2 GENERAL DESCRIPTION OF BLOCK DIAGRAM

1.3.2.1 BV513 Development board: The BV513 is a development board for the PIC32. It has easy to use jumpers for all its pins and is interfaced with useful peripherals like a micro SD card and USB. It can be programmed using PIC32-Basic via a simple terminal emulator on a PC. The option of providing power through external supply gives it a good degree of flexibility.

1.3.2.2 Peripherals: 1. ECG:

Electrocardiograph or ECG is used to interpret the electrical activity of heart over time. It is useful for doctors to understand any heart related problem in patients. It is captured and externally recorded by skin electrodes. For our purpose we used three Ag-Cl disposable electrodes, instrumentation amplifier and a low pass filter to capture the heart activity. The data collected from the ECG unit is sent to the ADC (Analog to Digital Converting) channel of BV513 PIC for sampling and storing in a txt file on SD card that is further sent to GSM module for transmission as email attachment.

2. Blood Pressure:

Our blood pressure unit uses a bulb and cuff system. It is measured at the patient’s upper arm. We used a pressure sensor and stethoscope to record the patient’s BP. Blood pressure is the force exerted by circulating blood on the walls of blood vessels. During each heartbeat, the blood pressure varies between a maximum and a minimum. It is useful for doctors in administrating medicines and curing BP related medical problems. The data we collect from the blood pressure unit is sent to the input/output port of PIC for calibration and storing in a txt file on SD card that is again sent to GSM module for transmission as email attachment.

3. Temperature:Body temperature is very important for doctors in determining any infections or other common diseases. We built our temperature unit using a simple temperature sensor. The voltage from this unit is calibrated and converted to temperature reading in PIC using the input/output channel. The temperature reading is then stored in a txt file on SD card and sent to GSM for transmission as email attachment.

1.3.2.3 GSM Module:

6

Page 7: TABLE OF CONTENTS

The Telit GM 862 is used to transmit data wirelessly to the FTP server using a SIM CARD on the GSM network. The supply voltage for the GSM is 3.8V and each pin has a 2.8 V input/ output voltage range. The need for the GM 862 comes from the fact that it is more convenient to integrate it with the PIC than other available modems at such a price. Moreover, programming is not such an issue as the set of instructions is made into set of strings to be sent from the PIC once the flow control is attained.

2. PERIPHERALS

2.1 ECG (Electrocardiograph)

2.1.1 Design procedure:

ECG unit was the hardest to implement among all peripherals. The basic block diagram that we proposed for this unit is as in Figure 2:

Brief description of what we had proposed:

1. The electrodes convert ECG into electrical voltage. The voltage is in the range of 1mV to 5mV. For our system we are using AgCl disposable electrodes. Once the electrodes convert the ECG into electrical voltage, the voltage can be fed into an instrumentation amplifier, and then be processed.

2. The second stage is the instrumentation amplifier. We are using AD624 with a high gain and CMRR for amplifying the voltage.

3. A low pass filter is implemented to allow frequencies in the range of 0.04Hz to 150Hz. and remove all other noise from the signal.

We considered a lot of design options for the amplifier stage and the filter stage. We first implemented an instrumentation amplifier with op-amps and resistors. The circuit we designed was as in Figure 3:

7

AmplifierAmplifier Low Pass

FilterLow PassFilter

ElectrodeElectrode

To PIC

Figure 2: ECG Block Diagram

Page 8: TABLE OF CONTENTS

Figure 3: Instrumentation Amplifier

However, we were unable to get the desired gain with this configuration and also the output was a bit noisy. We then shifted to AD624 for amplification, as it is a high precision, low noise instrumentation amplifier. We initially set AD624 to give us a gain of 1000. We used the settings as in Figure 4:

Figure 4: AD624 with gain = 1000

With the above connections we were getting a clipped output, as the gain was too high for the output voltage. We then changed our design to have a gain of 200. The final circuit we implemented for the amplification stage was as described in Figure 5:

8

Page 9: TABLE OF CONTENTS

Figure 5: AD624 with gain= 200

For the filter stage, we had implemented a band pass filter by cascading a low pass and a high pass filter. One of the major sources of noise was the DC power supply. Due to the constant noise of 60Hz, we implemented a simple low-pass filter which did not eliminate all the noise, but provided a good filtered signal. After many changes in the filter, we finally implemented a low pass filter as in Figure 6:

Figure 6: Low Pass Filter

9

Page 10: TABLE OF CONTENTS

2.1.2 Design details and testing:

The circuit we implemented for ECG is as in Figure 7:

Figure 7: ECG Schematics

We measure the ECG by connecting two electrodes on the right and left wrist of the patient.  The body should be connected to ground of the circuits, so we connected the leg to the ground. The electrical voltage from the electrodes goes into the first and second pin of AD624. We choose Analog Device AD624 instrumentation amplifier to amplify the ECG voltage from electrodes, which is in the range of several mV.The AD624 is set up with gain of 200, and is supplied by +9 V and -9V battery power. We use ICL7660S chip to provide -9V to the AD624. A very high CMRR is very essential for Instrumentation Amplifier.  The small ac signal voltage (less than 5 mV) detected by the sensor on the electrodes will be accompanied by a large ac common-mode component (up to 1.5 V) and a large variable dc component (300 mV).  Setup we used to get -9V from ICL7660S chip is shown in Figure 8:

10

Page 11: TABLE OF CONTENTS

Figure 8: ICL7660S connection

The ECG we get from our design is as shown in Figure 9:

11

To AD624

Page 12: TABLE OF CONTENTS

Figure 9: ECG output

For testing the ECG we sent the waveform output to a doctor. We received reply saying that the ECG waveform was correct and heart activity could be predicted with such a waveform.

2.2 Blood Pressure2.2.1 Design Procedures:

We used bulb and cuff method for measuring blood pressure. The block diagram for this unit is as in Figure 10:

For our unit we used MPX2050 as pressure sensor, which we attached to one of the tubes on the cuff. MPX2050 has a high sensitivity of 0.8mV/kPa. The differential voltage output of sensor is directly proportional to the differential pressure applied. Our design involves following steps:1. Pump air into the cuff till 180mmHg. is reached.

12

Bulb/CuffBulb/Cuff Pressure SensorPressure Sensor

Instrumentation AmplifierInstrumentation Amplifier

Figure 10: Blood Pressure Block Diagram

Page 13: TABLE OF CONTENTS

2. Once tight stop pumping and release the air.

3. When patient hears the first beat through stethoscope, he presses a button. The voltage at that time gets recorded in the PIC.

4. The patient again presses the button when he stops hearing the beat. This voltage is also recorded by the PIC.

The two values recorded are the high and low points of blood pressure. These are calibrated and converted to mmHg pressure in the PIC using simple calculations discussed in design detail section.As the person keeps pumping air into the cuff the pressure increases and likewise the output voltage drop supplied to the PIC increases. The voltage corresponding to 180mmHg is 1.8V at the output supplied to the PIC. As the pumping of air into the cuff is stopped the pressure begins to drop and slowly reaches the systolic pressure. MPX2050 produces an oscillating voltage when this pressure is acquired. This is why there are two outputs one to denote the 1.8V threshold and the other to denote the beginning of oscillations. This is the first reading the PIC 32 records. Now as the pressure begins to drop, at one point the oscillating voltage is stopped and the voltage is dropped back to DC but now at a lower value, as the pressure is no longer 180mmHg. The point where the oscillations stop or the ac current is no longer received gives the second reading.There are a number of alternate ways of designing a blood pressure module. One of the designs that we were considering involved using two sensors. One sensor would be used for measuring pressure and the other for heart rate. Once the sensor captures heart rate, it would send a signal to PIC to indicate that high blood pressure point is reached and it should read the value from the pressure sensor. Similarly for low point, the sensor would send a signal to the PIC. This was an easier design in terms of use, as the user will not have to do things manually. However, we would need a highly sensitive sensor for recording the heart rate. This sensor was expensive as opposed to using a stethoscope and one pressure sensor. Since our main aim was to reduce the cost of the module, we decided to use our original design.

2.2.2 Design details and testing

The schematic for blood pressure is as shown in Figure 11:

13

Page 14: TABLE OF CONTENTS

Figure 10: Blood Pressure Schematics

As already explained we used bulb and cuff method for measuring blood pressure. The pressure sensor we used is MPX2050. The output voltage of the sensor is fed into the instrumentation amplifier, which amplifies the voltage and sends it to the PIC for calibration.For Figure 12, let R1= R2= R3= R4= R5= R7= R= 100KGain equations for instrumentation amplifier:

Gain= 1+(2R/R6) (1)

For our design we chose R6=1K and R= 100K. Thus from Equation 2 we get:Gain= 1+(200000/1000) ≅ 200

This gain was enough to get an accurate BP reading. The voltage produced by amplifier was sent to the input/output channel of PIC where it was calibrated. We used sphygmomanometer to calibrate blood pressure. From the sphygmomanometer we got 180mmHg = 1.8V. So we devised the following equation to convert voltage from sensor into pressure reading:

BP= Vout/1023*180 mmHg (2)We divide Vout by 1023 to get a voltage reading from digital data stored in PIC. PIC has a precision of 10 bits and so every reading in the PIC needs to b divided by 1023 to get back the original data.

For testing the blood pressure unit we used a sphygmomanometer to check the pressure reading. Once we checked the reading we saw the corresponding voltage. The pressure to voltage relationship was found to be linear. At 180 mmHg we observed 1.8V, at 120 mmHg it was 1.2V and at 80mmHg it was 0.8V. Hence, the sensor had a linear pressure voltage function as specified in the datasheet.

2.3 Temperature 2.3.1 Design Procedure:

The Temperature unit was easiest in terms of design, as it required only one temperature sensor. We used a highly sensitive LM235 sensor with a typical sensitivity of 10mV/0K. This unit required no amplification, as the response from the sensor was extremely good. For calibration purpose

14

Page 15: TABLE OF CONTENTS

and setting a reference voltage and temperature we used a 10K potentiometer. We adjusted the potentiometer in a way that sensor gave an output of 2.83V at 250C or 298.15K. We set this as reference to calculate the body temperature according to simple mathematical calculation discussed in Design Detail section. The basic design structure we followed for measuring temperature is as in Figure 12:

We were initially using AD592 as temperature sensor. However it was not very sensitive to temperature change. It was giving a current change of about few micro amps for every degree Celsius. The design we had with AD592 was as in Figure 13:

Figure 11: Temperature circuit with AD592 thermistor

The gain that we were getting was also not enough to maintain the accuracy. The gain according to our design was: 1+ (R2/R1) = 1+ (100/10) = 11 (3)

Even after increasing our gain we could not get the desired response. So we then decided to use LM235 as it was a more sensitive thermistor and required no amplification. It was also less expensive than the above design.

15

Temperature SensorTemperature Sensor

PICPIC

Potentiometer to calibrate the sensor

Potentiometer to calibrate the sensor

Figure 12: Temperature Block Diagram

Page 16: TABLE OF CONTENTS

2.3.2 Design details and testing:

As mentioned earlier we used LM 235 precision temperature sensor to provide a voltage corresponding to temperature input. Figure 14 is the schematic diagram for the temperature circuit:

Figure 12: Temperature Schematic

The temperature sensor has three pins Adjustment, V+ and a V- pin . The V+ pin is connected to the supply voltage end; the V- pin is connected to the Ground. The Adjustment is connected to the potentiometer adjustment. We use a 10K potentiometer and resistor R1 = 10K ohm. The temperature sensor is active in the temperature range of -40 to 1000C. The human body temperature, which is about 370C falls well between this range. The voltage supplied is 9V and is not directly connected to the sensor. There is a resistor R1 supplied for the safety of the device. Initially, the temperature – voltage ratio needs to be calibrated. As already explained in design procedure, we supply the necessary voltage to the circuit and tune the potentiometer to get 2.83V at 298K or 25 0C.Once calibrated, the sensor is now ready for any temperature measurement. It is to be noted that the linear relationship is assumed as given on the datasheet of LM 235. When the sensor is introduced to any object, voltage increases from VoutT0 to VoutT. We use Equation 3 to calculate the temperature: T=VoutT/VoutTo X TO (4)

Where VoutT = Output voltage at unknown temperature TVoutTo = Voltage at known temperature T0 (298K)T0 = Known Calibrated TemperatureT= Unknown temperature

16

Page 17: TABLE OF CONTENTS

So if the body temperature is 310K or 98.40F, output voltage we will get: VoutT = 310/298.15 X 2.83 = 2.96V

3. MICRO-CONTROLLER

3.1 Architecture and Programming:

Our designs required a micro-controller that was powerful enough to process and store the data at a considerable speed. PIC32 is a high performance 32-Bit MCU. The PIC is one of the simplest and cheapest micro-controllers available in the market. It is built upon the Harvard architecture, in which instructions and data come from different sources. This improves the MCU’s performance in areas such as clock speed and power consumption. It works at a clock speed of 80 MHz owing to its single cycle multiply and divide architecture. It can be easily programmed using Microchip’s MPLAB Development Environment. The PIC32 compilers are based on the GCC compilers. It also has a 32K RAM and 512K Flash memory.

Our application required a large amount of storage for the peripheral data files. We came across the BV513 development board for the PIC32 (PIC32MX340F512H). The BV513 is an evaluation board based on the PIC32. A certain Jim Spence from the United Kingdom makes these boards. Apart from the benefit of providing on-board jumpers for the micro-controller’s pins, it also has a micro SD card interface. It had been successfully tested to be compatible with 2GB micro SD cards. The BV513 can be connected to a host PC through a USB. It is programmed using the PIC32-Basic interpreted language. There are certain advantages and disadvantages in using BASIC instead of C. BASIC give us the flexibility in that all actions are interactive. This product works via a simple terminal emulator and needs no special software. It has 16 10-Bit ADC channels that can work at maximum clock speed of 40 MHz. A connector layout diagram of the BV513 is shown below in Figure 15.

17

Figure 15: Component layout Diagram

Page 18: TABLE OF CONTENTS

The ADC channels are all connected in the JP3 while the general input/output pins are connected to JP4, JP5 and JP6. JP8 connects to the PIC’s UART ports. While connected to a PC, the device draws power from the USB. It can be connected to external DC power supplies and has on-board voltage regulators to allow a supply of anywhere between 5V and 10V. The standard board is fitted with sockets that take 2x8 pin connectors and can be amounted over any standard prototype board. The FT232RL chip provides the USB interface and the driver required is the Virtual Com driver, which creates a virtual COM port. There is a micro SD cardholder built onto the PCB and is wired through the SPI2 interface. The software contains two layers, boot and the Micro-BOS. The Micro-BOS is a layer that sits between the boot and the application layers. It is compatible with the FAT16 disk format. The PIC32 memory layout is shown below in Figure 16.

The application works on top of this layer. When the system is booted properly, it responds with ‘ok’ on the host terminal. One of the other important features of the PIC32 is scheduling. Processes such as scanning input pins for switches can be scheduled to run at specific intervals. Some subroutines are more useful if they can be made to monitor events or be made to run every so often.

The built in ADC in the PIC has 16 channels with 10-bit (0 to 1023) resolution. Opening an ADC channel disables the digital I/O and sets the port to be an input. It can work at a maximum speed of 1.5s and an additional time of 1.5s for conversion. Since we required relatively slower sampling rates (around 250Hz), we chose to operate the ADC channels at 48s (including conversion time), which is the slowest the BV513 firmware architecture can offer.

The more recent firmware for the BV513 also supports C code plug-ins. C snippets can be compiled using Microchip MPLAB IDE and called through the PIC32-Basic using a memory mapper. Unfortunately, this feature is a relatively new addition and has a lot of bugs. It is also a very complicated process to generate a useful C plug-in.

BASIC offers the input and print statements, but these are a bit too restrictive for microcontroller use. All the input and output are done through the Universal Asynchronous Receiver and

18

Figure 16: Memory Layout Diagram

Page 19: TABLE OF CONTENTS

Transmitter (UART). The PIC32 has two UART ports and are software buffered, with 128 bytes each. Hardware Flow Control options are also easily available.

Working with files: The ‘function’ is the basic unit of BASIC. A program is a collection of user functions that will ultimately lead to the main function that runs the program. This enables each ‘function’ to be tested before adding to the main program. A function can be written directly on the console if required. Alternatively, they can be written in a file (.bas extension) and saved in the flash or the SD card. They can also directly be executed from the RAM, but may be erased in case of a power cycle or by resetting the RAM. A file saved on the SD card or the flash memory can be loaded onto the RAM and executed.

3.2 Software Design and Testing:

Our goal was to provide the user with an easy to use and hassle-free software interface. Since we did not have any kind of display interfaced with the module, it was necessary to provide instructions to the user through LEDs. Since the BASIC language is built around user functions, it was relatively easy to write and debug different functions. We decided to have different functions regulating different peripherals to improve the system modularity and make debugging easier, which can generally be very difficult in the case of interpreted languages. General I/O pins can be used to read in switch status and regulate LEDs. Individual bits of the I/O ports can be configured to be used either as input or output. All ports from c through g (51 bits in total) are 5V tolerant. Port b pins, which also serve as the ADC channels are 3.3V tolerant. Our software design was controlled by a main function that initializes startup functions and variables apart from scheduling repetitive tasks.

The ADC channels are read according to user input through push buttons. The main function schedules the switch_scan function to scan for buttons continuously. Once the input is determined, the appropriate function is called. The main program was divided into the following parts:

1. Function ‘auto’This is the main function of the program. It initializes the ‘init’ function used for port setup. It also schedules the process_get function for execution every 50ms.

2. Function ‘init’A total of five inputs and four outputs were set for push buttons and LEDs respectively. It also schedules the switch_scan function to execute every 30ms.

3. Function ‘switch_scan’Five push buttons were interfaced to the general I/O pins. The switch_scan function scanned these pins for user input. It was scheduled to run every 30ms. Once a switch is pressed, a global variable is set as an indicator to determine which operation is to be performed.

4. Function ‘process_get’This function calls the appropriate peripheral function depending on the button pressed. It is scheduled for every 50ms.

The peripheral functions were similar in their data flow. First, the appropriate ADC channel was opened. It was then read at a sampling interval of 48s (including conversion time). In case of ECG, the data was encrypted and continuously written in a text file. For the blood pressure and

19

Page 20: TABLE OF CONTENTS

temperature functions stored only the relevant data, which encrypted before being written on their respective text files. The text files were then stored on the SD card.

A separate function for communicating with the GSM module was also written. This function first initializes the UART port for serial communication at 9600 baud. AT commands were then sent to the GSM module with hardware handshaking to detect inputs and outputs. It was very essential to ensure that the PIC and the GSM communicated at the same baud rate. For this, the test command ‘AT’ was sent a few times until the GM862 responds positively.

An example of a dummy function with a few features is shown below:

function dummysetport “d0” as input //set d0 as inputopenadc 31 1 // open ADC 1 with 48s sampling intervalfn=openfile(“ex.txt”,’w’) //open file ex.txt in write modedim z%=port(“d0”) //read port d0 into z%dim x#if z%=1 then // if switch pressed, read data and write to ex.txt

x#=adc(1)write$ fn x#

endifclosefile(fn)

endf

The peripheral function could all be tested and debugged separately. Some problems encountered with these functions included failure in opening files and writing data to them. It was during integration of the entire program that more serious bugs were identifies. One of our main problems was in scheduling tasks. When task is scheduled, it must be ensured that the execution time of the process is smaller than its scheduled time. If not, the system hangs up and needs a reset. Another bug we identified was related to waiting in an ideal loop that might hinder the execution of a scheduled task. Since we had a couple of tasks scheduled to run at relatively short period of intervals, it was difficult to judge the flow of the program and the execution time of each function under different circumstances had to be taken into account. We also had to ensure that our application executed whenever the system was switched on using an external power supply. For this purpose, the BV513 firmware searches for a file named auto.bas in the flash and the SD card. If this file is found, it is loaded onto the RAM and executed. Stored data in ecg.txt:

20

Page 21: TABLE OF CONTENTS

3.3 Problems encountered:

The BV513 assigns its general I/O pins as either inputs or outputs randomly during boot up. Unfortunately, due to some unknown problem, we could not make the BV513 set its I/O ports as we required and we could not demo our project with the integrated user interface. Nevertheless, the ADC channels were working fine and we could read in and store data.

21

Figure 17: Stored data in ECG.txt (sample)

Page 22: TABLE OF CONTENTS

4. GM682 (GSM MODULE)

4.1 Design Procedures:Our goal was to transmit the data from the PIC somehow to a client server accessible by a doctor. The first solution was to send data as an email on a computer by having a USB connection from the PIC to the computer; a simple data transfer could accomplish the same. It seemed to be of less usage in remote areas, and the limitations extended with the need of having a computer for data transmission.

Our second alternative was to integrate the PIC with the cell phone and have data transmitted through the data network. This required intensive reverse engineering of the phone if we weren’t using the USB connection. However, this lead to final design decision of using the TELIT GSM modem which is a PIC compatible modem which sends data through the GSM network by inserting a SIM card. The benefits are enhanced as now the data transmission can be accomplished in remote areas since cell network is expanding globally over remote areas, and the handshaking was assumed to be comfortable.Apart from the means to transmit the data, the destination for data to be sent also required preliminary decisions. Sending a SMS text was ruled out since data to be sent was large. Sending data as an email was also considered, but as attachments to email was not possible using GM 862 we settled for transmitting data on an FTP server.

Initial programming on GM 862 was on the widow’s HyperTerminal and the Real term software. These software tools were used as preliminary programming tools and also for testing the functionality of the GSM module. For handshaking between the PIC and GM862 the PIC HyperTerminal was used. For firmware upgrade, used as a testing measure, we installed the Xfp software available on the TELIT site.

4.2 Design details:

For the integration of the PIC and the GSM we connected the RX of the PIC to the RX of the GM 862, and the corresponding TX ports. The reason is that the RX ports of the GM862 are the output ports and the RX ports of the PIC are the reception ports. The connections are shown in Figure 18:

22

Page 23: TABLE OF CONTENTS

4.3 TestingTo test the handshaking is successful between the PIC and the GSM the RX and TX ports were seen on the oscilloscope and compared for the similar ASCII character transmission. Since it was known that the AT commands and the carriage return echo after being sent we saw the observed ASCII output was similar. We used a simple voltage comparator circuit for the PIC and the GSM to talk. With our GSM module we faced mainly the network registration problem. We did figure out the settings favored T-mobil SIM cards, but not AT&T. For troubles with registration we did the following, which proved unsuccessful:1) Used a different module. Changed the QUAD- PY to QUAD.2) Used different antenna.3) We tried several resets – ATZ // soft resetOKAT&F1 // factory setting restoreOK4) Force registration:AT+CREG=0,1ERROR // No OK.5) On board DTR switch transition.

23

Figure 18: PIC GM862 interface Diagram

Page 24: TABLE OF CONTENTS

6) RTS – CTS pins short

The solution was to use the band command to mode 3 for AT&T SIM cards.AT#BND=3OKAT+CREG?+CREG: 0,1

HyperTerminal was used to test the commands functionality before we went to programming GM 862 from the PIC. We wrote AT commands and listed down what response we get from the GSM module.As on HyperTerminal:ATOKAT+CREG?0,2 AT+CREG?0,1

To test whether the data has been sent as an email, we first wrote commands on HyperTerminal.Later we received the following as the message on GMAIL account. Now, as the commands are used as strings from the PIC to the GSM, similar commands can be used after handshaking is accomplished between the PIC and the GSM.

4.4 Encryption and Decryption:For the encryption of data we came up with an algorithm which could be implemented on the PIC. A private Key is XORED with the first value of the data list. This now acts as a Key for further computations. We now define a function F as:F=0 : Add valuesF=1 : Multiply valuesF=2 : Divide values

24

Figure 19: E-mail sent through GM862 using a T-Mobile SIM

Page 25: TABLE OF CONTENTS

F=3 : Subtract values

Where the value of F is decided by a rand (0, 3) function which randomly generates a number between 0 and 3.

Now for each sampled data we find the respective F value and compute the encrypted value. Since F is changing on each loop, it has a different functionality for each data sample. Naturally for the decryption we must provide the F too. Following is the sample encryption code once the key is made. Note this code is run through each loop of data sample:a# = adc(3) // b3: ADC channel used.F= rand(0,3)select f

case 0a#=a#+key#

case 1 a#=a#*key#

case 2a#=a#/key#

case 3a#=a#-key#

defaultbreakif f>-1

endselect

25

Page 26: TABLE OF CONTENTS

5. COST

The main intention was to make the product low cost and having good accurate measurements. One such unit in the market ranges from $799 and above. By using simpler circuit units we were able to reduce the price range far below than the ones available.

5.1 Parts

Table 1: COST OF PARTS

5.2 Labor

The above mentioned estimate does not include the labor charges. With the input averaging more than 10hr/week in the semester a considerable salary per person is $35/hr. Using formula 5.2 to estimate the cost, the labor will end up costing us $13,125. The total cost comes out to be $13,347.28 .

Total Cost = Parts + Labor (5.1)

Total Cost = Parts + (Ideal Hourly Salary (Hours Spent + Shop Hours) 2.5) (5.2)

26

Part Cost Number Used Total CostBV513 module $70 1 $70GM 862 module $80 1 $80Ag-AgCl Electrodes $25 1 box $25Blood Pressure Unit ( Stethescope+Valve)

$17 1 $17

AD624 amp $22 1 $22MPX2050 $5.89 1 $5.89LM235 $2.39 1 $2.39TOTAL $222.28

Page 27: TABLE OF CONTENTS

6 Conclusions

6.1 AccomplishmentsWe were successful when it came to hardware as all the three circuits namely ECG, temperature and Blood Pressure provided good results. The accuracy of the measurements made was appreciable. We were also able to sample the data and save them on the memory card on the PIC as .txt file. The sampling rate was high enough to gather information on all samples. The handshaking between the PIC and the GSM was accomplished once the voltage conversion was made. There was a problem on the ports which turned the same to a failure. However, it was shown that communication between the PIC and the GSM was once accomplished.After the network registration was done, sending data as a text message and also as an email was not a difficult task. The sending of data requires a set of simple AT commands which can be made into strings and can be programmed from the PIC.In short, we were able to accomplish whatever we had once proposed. There was a minor problem in the ports in the BV 513 module which was unavoidable as it was a hardware problem.

6.2 Uncertainties Apart from the port failure in the PIC module all the parts of the product performed as desired. The ports were also functional at once and hence we cannot categorize it as being uncertain in its functionality.

6.3 Future WorkAs an improvement on our design we could add extra peripheral devices to make the Telemedicine platform more functional. Pulse Oximeter, Peak flow meter and slit lamp with a camera could be included to the peripheral devices. Pulse Oximeter measures oxygen saturation in blood, Peak flow meter measures the lung capacity and the slip lamp would be helpful for eye examinations and taking snap shots of skin areas for infections. One can integrate all these the same way we integrated the rest of the peripherals.

6.4 Ethical Considerations1 We need to take care about all our biometric units. During simulation we tested our design

against all special cases to see the result. We need to have a high precision accuracy.1 Another area that we think is important is data encryption. Privacy of the user is very

important and so we will do our best to come up with powerful encryption software.2 We need to take care about all voltages and power unit to avoid any shocks. Special care will be

taken to insulate all wires and package the system carefully. The wattage and voltage readings for all peripherals will be clearly stated.

3 A direction page will be provided to avoid any confusion and wrong data transfer. Special care will be taken to avoid any data loss.

27

Page 28: TABLE OF CONTENTS

REFERENCES

FROM THE INTERNET

[1] BYVAC PIC 32 and Basic resources and documentation, V1.474, January 2010,

http://www.pic32.byvac.com/pic32_basic.php,

[2] Make: technology on your time, Citizen Scientist, Compact standalone ECG, Make Volume II

http://www.make-digital.com/make/vol11/?pg=161#pg161,

MANUALS

[3] Freescale Semiconductor, 50kPa On-chip temperature compensated and calibrated silicon pressure sensors, MPX2050, Rev 9, 10/2008

[4] Analog Devices, Precision Instrumentational Amplifier AD624, Rev C.,1999

[5] National Semiconductor, LM135/LM235/LM335 Precision Temperature sensors, Dec 17 2008

[6] Telit wireless solutions, GM862 family hardware user guide, Rev 1, 12/16/2009

[7] Telit wireless solutions, GM862 family software user guide, Rev 3, 01/26/2010

[8] Telit wireless solutions, GM862 AT commands reference guide, Rev 6, 08/03/2009

28