<<

AN1525 Pulse Oximeter Design Using Microchip’s and dsPIC® Digital Signal Controllers (DSCs)

Author: Zhang Feng Inc.

INTRODUCTION Pulse oximeter is a non-invasive medical device that monitors the oxygen saturation of a patient’s blood and heart rate. This application note demonstrates the implementation of a high-accuracy pulse oximeter using Microchip’s analog devices and dsPIC® Digital Signal Controllers (DSCs).

FIGURE 1: FUNCTION BLOCK DIAGRAM

PWM1 LED On/Off PWM2

LED Driver Analog Signal Conditioning

Analog IR Red ADC0 Switch Transimpedance Highpass Amplifier Filter Gain Stage ADC1 Amplifier Photodiode DC Offset

LED Current Control DAC I2C™

LCD I/O

Computer, WiFi® or UART ®

 2013-2015 Microchip Technology Inc. DS00001525B-page 1 AN1525

THEORY OF OPERATION light to pass through. On the other hand, Hb absorbs more red light and allows more infrared light to pass A pulse oximeter monitors the oxygen saturation through. (SpO ) of a human’s blood based on the red light (600- 2 The photodiode receives the non-absorbed light from 750 nm wavelength) and infrared light (850-1000 nm each LED. This signal is inverted using inverting Op- wavelength) absorption characteristics of oxygenated Amp and therefore the result, as shown in Figure 2, hemoglobin (HbO ) and deoxygenated hemoglobin 2 represents the light that has been absorbed by the (Hb). The pulse oximeter flashes the red and infrared finger. lights alternately through a finger to a photodiode. HbO2 absorbs more infrared light and allows more red

FIGURE 2: REAL-TIME RED AND INFRARED (IR) PULSATION SIGNALS CAPTURED BY THE OSCILLOSCOPE

Red Pulsation Signal

IR Pulsation Signal

The pulse amplitudes (Vpp) of the red and infrared The look-up table is an important part of the system. signals are measured and converted to Vrms to Look-up tables are specific to a particular oximeter produce a Ratio value as given by Equation 1. The design and are usually based on calibration curves SpO2 can be determined using the Ratio value and a derived from many measurements of a healthy subject look-up table that is made up of empirical formulas. The at various SpO2 levels. Figure 3 shows a sample pulse rate is calculated based on the Analog-to-Digital calibration curve. converter (ADC) sample number and sampling rate.

EQUATION 1: Red_AC_Vrms / Red_DC Ratio = ------IR_AC_Vrms / IR_DC

DS00001525B-page 2  2013-2015 Microchip Technology Inc. AN1525

FIGURE 3: SAMPLE CALIBRATION CURVE

Sample Calibration Curve 100 80 60 40 SpO2 (%) 20 0 0.4 1 2 3.5 Ratio

CIRCUIT DESCRIPTION LED Driver circuit

The SpO2 probe used in this example is an off-the-shelf A DUAL SPDT analog switch driven by two PWM Nellcor® compatible finger clip type of probe which signals from the turns the red and integrates one red LED and one IR LED and a photodi- infrared LEDs on and off alternately. In order to acquire ode. The LEDs are controlled by the LED driver circuit. the proper number of ADC samples and have enough The red light and IR light passing through the finger are time to process the data before the next LED turns on, detected by the signal conditioning circuit and are then the LEDs are switched on/off according to the timing fed to a 12-bit ADC module of the microcontroller diagram in Figure 4: where %SpO2 can be calculated.

FIGURE 4: TIMING DIAGRAM g Read Read ADC ADC

RED_off RED_on 1780uS Read 220uS Processing data 320uS ADC

IR_off IR_on 1780uS 220uS

The LED current/intensity is controlled by a 12-bit Digital-to-Analog Converter (DAC) which is driven by the microcontroller.

 2013-2015 Microchip Technology Inc. DS00001525B-page 3 AN1525

Analog Signal Conditioning Circuit DIGITAL FILTER DESIGN There are two stages in the signal conditioning circuit. The output of the analog signal conditioning circuit is The first stage is the transimpedance amplifier and the connected to the ADC module of the dsPIC DSCs. One second stage is the gain amplifier. A Highpass filter is ADC sample is taken during each LED’s on-time placed between the two stages. period, and one ADC sample is taken during both LED’s off-time period. TRANSIMPEDANCE AMPLIFIER Taking advantage of the powerful Digital Signal The transimpedance amplifier converts a few micro Processing (DSP) engine integrated in dsPIC DSCs, a amps of current generated by the photodiode to a few digital FIR Bandpass Filter is implemented to filter the millivolts. ADC data. The filtered data is used to calculate the pulse amplitude. Digital filter code is generated using HIGHPASS FILTER Microchip’s Digital Filter Design Tool. The signal received from the first stage amplifier FIR Bandpass Filter Specifications passes through a Highpass filter which is designed to reduce the background light interference. Sampling Frequency (Hz): 500 Passband Frequency (Hz): 1 and 5 GAIN AMPLIFIER Stopband Frequency (Hz): 0.05 and 25 The output of the Highpass filter is sent to a second FIR Window: Kaiser stage amplifier with a gain of 22 and a DC offset of Passband Ripple (-dB): 0.1 220 mV. The values for the amplifier’s gain and DC offset are set to properly place the output signal level of Stopband Ripple (-dB): 50 the gain amplifier into the microcontroller’s ADC range. Filter Length: 513

CONNECTIVITY

The SpO2 and pulse rate data can be sent to a computer through a UART port with the PICkit™ Serial Analyzer. The serial port setting is 115200-8-N-1-N. The pulse signal can be plotted out using an application such as Microchip’s Generic Serial Data Display GUI as shown in Figure 5. The data can also be sent to a Wi-Fi® or Bluetooth® module via UART port.

FIGURE 5: THE WAVEFORM DISPLAYING THE PULSE SIGNAL

1000

950

900

850

800

750 IR RED 700

650

600

550

500 1 43 85 127 169 211 253 295 337 379 421 463 505 547 589 631 673 715 757 799 841 883 925 967 1009 1051 1093 1135 1177 1219 1261 1303 1345 1387 1429 1471 1513 1555 1597 1639 1681 1723 1765 1807 1849 1891 1933 1975 2017 2059 2101 2143 2185 2227 2269 2311 2353 2395 2437

DS00001525B-page 4  2013-2015 Microchip Technology Inc. AN1525

FIGURE 6: PROGRAM FLOWCHART

Start

Initialization

Turn On/Off RED ĂŶĚ IR LEDs Alternately From Interrupts Main Loop

Is the signal received No Goto Sleep from the probe valid?

Yes

Are Red ĂŶĚ IR ADC No Data Ready?

Yes FIR Bandpass Digital Filtering

Find MaxMin of IR ĂŶĚ RED Filtered AC Signals

Calculate SPO2 ĂŶĚ Pulse Rate

Display Result

Timer 3 Interrupt Occurred Timer 2 Interrupt Occurred Read RED DC ĂŶĚ AC Signal Read IR DC ĂŶĚ AC Signal

Read DC Baseline Signal after Timer3 Interrupt before Timer2 Interrupt

Adjust DAC to Adjust DAC to Calibrate Red LED Calibrate IR LED

Is Red ADC Is IR ADC Data Ready? Data Ready?

Yes Yes

 2013-2015 Microchip Technology Inc. DS00001525B-page 5 AN1525

NOTES:

DS00001525B-page 6  2013-2015 Microchip Technology Inc. AN1525

APPENDIX A: SCHEMATICS This appendix shows the Microchip Pulse Oximeter schematics.

SHEET 1: MICROCHIP PULSE OXIMETER DEMO BOARD SCHEMATIC 1 OFFSET DAC_D TP8

DAC_A/IR 1 2 3 4 5 6 1 2 3 4 5 6 DAC_B/RED P1 P2 Q) ,&63 3,&NLWŒ6HULDO C8 TP9 DAC_C/DC 3.3V 3.3V Q)

C7 GND GND TP10 VCC VCC Q) C6 RB14 ICSP U1TX

TP11 PGD2 PGC2 GND Q) C5 MCLR GND 7 6 10 9 8 VSS VOUTB VOUTA VOUTD VOUTC DAC 3.3V

GND '13 VCC X) C18 R17 VDD SCL SDA nLDAC RDY/nBSY GND U3 0&30623 RA4/E BT+ RA3/RS 1 2 3 4 5 RB7/DB7 RB6/DB6 RB5/DB5 RB4/DB4 RB3/DB3 RB2/DB2 RB1/DB1 RB0/DB0 RA2/RW 3.3V

16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

VCC

GND X) X) 9 8 7 6 5 4 3 2 1 SDA1 16 15 14 13 12 11 10

J2  C4 C9 SCL1 5 14 13 12 11 10 9 8 7 15 2 16 1 6 4 3 . . EN RS NC DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 R/W VSS VDD LED- LED+ GND LCD1 TP1 R6 R7 3.3V

TP2 3.3V

VCC 1+'+=)6:)%:9& VCC C2 X) GND AN0 AN1 RA2/RW RA3/RS RA4/E RB0/DB0 RB1/DB1 RB2/DB2 RB3/DB3 RB4/DB4 RB5/DB5 RB6/DB6 RB7/DB7 SCL1 SDA1 PGD2 PGC2 OC2/RED OC1/IR RB14 U1TX 16 23 26 7 24 6 25 10 18 12 2 3 15 17 22 14 4 5 21 9 11 R1 . R2 . GND 4 5 VFB

Regulator

VOUT

GND 2 AN1/VREF-/CN3/RA1 AN0/VREF+/CN2/RA0 OSC1/CLKI/CN30/RA2 GND 0&37,&+< AN4/C1IN-/RP2/CN6/RB2 AN5/C1IN+/RP3/CN7/RB3 VIN EN SW INT0/RP7/CN23/PMD5/RB7 U2 SOSCI/RP4/CN1/PMBE/RB4 OSC2/CLKO/CN29/PMA0/RA3 SOSCO/T1CK/CN0/PMA1/RA4 Boost 6 3 1 TDO/SDA1/RP9/CN21/PMD3/RB9 TCK/SCL1/RP8/CN22/PMD4/RB8 GND AN12/DAC1RP/RP12/CN14/PMD0/RB12 AN9/DAC1LN/RP15/CN11/PMCS1/RB15 PGD1/EMUD1/AN2/C2IN-/RP0/CN4/RB0 AN11/DAC1RN/RP13/CN13/PMRD/RB13 PGC1/EMUC1/AN3/C2IN+/RP1/CN5/RB1 0&/5BQ PGD2/EMUD2/TDI/RP10/CN16/PMD2/RB10 PGD3/EMUD3/ASDA1/RP5/CN27/PMD7/RB5 PGC3/EMUC3/ASCL1/RP6/CN24/PMD6/RB6 PGC2/EMUC2/TMS/RP11/CN15/PMD1/RB11 ICSP

L1 S2 AN10/DAC1LP/RTCC/RP14/CN12/PMWR/RB14 MCLR C1 X) MCLR VCAP/VDDCORE VDD AVDD VSS VSS AVSS dsPIC33FJ128GP802 U1 '63,&)-*3,62

X) C12 - GND

1 8 13 28 19 27 20 GND R4 . 3.3V

VCC C3 X) BT+ R3  BT1 C11 X) %DWWHU\9[$$$ MCLR GND GND C10 X) 3 2 1 MCLR 3.3V

GND Microcontroller VCC S1

 2013-2015 Microchip Technology Inc. DS00001525B-page 7 AN1525

SHEET 2: MICROCHIP PULSE OXIMETER DEMO BOARD SCHEMATIC 2 SENSOR

SPO2 DB9-9/CATHODE DB9-3/RED DB9-2/IR DB9-5/Anode Sensor

GND Connector

SpO2

9 5 9 4 8 3 7 2 6 1

to

Female

Connector

Connect DB9 J1 D 10 11 GND AN1 TP7 DAC_B/RED R9 5.1K 7 OC1/IR 22pF 220K U5B MCP6002 DB9-2/IR B

R13 100

VSS VDD

8 OUTB 4 Ohm

B TP3 C16 B -B +B R11 10 R15 3.3V GND

6 5 Q2 VCC GND 10K 7 10 6 9 8 OFFSET MMBT2222

IN2 NC2 NO2 R5 GND COM2 DAC_C/DC TP6 Conditioning AN0

R16 2.7K GND Signal 1uF

SPDT

Dual

C17 TP5 Analog V+ NO1 COM1 IN1 NC1 U4 ADG884BRMZ 1 2 3 4 5 1 Ohm

Q1 MMBT2222 R10 10 GND 10pF 100K C14 0.1uF U5A MCP6002 A

3.3V GND

VDD

3.3V VSS 8 OUTA 4

VCC GND TP4 A VCC C15 A -A +A R14 2 3 R12 100 GND R8 5.1K OC2/RED DB9-3/RED C13 0.1uF GND Driver

DB9-5/Anode DAC_A/IR DB9-9/CATHODE LED

DS00001525B-page 8  2013-2015 Microchip Technology Inc. AN1525

APPENDIX B: MEDICAL DEMO APPENDIX C: REFERENCES WARNINGS, AN1494, “Using MCP6491 Op Amps for Photodet- RESTRICTIONS AND ection Applications”, Microchip Technology Inc., DISCLAIMER DS01494, 2013. This demo is intended solely for evaluation and development purposes. It is not intended for medical diagnostic use.

 2013-2015 Microchip Technology Inc. DS00001525B-page 9 AN1525

NOTES:

DS00001525B-page 10  2013-2015 Microchip Technology Inc. Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet.

• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.

• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

• Microchip is willing to work with the customer who is concerned about the integrity of their code.

• Neither Microchip nor any other manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”

Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

Information contained in this publication regarding device Trademarks applications and the like is provided only for your convenience The Microchip name and logo, the Microchip logo, dsPIC, and may be superseded by updates. It is your responsibility to FlashFlex, flexPWR, JukeBlox, KEELOQ, KEELOQ logo, Kleer, ensure that your application meets with your specifications. LANCheck, MediaLB, MOST, MOST logo, MPLAB, MICROCHIP MAKES NO REPRESENTATIONS OR OptoLyzer, PIC, PICSTART, PIC32 logo, RightTouch, SpyNIC, WARRANTIES OF ANY KIND WHETHER EXPRESS OR SST, SST Logo, SuperFlash and UNI/O are registered IMPLIED, WRITTEN OR ORAL, STATUTORY OR trademarks of Microchip Technology Incorporated in the OTHERWISE, RELATED TO THE INFORMATION, U.S.A. and other countries. INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR The Embedded Control Solutions Company and mTouch are FITNESS FOR PURPOSE. Microchip disclaims all liability registered trademarks of Microchip Technology Incorporated arising from this information and its use. Use of Microchip in the U.S.A. devices in life support and/or safety applications is entirely at Analog-for-the-Digital Age, BodyCom, chipKIT, chipKIT logo, the buyer’s risk, and the buyer agrees to defend, indemnify and CodeGuard, dsPICDEM, dsPICDEM.net, ECAN, In-Circuit hold harmless Microchip from any and all damages, claims, Serial Programming, ICSP, Inter-Chip Connectivity, KleerNet, suits, or expenses resulting from such use. No licenses are KleerNet logo, MiWi, MPASM, MPF, MPLAB Certified logo, conveyed, implicitly or otherwise, under any Microchip MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code intellectual property rights. Generation, PICDEM, PICDEM.net, PICkit, PICtail, RightTouch logo, REAL ICE, SQI, Serial Quad I/O, Total Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries. GestIC is a registered trademarks of Microchip Technology II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies. © 2013-2015, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. ISBN: 978-1-63277-317-3

QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in CERTIFIED BY DNV and . The Company’s quality system processes and procedures

are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial , microperipherals, nonvolatile memory and == ISO/TS 16949 == analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

 2013-2015 Microchip Technology Inc. DS00001525B-page 11 Worldwide Sales and Service

AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office Asia Pacific Office - Xiamen Austria - Wels 2355 West Chandler Blvd. Suites 3707-14, 37th Floor Tel: 86-592-2388138 Tel: 43-7242-2244-39 Chandler, AZ 85224-6199 Tower 6, The Gateway Fax: 86-592-2388130 Fax: 43-7242-2244-393 Tel: 480-792-7200 Harbour City, Kowloon China - Zhuhai Denmark - Copenhagen Fax: 480-792-7277 Hong Kong Tel: 86-756-3210040 Tel: 45-4450-2828 Technical Support: Tel: 852-2943-5100 Fax: 86-756-3210049 Fax: 45-4485-2829 http://www.microchip.com/ Fax: 852-2401-3431 India - Bangalore France - Paris support - Sydney Tel: 91-80-3090-4444 Tel: 33-1-69-53-63-20 Web Address: Tel: 61-2-9868-6733 Fax: 91-80-3090-4123 Fax: 33-1-69-30-90-79 www.microchip.com Fax: 61-2-9868-6755 India - New Delhi Germany - Dusseldorf Atlanta China - Beijing Tel: 91-11-4160-8631 Tel: 49-2129-3766400 Duluth, GA Tel: 86-10-8569-7000 Fax: 91-11-4160-8632 Tel: 678-957-9614 Germany - Fax: 86-10-8528-2104 Tel: 49-89-627-144-0 Fax: 678-957-1455 India - Pune China - Chengdu Tel: 91-20-3019-1500 Fax: 49-89-627-144-44 Austin, TX Tel: 86-28-8665-5511 Tel: 512-257-3370 - Osaka Germany - Pforzheim Fax: 86-28-8665-7889 Tel: 81-6-6152-7160 Tel: 49-7231-424750 Boston China - Chongqing Fax: 81-6-6152-9310 Westborough, MA Italy - Milan Tel: 86-23-8980-9588 Tel: 774-760-0087 Japan - Tel: 39-0331-742611 Fax: 86-23-8980-9500 Fax: 774-760-0088 Tel: 81-3-6880- 3770 Fax: 39-0331-466781 China - Dongguan Fax: 81-3-6880-3771 Italy - Venice Chicago Tel: 86-769-8702-9880 Tel: 39-049-7625286 Itasca, IL Korea - Daegu Tel: 630-285-0071 China - Hangzhou Tel: 82-53-744-4301 Netherlands - Drunen Fax: 630-285-0075 Tel: 86-571-8792-8115 Fax: 82-53-744-4302 Tel: 31-416-690399 Fax: 86-571-8792-8116 Korea - Seoul Fax: 31-416-690340 Cleveland Tel: 82-2-554-7200 Independence, OH China - Hong Kong SAR Poland - Warsaw Tel: 216-447-0464 Tel: 852-2943-5100 Fax: 82-2-558-5932 or Tel: 48-22-3325737 Fax: 852-2401-3431 82-2-558-5934 Fax: 216-447-0643 - Madrid China - Nanjing Malaysia - Kuala Lumpur Dallas Tel: 34-91-708-08-90 Tel: 86-25-8473-2460 Tel: 60-3-6201-9857 Addison, TX Fax: 34-91-708-08-91 Fax: 86-25-8473-2470 Fax: 60-3-6201-9859 Tel: 972-818-7423 Sweden - Stockholm Fax: 972-818-2924 China - Qingdao Malaysia - Penang Tel: 46-8-5090-4654 Tel: 86-532-8502-7355 Tel: 60-4-227-8870 Detroit UK - Wokingham Fax: 86-532-8502-7205 Fax: 60-4-227-4068 Novi, MI Tel: 44-118-921-5800 Tel: 248-848-4000 China - - Manila Fax: 44-118-921-5820 Tel: 86-21-5407-5533 Tel: 63-2-634-9065 Houston, TX Tel: 281-894-5983 Fax: 86-21-5407-5066 Fax: 63-2-634-9069 China - Shenyang Singapore Indianapolis Tel: 86-24-2334-2829 Tel: 65-6334-8870 Noblesville, IN Tel: 317-773-8323 Fax: 86-24-2334-2393 Fax: 65-6334-8850 Fax: 317-773-5453 China - Shenzhen - Hsin Chu Tel: 86-755-8864-2200 Tel: 886-3-5778-366 Los Angeles Fax: 86-755-8203-1760 Fax: 886-3-5770-955 Mission Viejo, CA Tel: 949-462-9523 China - Wuhan Taiwan - Kaohsiung Fax: 949-462-9608 Tel: 86-27-5980-5300 Tel: 886-7-213-7828 Fax: 86-27-5980-5118 New York, NY Taiwan - Taipei Tel: 631-435-6000 China - Xian Tel: 886-2-2508-8600 Tel: 86-29-8833-7252 Fax: 886-2-2508-0102 San Jose, CA Tel: 408-735-9110 Fax: 86-29-8833-7256 Thailand - Bangkok Tel: 66-2-694-1351 - Toronto Tel: 905-673-0699 Fax: 66-2-694-1350 Fax: 905-673-6509 01/27/15

DS00001525B-page 12  2013-2015 Microchip Technology Inc.