PERSONAL DIAGNOSTIC DEVICE

30
PERSONAL DIAGNOSTIC DEVICE By Elizabeth Dennis Aaron Mann Final Report for ECE 445, Senior Design, Spring 2015 TA: Kevin Chen 6 May 2015 Project No. 44

Transcript of PERSONAL DIAGNOSTIC DEVICE

Page 1: PERSONAL DIAGNOSTIC DEVICE

PERSONAL DIAGNOSTIC DEVICE

By

Elizabeth Dennis

Aaron Mann

Final Report for ECE 445, Senior Design, Spring 2015

TA: Kevin Chen

6 May 2015

Project No. 44

Page 2: PERSONAL DIAGNOSTIC DEVICE

ii

Abstract

The personal diagnostic device is intended to prototype a battery-powered medical instrument that will

detect the presence of myocardial infarction. With the use of sensors and a microcontroller, the device

will indicate the change in color of a troponin I/V test strip and calculate the patient's pulse in beats per

minute. The patient data will display on the device and also be sent via Bluetooth to a Smartphone.

We successfully designed and implemented the following individual systems: pulse sensor, display,

power, and microcontroller communication. Both the color sensor and Bluetooth modules are currently

under development.

Page 3: PERSONAL DIAGNOSTIC DEVICE

iii

Contents

1. Introduction .............................................................................................................................................. 1

1.1 Statement of Purpose ......................................................................................................................... 1

1.2 Goals ................................................................................................................................................... 1

1.3 Functions ............................................................................................................................................. 1

1.4 Block Diagrams .................................................................................................................................... 2

1.5 Block Descriptions ............................................................................................................................... 2

1.5.1 Power ........................................................................................................................................... 2

1.5.2 Sensor Control - Color Sensor ...................................................................................................... 2

1.5.3 Sensor Control - Pulse Sensor ...................................................................................................... 3

1.5.4 Display .......................................................................................................................................... 3

1.5.5 Bluetooth Module ........................................................................................................................ 3

1.5.6 Microcontroller ............................................................................................................................ 3

2 Design ......................................................................................................................................................... 4

2.1 Schematics .......................................................................................................................................... 4

2.1.1 Power Supply Design .................................................................................................................... 6

2.1.2 Pulse Sensor ..................................................................................................................................... 7

2.1.3 LED Display ....................................................................................................................................... 9

2.1.4 Microcontroller- Pulse Sensor Code .............................................................................................. 11

2.1.5 Color Sensor ................................................................................................................................... 12

2.1.6 Bluetooth ....................................................................................................................................... 12

3. Design Verification .................................................................................................................................. 14

3.1 Pulse Sensor ..................................................................................................................................... 14

3.2 Alphanumeric LED Display ................................................................................................................ 14

3.3 Power Supply .................................................................................................................................... 14

3.4 Microcontroller ................................................................................................................................. 14

3.5 Unsuccessful Systems ....................................................................................................................... 14

4. Costs 4.1 Parts ......................................................................................................................................... 15

4.2 Labor ................................................................................................................................................. 15

4.3 Grand Total ....................................................................................................................................... 16

Page 4: PERSONAL DIAGNOSTIC DEVICE

iv

5. Conclusion ............................................................................................................................................... 17

5.1 Accomplishments .............................................................................................................................. 17

5.2 Uncertainties ..................................................................................................................................... 17

5.3 Ethical considerations ....................................................................................................................... 17

5.4 Future work ....................................................................................................................................... 17

References .................................................................................................................................................. 18

Appendix A Requirement and Verification Table ................................................................................... 19

Appendix B PDD PCB Layout ....................................................................................................................... 22

Appendix C Power Analysis ......................................................................................................................... 23

Appendix D Code for Individual Systems .................................................................................................... 24

Page 5: PERSONAL DIAGNOSTIC DEVICE

1

1. Introduction

1.1 Statement of Purpose Cost of treatment is the largest issues with the Healthcare Industry. Not solely limited to a

financial burden, cost also includes the inordinate amount of time that is required to see a doctor.

Discouraged by lack of time and money, a consumer will procrastinate visiting a doctor until the

symptoms become life-threatening. Coupled with this issue, nurses lack equipment to quickly sort

through the sea of patients that fill an Emergency Room. In the sea of patients, those patients with a

myocardial infarction should be seen as soon as possible.

However, even though people with myocardial infarction should be attended to immediately,

many heart attacks are mild and less dramatic than seen on TV. Because victims of heart disease are not

receiving treatment fast enough, the heart spends far too much time dying before treatment is

administered. This leads to very high treatment costs, recovery costs, risks of future heart attacks, and

possible death.

The purpose of the personal diagnostic device (PDD) was to create a system to allow individuals

to diagnose themselves without spending time and money. The PDD is a portable, handheld device,

capable of taking the user's blood sample and pulse. The blood sample is analyzed for troponin I, a

protein emitted from the body as the heart deteriorates, and the device displays a "positive" or

"negative" result. The pulse is recorded as a risk stratification value. When the result is "positive", the

device will connect with a Smartphone via Bluetooth to transmit the diagnosis and location of the user

to a public safety center for emergency assistance.

1.2 Goals Distinguish priority in an emergency room

Encourage individuals who display signs of myocardial infarction to seek further help

Allow individuals to make the diagnose themselves and remove the length of time and cost of a

hospital visit from the decision process when symptoms are felt.

1.3 Functions Diagnose the user with myocardial infarction via troponin test

Calculate user's pulse

Transmit data via Bluetooth to Smartphone

Page 6: PERSONAL DIAGNOSTIC DEVICE

2

1.4 Block Diagrams

Figure 1 (Basic Block Diagram with Key)

Figure 2 (Sensor Control Block Diagram)

1.5 Block Descriptions

1.5.1 Power

The PDD is powered by a 9V battery. The power module converts the 9V dc battery to 3.3V and

5V at 1A each. As shown in Figure 1, this module supplies power to all modules of the PDD:

microcontroller, display, Bluetooth, and sensor control. More specifically, the Bluetooth module,

microcontroller, LED driver, and the color sensor will need 3.3V to function. The 5.0V is used in the pulse

sensor for op-amp rails, the source to drive the IR emitter and IR detector input, and the collector

voltage of the transistor.

1.5.2 Sensor Control - Color Sensor

The color sensor circuit will detect a color change in a chemical test strip and send data to the

microcontroller via I2C communications. Ideally, the device would test an immunoassay chemical strip

Key: Red = Slaves Grey= Master Green = Input Data Purple = Output Data Black = Power Blue = Power Lines

Page 7: PERSONAL DIAGNOSTIC DEVICE

3

to detect troponin blood concentrated at around 5ppm. However, given the difficulty of obtaining and

demonstrating with blood, we prepared the device to work with an array of easily reactive color

changing chemical strips.

1.5.3 Sensor Control - Pulse Sensor

The pulse sensor circuit converts a mechanical pulse found in a human finger into an

interpretable electrical signal. An IR emitter will continuously emit a light. When a finger is placed on

both the IR detector and emitter, the detector detects light reflected from the finger during a pulse.

When the detector detects the IR light, current starts to pass through the detector, causing a voltage

drop. The two op-amps stabilize the signal and filter noise from the signal. The signal meets the

transistor, which amplifies the signal. This amplified signal goes to the microcontroller’s analog pins,

where it then will be manipulated to calculate beats-per-minute (bpm).

1.5.4 Display

The microcontroller is responsible for displaying the color test result ("POS" or "NEG") and the

pulse (in bpm). The display consists of four alphanumeric LEDs that can switch displaying between the

former and latter results.

1.5.5 Bluetooth Module

The BLE112-v1-A is the selected antenna for our system, for it is defined as a "Class 2 Bluetooth

4.0 Module." This specific model is compatible with iOS devices, such as a Smartphone. The

microcontroller will communicate to the Bluetooth 4.0 Module via SPI communications. The result from

the color test and the pulse sensor reading will be sent via this module to an iOS application. This

module was chosen for its lower relative cost that is was compatible with the security of Apple’s

iPhones.

1.5.6 Microcontroller

The microcontroller is responsible for controlling almost every module on the board. This

microcontroller is programmed via communication through the computer by JTAG pins when on a PCB ,

otherwise a micro USB used to program the Launchpad. Capable of communicating via SPI and I2C

simultaneously, the microcontroller can initialize the settings desired for the color sensor (i.e. proximity

of reading, gain, wait times to read the colored strip), LED driver (i.e. intensity of message), and

Bluetooth 4.0 module.

This microcontroller has analog pins. When the analog output of the pulse sensor comes to the

microcontroller, the microcontroller will count the dips in the signal and calculate a pulse in bpm. After

calculating pulse, the microcontroller will command the LED display to share the result. Likewise, after

interpreting RGB values from the color sensor, the microcontroller will determine a "positive" or

"negative" result and display the following by alphanumeric LEDs.

Page 8: PERSONAL DIAGNOSTIC DEVICE

4

2 Design

2.1 Schematics

Figure 3 Microcontroller Schematic

Page 9: PERSONAL DIAGNOSTIC DEVICE

5

Figure 4 Pulse Sensor Schematic

Figure 5 Display Schematic

Figure 6 Bluetooth Schematic

Page 10: PERSONAL DIAGNOSTIC DEVICE

6

Figure 7 Color Sensor Schematic

Figure 8 Power Supply Schematic

2.1.1 Power Supply Design

The buck regulator (LT3988) takes the input of 9V DC battery and provides an output of 3.3V, 1A

and 5V, 1A. We conducted a power analysis, as shown in Appendix C, to determine the amount of

power necessary to operate the board. The buck switching regulator met the requirements predicted.

The battery life calculation required information from the Power Analysis table. We chose to use a

Duracell battery that produces 500mAh. With the assumption that the pulse sensors and the transistors

used 30mA each, the following battery-life calculation can me made:

Page 11: PERSONAL DIAGNOSTIC DEVICE

7

Equation 1 shows that the battery, under continuous usage, can only supply power for 2.5 hours.

The PCB Layout of the entire design can be found in Appendix B. Figure 9 shows the power

supply filled with components. The output pins placement were chosen purposefully. The two pins after

each inductor (the big gray boxes), are ground and power pins. This is to easily verify the voltage of the

power supply with a multimeter. To the right of the two pins is another pin which supplies power to the

rest of the board. Placing a current probe on the wire connecting the power pin from the supply to the

power pin to the rest of the board, current could be measured on an oscilloscope.

Figure 9 PDD PCB Power Supply Section

Figure 9 also shows that the inductors and catching diodes are placed in close proximity to the

switching regulator. The lines connecting the voltage output to each component are short to avoid

parasitic inductance. The switching regulator IC also requires a ground plane directly underneath the

chip with supporting vias to release the build-up of heat.

2.1.2 Pulse Sensor Our research showed a pre-existing circuit that took pulse (Figure 10). The first step in modifying

this design was to simulate the original design using LT Spice to observe the circuit's behavior (Figure

11). A dc pulse signal mimicked the IR emitter and detector portion, with a duty cycle of 25% and an

amplitude of 0 to 3V. The result shows that the circuit can successfully increase the magnitude of the

signal by about 1V (Figure 12).

Page 12: PERSONAL DIAGNOSTIC DEVICE

8

Figure 10 Original Pulse Sensor Circuit [1]

Figure 11 LT Spice Schematic

Figure 12 Input Voltage (black) vs. Ouput Voltage (blue) of Pulse Circuit

Page 13: PERSONAL DIAGNOSTIC DEVICE

9

After using a simulation online, the next step was to build the breadboard circuit and start adding

modifications. The final modification reached is shown in Figure 13.

Figure 13 Modified Pulse Sensor Circuit

With this modification, the circuit signal cleared up significantly. Originally the signal was noisy

and would interfere with our ability to calculate bpm. After the addition of the 12Ω resistor, the signal,

while no longer dropping down to ground, was able to have a cleaner steady state (Figure 14). Every

voltage drop indicates a pulse.

Figure 14 Comparison of Before and After Band-pass Filter Addition to Pulse Circuit (Note: 1 Volt and 1 Second per division)

After cleaning up the signal with a band-pass filter, the signal was ready to be interpreted by

the microcontroller.

2.1.3 LED Display The LED Display was originally comprised of 11 alphanumeric LEDs and two LED drivers.

However, after trying to hardwire the circuit to test the individual module, we became weary of

Page 14: PERSONAL DIAGNOSTIC DEVICE

10

translating this design to a PCB. The schematic for the original design of the LED display is shown in

Figure 15 and the implementation is shown in Figure 16.

Figure 15 Schematic of 8-digit Display (From MAX6954 datasheet)

Figure 16 Breadboard implementing Schematic in Figure 15

Page 15: PERSONAL DIAGNOSTIC DEVICE

11

After researching online, we found the Adafruit Backpack alphanumeric LED display. This board

already came printed and attached to a driver. The backpack could be controlled by a microcontroller

via I2C. The size of the display was not too big, and the coding for the device was simple. After sending

the address to the driver, a hex number was sent showing which letters in Figure 17 the user wanted to

be bright. A bright segment was equal to a "1", and a non-lit segment was equal to a "0".

Figure 17 Raw Image Mapping (0 DP N M L K J H G2G1 F E D C B A)

The following code for writing the messages "POS" and "NEG" can be found in Appendix D.

However, one of the constraints of this new design was there were less display LEDs for both the color

test and the pulse sensor to display their results. This inspired the addition of switches connected to the

microcontroller. With a GPIO coming from a switch reading a "high" value, the display could be set to

show the color test result. With the same GPIO switching to a "low" value, the display could be set to

show the pulse sensor test. This required more input from the user, but was a convenient choice over

Figure 15 and Figure 16.

2.1.4 Microcontroller- Pulse Sensor Code The microcontroller was picked because of its functionality. The component could handle a

variance of communication methods (I2C and SPI). The microcontroller also could be individually tested

and programmed without the PCB, using a development kit called Launchpad. The Launchpad could load

software from Energia and Code composer, giving a range of multiple platforms to code our work. Figure

18 shows a flow chart that was used to assist Aaron in writing the pulse sensor code. It shows how we

utilized the internal clock of our microcontroller to calculate bpm.

Rather have the user place their finger inside the ring for 60 seconds, we using only 15 seconds

and multiplying by 4. The while loop will run on the microcontroller inner clock adding up to 15

seconds. During that fifteen seconds the microcontroller will look for changes from the IR detector.

These changes will increment a variable that stores the beats detected. To prevent a single beat

carrying over from clock cycle to clock and being countered more than once is a second variable, a parity

Page 16: PERSONAL DIAGNOSTIC DEVICE

12

bit of sorts. This bit will be set high if a pulse have just been detected and will only allow for a new pulse

to be registers if it is set back to low.

Figure 18 Flow Chart for Pulse Sensor Code

2.1.5 Color Sensor A color sensor that could detect a strip in close proximity was necessary for this design. Because our

microcontroller already communicated in I2C with the LED display, it would be simple to incorporate

another component that used a similar communication feature. The TMD3782 was a perfect candidate

to send RGB values back and forth to the microcontroller. However, due to board delay and the size of

the component, the part was never tested on the MSP430Launchpad individually. Therefore, our goal

was to work with the ColorPal Sensor and see if it could interact with the MSP430 and produce RGB

values.

2.1.6 Bluetooth A 4.0 Bluetooth module was needed to meet the need to transmit the data to a Smartphone. In theory,

the microcontroller would talk to the BLE112-v1-A Bluetooth antenna via SPI. The PCB requirements for

this part increased the difficulty of the PCB. In order to successfully output data from the antenna, the

component needed to make direct attachments to a solid ground plane. This reduces attenuation in the

signal and coupling between power planes. Therefore, our project evolved from a 2-layer PCB to a 4-

layer PCB. A clearance square without traces or planes of any kind needed to exist in the upper right

Page 17: PERSONAL DIAGNOSTIC DEVICE

13

hand corner of the part (in Appendix B, it is the lower right hand corner of the Figure), to allow a

noiseless surface for the antenna.

Page 18: PERSONAL DIAGNOSTIC DEVICE

14

3. Design Verification A detailed table listing the original requirements and verifications for our design review is located in

Appendix A. Below is a description of the successful systems and procedures used to verify their

expected results.

3.1 Pulse Sensor By placing a voltage probe at the output of our circuit, we found out whether or not the pulse sensor

was working. We would take our pulse and compare it to the oscilloscope reading we would obtain on

the screen. Because the pulse was within +/- 4 beats of our actual pulse, the pulse sensor met the

verification.

3.2 Alphanumeric LED Display There was not a quantitative analysis to determine whether or not this component worked. If we sent a

message to the LED display and the driver correctly interpreted it, the alphanumeric LED would light up.

Figure 19 LED Verification Pictures

3.3 Power Supply Referring back to the design structure of the power supply in chapter 2.1.1 of this paper, the voltage and

current of the power supply is easily measured. Attaching a voltmeter to the output of the supply, the

voltage between the 5V output pin and ground was 4.95V. The voltage measured between the 3.3V

output pin and ground was 3.26V. This met the needed requirement of voltage to the system.

Connecting the power to the rest of the board caused some trouble, however, because the orientation

of the microcontroller was incorrect. This resulted in the microcontroller overheating and frying. The

amount of current seen through the system during this time was around 600mA.

3.4 Microcontroller The microcontroller needed to successfully calculate bpm and communicate to the LED backpack via I2C.

Because a pre-determined message was able to appear on the LED display, the microcontroller is

assumed to have correctly working I2C communication. The bpm was also able to print on the screen

after programming the microcontroller using code from Appendix D.

3.5 Unsuccessful Systems Both the color sensor and Bluetooth module failed to work. Due to the microcontroller frying, a lack of

time, and funding, this system is still under debug and evaluation.

Page 19: PERSONAL DIAGNOSTIC DEVICE

15

4. Costs

4.1 Parts Table 1: Parts Cost

Part Manufacturer Retail Cost ($)

Bulk Purchase Cost ($)

Actual Cost ($)

JTAG Header 3M $2.70 $2.70 $2.70

Fixed Inductor 22μH Eaton Bussmann $1.40 $2.80 $2.80

Fixed Inductor 15μH Eaton Bussmann $2.10 $4.20 $4.20

Schottky Diode Diodes

Incorporated $0.70 $2.80 $2.80

LT3988 IC Switching Regulator Linear Technology $7.79 $15.58 $15.58

TEMT1020 Phototransistor Vishay $0.97 $1.94 $1.94

VSMB2943GX01 IR Emitter Vishay $0.90 $2.70 $2.70

MSP430F5529 Microcontroller Texas Instruments $8.06 $8.06 $8.06

LM324ADR IC Dual OPAMP Texas Instruments $0.41 $0.82 $0.82

TMD3782 Color Sensor ams $3.16 $3.16 $3.16

DIP Switch 3 Pos E-Switch $1.18 $1.18 $1.18

BLE-112-v1-A Bluetooth Antenna Bluegiga

Technologies $15.66 $32.00 $32.00

Misc. Resistors and Capacitors N/A $0.10 $10.00 $10.00

Total

$87.94

4.2 Labor Table 2: Design Labor Costs

Name Hourly

Rate Total Hours

Invested

Total = Hourly Rate x 2.5 x Total Hours

Invested

Aaron Mann $27.50 225 $15,468.75

Elizabeth Dennis $27.50 225 $15,468.75

Total - 450 $30,937.50

Table 3: Printed Circuit Board Costs

Company Description Total Cost

Advanced Circuits Board Cost $66.00

UPS Next Day Air Shipping/Handling $68.40

Advanced Circuits Expedite Manufacturing $100.00

Total - $234.40

Page 20: PERSONAL DIAGNOSTIC DEVICE

16

4.3 Grand Total Table 4: Total Cost

Section Amount ($)

Labor $31,171.90

Parts $87.94

Total $31,259.84

Page 21: PERSONAL DIAGNOSTIC DEVICE

17

5. Conclusion

5.1 Accomplishments Our main technical accomplishments for the semester were to have a functioning display, design

and implement a circuit to produce a clean signal based on the user's pulse running through their

finger, to interpret the signal into a pulse reading in bpm, and create a four layer PCB board. The

display component correctly displayed pre-determined messages.

The pulse sensor was our most interesting accomplishment in that it functioned properly with

the human body. Getting the angle and the distance of the IR emitters and detectors from one another

was tricky. To clean the noisy signal into a clear signal took a lot of effort. This signal made it easy for

the microcontroller to interpret the drops in the signal, count the number of drops , and print the result

to the monitor.

The PCB board was our most challenging and time consuming part of the project.

Unfortunately, it was not used directly in the final demo (except for the power supply demonstration).

However, the building of a four layer PCB quite impressive and deserves to placed in line with all other

accomplishments of the semester.

5.2 Uncertainties Our largest uncertainty was getting the microcontroller to function as it advertised. Most of our

failures came from not setting enough time aside to simply figure out the true functionality of the

microcontroller. Our project never reached the point of using the color sensor or using the Bluetooth

module. We are also uncertain if individual modules could work with one another simultaneously.

Other uncertainties rested within the pulse sensor, and finding a way to block out the noise

from background light variances. At times, the angle of the IR emitter and detector caused the pulse

sensor to behave a little differently than planned. Also, the pressure of the finger placed on the pulse

sensor caused variance in the output signal. Determining the maximum and minimum pressure needed

for the sensor would be useful in making our device more user-friendly.

5.3 Ethical considerations The purpose of this device is aid in medical diagnosis, this means that it must be held to a very

high standard of operation and be truly as safe as it claims, there can be no shortcuts taken in its

development. In the IEEE code of ethics we must be especially careful points 1, 3 and 8.[1] These points

refer to taking responsibility for the designs one creates in both claims of competency and prevention of

doing harm to individuals.

5.4 Future work There are plans to create both an iOS application for advanced risk stratification and patient

care along with incorporating two ECG leads into a prototype for more broad usability. For the summer,

Aaron Mann will lead a small team in the development of the above products while on fellowship with

the University of Illinois.

Page 22: PERSONAL DIAGNOSTIC DEVICE

18

References [1] Ragan, S. (2013, September 26). Infrared Pulse Sensor. Retrieved February 9, 2015, from

http://makezine.com/projects/ir-pulse-sensor/

[2] IEEE Code of Ethics. (2015, January 1). Retrieved February 25, 2015, from

http://www.ieee.org/about/corporate/governance/p7-8.html

Page 23: PERSONAL DIAGNOSTIC DEVICE

19

Appendix A Requirement and Verification Table

Table 5: System Requirements and Verifications

Requirement Verification Verification status

(Y or N)

1. Pulse Sensor: a. The sensor will detect

pulse from the index finger

a. Attach an oscilloscope to the output of the pulse sensor. The user will count the number of times the analog signal goes from ground to a high signal. The user will take their radial pulse and compare the output analog signal of the pulse sensor to see if the two methods match.

Y

2. Color Sensor a. The color sensor should be

able to detect the color purple which we are defining to be between the values: R204 G204 B255 R102 G102 B153

a. We will use a series of printed color panels.

The color panels should begin with all white, R0 G102 B153 and R51 and R51 G51 B102. The output will be observed by reading the outputs from the sensor. The output will be read by an if statement that will power and LED if true. The if statement will only be true initially for anything but white. Slowly one must print out color panels closer to the requirement values and change the if statement logic. This will serve to confirm that the sensor is only sensing between the current setting and is not so robust it cannot distinguish between the requirement values and some intermediate color. At each printing the more robust colors must be tested to confirm that the sensor is

N

Page 24: PERSONAL DIAGNOSTIC DEVICE

20

now rejecting those inputs with the new logic before testing the next colors. If at any point the sensor cannot tell the difference between two reasonably distances RGB values (15 or more across the board) then the sensor fails the test. If the sensor passes the above tests down to the requirement values the sensor passes the test.

3. Microcontroller a. I2C and SPI

communications are fully functional

b. Microcontroller will

calculate bpm not exceeding an error of +/- 5 bpm.

a. Program the microcontroller to use the parity generator and parity check for both SPI and I2C communications. The Error Flag (UCPE) will be set high if there is a mismatch between the number of 1s in the string sent. When this flag is high, an LED will emit a red light.

b. The microcontroller calculation will be tested against the first responder method of obtaining radial pulse. The microcontroller will send a high digital signal to an LED for confirmation that the microcontroller is reading “high” for each pulse. The results will be within +/- 5 bpm of the radial method.

Y

4. Power Source a. The regulator will provide

5V (pulse sensor) and 3.3V (display, microcontroller, color sensor, Bluetooth) and not exceed +/- 0.25V of voltage supplied.

a. Place a voltmeter across the regulator output (+) and the board ground (-). The reading will be within +/-0.25V of 3.3V and 5V

Y

Page 25: PERSONAL DIAGNOSTIC DEVICE

21

b. The power source will +/-

0.25A from 1A (for both 3.3V and 5V supply).

b. Place a digital multimeter in

series with the regulator output to measure the current supplied. The current read should read +/- 0.25A from the 1A .

5. Display a. Displays output of

microcontroller to LEDs

a. Microcontroller sends message “445 ROXX” to LED Driver. LED must display “445 ROXX”.

Y

6. Bluetooth a. The Bluetooth 4.0 Module

can connect to a Smartphone

b. The Bluetooth 4.0 Module is capable transmitting data to iOS device

a. The Smartphone will post a message indicating if the Bluetooth device fails to pair with our device. If the message “Connection Unsuccessful”

b. The Bluetooth module sends a known serial strings of 1s followed by a strings of 0s. If the Smartphone can display the strings transmitted, then our Bluetooth module operates properly.

N

Page 26: PERSONAL DIAGNOSTIC DEVICE

22

Appendix B PDD PCB Layout

Figure 20 PCB Layout

Page 27: PERSONAL DIAGNOSTIC DEVICE

23

Appendix C Power Analysis Table 6: Power Analysis

Page 28: PERSONAL DIAGNOSTIC DEVICE

24

Appendix D Code for Individual Systems The following code was branched from the AdaFruit demo code provided to initialize the LED backpack

and send the I2C address. We made modifications to meet particular requirements and verifications

// Demo the quad alphanumeric display LED backpack kit // scrolls through every character, then scrolls Serial // input onto the display #include <Wire.h> #include "Adafruit_LEDBackpack.h" #include "Adafruit_GFX.h" Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); void setup() { Serial.begin(9600); alpha4.begin(0x70); // pass in the address // Writing "POS" for Positive result alpha4.writeDigitRaw(3, 0x0); alpha4.writeDigitRaw(0, 0x00F3); alpha4.writeDigitRaw(1, 0x3F); alpha4.writeDigitRaw(2, 0x00ED); alpha4.writeDigitRaw(3, 0x0000); alpha4.writeDisplay(); delay(1000); alpha4.clear(); alpha4.writeDisplay(); delay(500); //Writing "NEG" for Negative Result alpha4.writeDigitRaw(3, 0x0); alpha4.writeDigitRaw(0, 0x2136); alpha4.writeDigitRaw(1, 0x00F9); alpha4.writeDigitRaw(2, 0x00BD); alpha4.writeDigitRaw(3, 0x0000); alpha4.writeDisplay(); delay(500); }

Page 29: PERSONAL DIAGNOSTIC DEVICE

25

char displaybuffer[4] = {' ', ' ', ' ', ' '}; void loop() { while (! Serial.available()) return; char c = Serial.read(); if (! isprint(c)) return; // only printable! // scroll down display displaybuffer[0] = displaybuffer[1]; displaybuffer[1] = displaybuffer[2]; displaybuffer[2] = displaybuffer[3]; displaybuffer[3] = c; // set every digit to the buffer alpha4.writeDigitAscii(0, displaybuffer[0]); alpha4.writeDigitAscii(1, displaybuffer[1]); alpha4.writeDigitAscii(2, displaybuffer[2]); alpha4.writeDigitAscii(3, displaybuffer[3]); // write it out! alpha4.writeDisplay(); delay(200); } The following code was created for the pulse sensor. /* ReadAnalogVoltage Reads an analog input on pin A3, converts it to voltage, and prints the result to the serial monitor. Attach the center pin of a potentiometer to pin A3, and the outside pins to +3V and ground. Hardware Required: * MSP-EXP430G2 LaunchPad * Potentiometer This example code is in the public domain. */ // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // msp430g2231 must use 4800 }

Page 30: PERSONAL DIAGNOSTIC DEVICE

26

// the loop routine runs over and over again forever: void loop() { // read the input on analog pin A3: int pulse = 0; int div = 0; int sensorValue = analogRead(A4); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 3V): // Can either use type int or float to store voltage, int takes up less memory and is recommend // Memory is a huge concern when programming microcontollers, be careful what datatypes are used // in order to make the most of the available memory int time = 0; while(1){ time = time +1; //Serial.println(time); sensorValue = analogRead(A4); int voltage = sensorValue * (3.3 / 4096.0); // You can compare the size of the code by running the program using int and then running with float // You will see ~4k bytes for int vs ~6k bytes for float just by changing the datatype, quite astonishing. //float voltage = sensorValue * (3.0 / 1023.0); // print out the value you read: if(voltage < 2){ pulse = pulse + 1; div = pulse/4; div = div*1.1; } Serial.println(div); Serial.println(div); Serial.println(div); } }