Updates on pulseox

Standard

The shitty prototype I cobbled together worked at first go! Never before has something at this level of complexity (not exactly complicated, but with so many variables that could go wrong) all checked out green.

I hand soldered male headers onto the reflow soldered board and connected it to an Arduino Uno. I ran the sample code from Maxim and lo – The chip shone red (and IR on the phone) and the serial monitor was populated with rows of data showing Red, IR, HR, SpO2!

It was another thing that the data was super noisy – A heart rate variability of 30bpm is just not done. It’s super easy to get data from sensors and be ecstatic, but making that data reflect something physical is the tough part.

Now that I can extract data from the IC, after I figure out a reliable method for housing, I need to start working on getting this data to matlab and start over with Rajbabu’s DSP fundae again. Additionally, I probably should start thinking about making it wireless using a bluetooth serial link to not have the finger/wrist always close to the computer. Something like this might work great!

Thinking about housing – Easiest to probably buy a wooden clip, and place the optical part of the PCB into a hole drilled in. Which side of the finger? Nail or flesh? Does the whole thing need to be covered by a black sleeve? Which of the approved FDA pulse oximeters use reflectance PPG?

Now onwards to make as many boards as I can and start thinking about putting this PCB onto a housing that can be put around the wrist or the finger.

Breakpoints in prototyping

Standard

When you’re trying to do something that has a high probability of failure/low probability of success, it probably is so because P(A&B) is P(A)*P(B) when A and B are independent events. Say A succeeds 1 in 10 times, and B is similar, the net probability of success is 1 in 100. The easiest way to improve your odds is to break this large chunk of work into smaller independent blocks, which are then worked upon until they have large probabilities of success. Then these blocks are put back together, which increases their probability of success. One might argue that the process of putting blocks together introduces new complications and handshake errors. With enough attention to detail, these can be avoided.

A system to obtain SpO2, HR and RR comprises of multiple independent (arguably) stages. There’s a data acquisition stage, followed by the data processing and user interface stages. The data acquired by the sensor communicates to the microcontroller through I2C and also operates on 1.8V necessitating external circuitry for interfacing. Once the data is acquired by the microcontroller, multiple DSP algorithms need to work on the photoplethysmograph (PPG) to extract respiration induced variations. The user interface involving light/sound/tactile routes form the final piece of system.

Thinking out loud, there are a few things that could be done to speed up the process of development

  • Get a MAX30102 evaluation board (which comes with I2C code to interface to an Arduino). This eliminates most sources of failure at the data acquisition and communication stages. Some of these could be
    1. Poor contacts during soldering
    2. Mistake in PCB design
    3. Firmware issues (i2c communication protocol)

The code running on the arduino can be modified such that it prints the SpO2 value to the serial port. At this stage, the acquisition circuit and sensor can be simply viewed as a blackbox that takes a finger/earlobe and outputs the SpO2 value. This modularity makes the data processing part easier. (the data processing also needs to be done separately, as the atmega 328 is not powerful enough to implement advanced DSP algorithms). Implementing a blackbox for mobile applications is slightly difficult, involving either datalogging using an SD card, or wireless bluetooth transmission. However, the lack of a gold standard (self measured RR for example) to compare these results against renders any efforts in those directions almost useless.

  • Use MATLAB functions to apply the custom filters required to extract RR in real time. There’s serial data input into MATLAB, so it can accept the data that it receives from the Arduino. Once we achieve a proof of concept that RR can be reliably extracted from PPG, the code for the algorithms can be implemented for embedded systems (I’d love to stick with atmega since its the only thing I know, but maybe I need to push myself out of my comfort zone). PJRC’s teensy 3.2 that has a ARM Cortex M4 (sweet sweet 72Mhz) and 32x more RAM + 8x more flash might be something to tack on the next oshpark order.
  • The user interface can similarly be prototyped separately, to decice how loud the sound/ what colours/frequency/intensity the lights need to be to attract a bystander’s attention. More discussion with stakeholders needs to happen to better understand the environment in which overdoses happen.

That being said, the technical requirements/adventures must not take away from the original goal of this effort – to make an ultra low cost vital signs monitor that can act as an early alert system for fentanyl overdoses. I can’t imagine the BOM of such a device being greater than $10. Additional roadblocks towards making a tangible difference with this device might be a classification of this device as a medical device (which it most likely it is), unless I could paste an analog watch face on the top and label it a wellness device (srs, not srs but hlf srs).

 

 

Updates on pulseOx prototyping

Standard

The Breakout PCB’s came in from OSHpark today, and so did the stencils from OSHstencils. I ordered 6 boards in total, 3 with the larger AMS1117 regulator, and the others will the much smaller SOT23-5 package. The stencil for the latter was made with the engphys laser cutter using the gerber files and inkscape.

  

The intended use for this breakout is a platform to use/modify the sparkfun MAX30105 (particle sensor) library for the MAX30102 (pulse ox) chip. This board can be considered the sensor layer v1.0. If required, a temperature sensor can be added on the same board with minimal modifications since the level conversion for the I2C and the power regulators are already on board.

Now that the sensor layer was taking shape, I began thinking about the other layers though which the physiological data had to pass through before it could be acted upon. From a bird’s eye view, the system has three main layers

  1. The sensor layer to acquire data
  2. The uController layer to process this data
  3. A Power management layer
  4. User Interface layer to interact with the used

Based on the conceptual framework that I’ve drawn up, the microcontroller layer would be physically sandwiched by the sensor layer and the battery/UI layers, primarily because the user does not interact with this layer directly in any way (higher level of abstraction). The top layer board will simply be a CR2016 holder or a JST header, with the LED, buzzer and button surrounding the battery footprint. The reason I’m looking at coin cell batteries (CR2016 is 3V, 100mAh) instead of LiPo (usually 3.7V, variable mAh depending on size) is the ability to replace them for cheap, unlike LiPo batteries which can be recharged but are expensive. However, if a LiPo solution needs to be prototyped, then the Adafruit LiPo battery backpack could simply be used.

For the purposes of prototyping, the microcontroller layer can simply be a Adafruit Pro Trinket. It has a footprint of 38mm by 18mm, with an microUSB port for simple reprogramming of the atmega328p. However, the FTDI port will have to be used for communication through the serial port. At the very early stages, and Arduino Uno would be a better prototpying platform (#ObviousOstrich) Though the Pro Trinket is rated for 5V operation, it can work with a 3.7V supply, though the system would not be very robust.

The image above shows a 100mAh LiPo battery connected to the battery management breakout board in the corner, which sits on the microcontroller board.

Building a prototype with a small form factor while including all the desired functionality will require some clever solution to connection to connect these multiple breakout boards to each other. This is a critical step before redesigning the board to include all the components on the same board. Thinking out loud, I can come with flex cables as a possible solution. The ones you see in mobile phones are way out of my league, flex cables with TE AMP connectors might be plausible.

A 2 inch length FFC connector with 4 solder tabs costs around 70cents and is custom made by digikey. A crude but effective solution might be to solder small gauge wire between the boards directly.

 

The MAX 30100/2 chips

Standard

A breakout for the MAX 30105 on Sparkfun introduced me to this chip family from Maxim. 30105 detects smoke using IR, Red, Green LEDs to illuminate the surroundings and a photon detecter to sense. The cool part is that the the light source and the detector are part of the IC package, along with an ADC, LED driver electronics. The sensor output to microcontrollers is through i2c.

As it turns out, Maxim has a couple of other chips (MAX 30100/1/2) in the same family, which work on the sample principle but are specialized towards measuring heart rate as well as SpO2.

(oops, sorry Premier Farnell – Totally non commercial purposes)

The easiest way to prototype would be to use a development kit offered by maxim, but unluckily the board is not in stock, and will take atleast 6 weeks for the shipment to come in. Maxim was really kind to offer me free samples of the MAX 30100 and the 30102, so the next logical step was to make my own breakout board.

Sadly, the package is non standard and features an 0.8mm pitch necessitating the need for a custom breakout board and a stencil to solder the component to the PCB using reflow. I relied on my trusty purple gold PCB supplier, OSH Park. I made the OLGA chip package for Eagle myself, so I’m not sure if it turned out right. I guess I’ll cross the bridge when I get there.

I was too cheap to order a breakout from OSH Stencils, but I could possibly use the Eng Phys project lab laser cutter to make a very basic mylar or kapton stencil.

As I dug more into the datasheet of this IC, I found that it shared a lot of similarities with the MAX 30105 – The chip used in the sparkfun breakout. I just decided to send the eagle brd files (which are open sourced under OSHW licensing – I owe Nate Seidle a beer when if I ever meet him) to OSH park as well as get a kapton stencil at OSH stencils. There’s some level converted circuitry on the breakout as well as a 1.8V SMD LDO. As I have not broken into my SMD reflow/hot air rework setups yet, I think a combination of the simple breakout shown above and circuitry on the breadboard has the greatest chance of success.

I’ve been thinking about how to miniaturize this system if it works, and here’s my thoughts on the topic

  1. Integrating it into a fitness band/watch form factor is useful to make it unobtrusive and ensure compliance.
  2. The round face can be as large as the 3V/3.3V coin cell battery required to power the system. Alternatively a LiPo battery can also be used. If a LiPo battery is used, a battery management IC needs to be used.
  3. A low power microprocessor capable of I2C
  4. A high frequency speaker and a high intensity LED.
  5. The PulseOx would have to be on the opposite side of the battery and the electronics, on the wrist.

 

Opioids and Vital Signs

Standard

Even before Rohit messaged me with a problem statement on developing an early alert system on the opioid crisis (which converted an academic interest into a tangible goal), I was intrigued by the effects of opioids on the nervous system and breathing in particular. I found this really cool review paper talking about the specific mechanisms of opioids binding to receptors in the parts of the brain (the brain stem) known to influence respiration.

The questions I’m asking myself

  1. Once a drug bolus is injected intravenously, how long does it take for the drug to reach the target receptors in the brain stem?
  2. What is the time delay between receptor binding and apnea (cessation of breathing)?
  3. By how much time does hypoxia lag apnea?

Coincidentally, my roommate Ryan is a PhD student in zoology working on the nervous system control of respiratory rate (specifically hibernation) in murine models. When I directed these questions to him, I found out a few facts that surprised me.

  1. The opioid binding to receptors is immediate once introduced into the blood and so is the respiratory depression.
  2. However, loss of consciousness can occur before the SpO2 drops, which might mean that pulse oximetry itself is redundant as an early marker.
  3. The drop in SpO2 is sharp with respect to time.

Respiratory rate and pulse oximetry are therefore crucial signs that need to observed post OD. As a change in respiratory rate precedes one in SpO2, an early detection system must rely on the former. Respiratory rate can be measured through multiple invasive methods such as capnography (measuring CO2 concentration in the expired volume) and impedance capnography (4 probe electrodes on the chest which measure impedance change). However, I came across the Nellcor technology from Medtronic-Covidien which is a software that calculates the respiratory rate using nothing but the photo plethysmograph (PPG). They allude to observing changes in the baseline value, amplitude and frequency in the pleth waveform, assigning weights and averaging over a 40 second interval to compute respiratory rate.

I found an academic abstract that discusses respiration induced variations in the PPG waveform which concludes that amplitude variations correlate with the respiratory rate. However, this correlation is confounded and overshadowed by motion artifacts. Applying excessive pressure through the pulseOx sensor has similar effects.

To conclude, a pulseox vital signs system can and should definitely be prototyped as a possible solution to early diagnosis. The next few posts will focus about issues such as human centered design, user compliance and technical details of the prototyping of a PulseOx system.

Addressing Fentanyl ODs in Vancouver

Standard

r/vancouver is my go to place for all the local news. A recent post gave me a huge jolt. 9 people had overdosed on drugs in a single night. Drugs such as heroine and cocaine are being increasingly cut with fentanyl to increase their potency. As the amount of fentanyl can vary from batch to batch, a “safe” dose could easily cause a user to overdose.

As a reactive measure, the civic authorities have started programs to educate users and the general public about fentanyl, signs of an overdose and safety precautions. At-risk users are also given a Naloxone/Narcan kit for free, which counteracts the effects of the drug.

(BC Coroners service)

Clearly there has been a downward trend over the latter half of 2016 ever since a public health emergency was declared in April. As of October 27th, 2600 Naloxone kits have been distributed by Vancouver Coastal Health. Additionally, the Provincial Health Safety Authority (PHSA), through the British Columbia Center for Disease Control (BCCDC) has a take home Naloxone program which has handed out approximately 6,000 kits so far.

In an ideal world, everyone at risk of a fentanyl overdose would be next to a bystander carrying a naloxone kit. Sadly this isn’t the case. In a real world scenario, identifying the signs of an overdose and reacting to it faster could save more lives. As a working hypothesis, I think that a vital signs tracker and alert system given out for free to the population at risk can substantially reduce fentanyl OD deaths.

A technological solution/road map furthering this hypothesis will be presented in the next post.