Thermistor airflow sensors


Airflow sensors, especially in the domain of sleep diagnostics, measure respiration rate and flow in general use thermistors as the temperature sensors. Each airflow sensors consist of three thermistors, positioned at each nostril and over the mouth. Thermal airflow sensors work on the principle of the different temperature of the ambient air while breathing in (ambient air temperature) vs. breathing out (37 degrees).

Sensors available on the market are mucha expensive and possibly proprietary connections leading to bulky connections. Might make sensor to build our own.

The base sensor that we are choosing to use is a glass encapsulated DO35 package through hole thermistor from digikey.

Some characteristics

  • DO-35 package (JEDEC Standard)
  • Glass encapsulated
  • Resistance of 50K at 25degrees C
  • Time constant
    • 5 seconds (Still Air)
    • 0.5 seconds (Stirred Liquid)
    • Response time of air with convection should lie between above limits
  • RT curve is shown in the curve below
    • 55K at 23 degrees C
    • 30K at 37 degrees C
  • 20mW maximum power
    • Current through thermistor must be less than 0.8mA (800uA)
    • With a 47K resistor in series, currents are on the order of 60uA (well under 800uA limit for max power)

Implications of these characteristics

  • Sensor head is approximately 5mm wide
  • DO35 footprint on PCB is also ~5mm
  • For  5 second response time, sensor can detect 12 temperature changes a minute, or 6 breath cycles (each breath cycle is temperature increase followed by a decrease) – 6bpm limit
  • For a 0.5s response time, RR limit is 60bpm
  • Including the thermistor in a resistance bridge (with 47K ohm resistor) to function as resistance to voltage converter, the output voltage changes from 2.7V@23 degrees to 1.94V@37 degrees
  • Increase in ambient temperature leads to to a decrease in output voltage range
  • It is also important the the current through the thermistor be as low as possible to avoid any resistive heating effects that cause a temperature change

Thermistor circuits
Using a precision current source is the right way to exploit the Resistance-Temperature relationship of a thermistor.

However, we do not require absolute temperature but rather relative temperature changes. As such, simply placing a 47K resistor ensures that the currents are within the max power limit, and that the output voltage has substantial change.

Using an opamp however as a buffer block (negative feedback with gain 1) can prevent any loading/interference on part of the microcontroller circuit

Test circuits

  1. Wearable #1


  • Designed for wires to be wound around ears. Header/wire connections at either end.
  • 2 separate thermistors for nostrils (15 degree angle, 0.3′ apart)
  • Thermistor for mouth airflow temperature
  • Simple Resistor bridge circuit
  • Thermistor is the GP103J4F
  • 1206 resistors (10K) – Easy manual solderability
  • Ordered on 13 Nov, Oshpark Swift, free shipping

2. Breadboard #1


  • Thermistors
  • Through hole resistors
  • DIP opamp


Karmik Training Session


Base info – For all Naloxone trainees

  • Language matters
  • Person first
  • Non judgmental language
  • Stigma
  • Actively involve individuals to participate in their own care

Public Health Emergency

  • Peaks in overdose deaths ’95 and ’99
  • 4 pillars strategy of Harm Reduction enacted in early 2000’s along with the foundation of insite.
  • Increasing since 2010-11
  • Doubling every year, since the last 2 years

Substance classification

  • CNS Depressants (D)
    • Opioids* – Fentanyl
      • Further subtypes of opioids
      • Fentanyl Analogues – Synthetics
      • Carfentanil is an Elephant Tranquilizer
    • Alcohol
    • Benzo
    • GHB
  • Stimulant (S)
    • Cocaine
    • Meth
    • Nicotine
    • Caffeine
    • Ecstacy

Risk of overdose

  • Route of administration
    1. Don’t Use – Least Risk
    2. Swallow
    3. Snort/Smoke/Insert
    4. Injected – Highest Risk
  • Lower Tolerance
    • After a break
    • Detox/Jail
    • New
    • Lung/Liver
    • Recent OD
  • Age and Physical health – Old / Compromised immune system
  • Mixing Substances – Don’t!
    • D+D
    • D+S. Use D before S

Risk Minimization

Testing drugs

  • Reagent Kits
  • Can be borrowed from Karmik
  • Fentanyl Dip Sticks – Every supervised consumption site
  • Dose-dose variability of synthetic fentanyl causing differing outcomes

Not Using Alone

  • IV – 30-40 seconds
  • Develop overdose plan
  • Leave door ajar
  • Call someone

Naloxone basics

  • Opioid Antagonist
  • Naloxone amendments
    • Mar 22, 2016 – Remove from prescription drug list
    • Oct 13, 2016 – Enable all people to use Naloxone outside a hospital settings
  • Good Samaritan Drug Overdose act – Bill C224 – Immunity from Drug possession (simple possession, not distribution amounts / production etc) or breach charges for those who seek help in an emergency (If you’re not on parole/pre-trial release)
  • Half-life of naloxone
    • Naloxone 30-90 minutes (least)
    • Morphine/Hydrocodone/Heroin 4h
    • Methadone 24h

Opioid Overdose symptom recognition

  • Unconscious/non-responsive
  • Depressed breating
  • Small pupils

Non opioid overdose symptoms

  • Depressants – look a lot like opioid symptoms
  • Stimulant – Fast pulse, short of breath, chest pain, elevated temp, agitation



“They’re dying behind locked doors with kits in their hands/around them”

Pulse sensor hardware walkthrough


This is the current schematic of the hardware used by the open sourced pulse sensor board (credits to Joel Murphy @ we are currently using. I will run through it to so as to give a brief idea of what each component does in the scope of the inputs and outputs to the system. Also, I will discuss ways to mitigate risks and problems with the board.

Inputs and Output

The inputs to the system are simply V+ (can be either 3.3V or 5V) and GND. They are used to power up the LED, the photo detector as well as the opamp. The output from the system measures the amount of light received from the photosensor after noise filtration, amplification and modulated about the baseline.

Parts of the circuit

Diode Protection The photodetector and opamp are protected by a schottky diode (D2) in case the V+ and GND are reversed.

LED driver circuit The LED D1 is forward biased and connected between V+ and GND through a 470Ohm resistor. Typical forward voltage of the LED is 3.3V, so when powered with a 5V input, the LED draws 3.6mA.

Photodetector ADPS-9008 is the photodetector model being used. Its spectral sensitivity is similar to the human eye, which means it is sensitive to RGB, but not IR. The photodetector converts the incident light into a current output which is pushed out the chip through the output pin. The light (and current) consists of a DC component (made up of light reflected from tissue and bone) and a pulsatile AC component (light reflected from blood). The output current goes from 40uA at 100lux light signal to 200uA at 500lux (almost linear response). When this current is sunk into the 12k ohm resistor, the voltage at the output pin can go up to 480mV (100lux) to 2.5V (500lux).

Signal conditioning

Concepts helpful for circuit analysis 

Principal of linear superposition An input signal can be broken down into different components that together add up to it. The response of the circuit to each of these components can be analyzed separately and all the responses added up to give the response to the total input.

Impedance of capacitor The impedance(resistance to flow of current) of capacitors to different voltage signals depends on the frequency. Lower the frequency, higher the resistance of capacitance. For truly DC signals, capacitors act as infinitely high impedances similar to open circuits.

DC circuit analysis Capacitors C3 and C4 act to disconnect the circuit into two independent parts. For any constant voltage input, the output is expect to be 0.5*V+ as the capacitors decouple the two parts of the circuit.

AC circuit analysis All supply rails go to AC ground.


As mentioned previously, the resistor R2 is used a current to voltage converter, translating the current output of the photosensor into a voltage.


R5 and R6 act as a inverting gain amplifier with an eye popping gain of 330 (3.3MOhm/10KOhm). By giving the +ve terminal of the opamp a virtual ground voltage of 2.5V, the amplification is centered around 2.5V.


Current to voltage conversion The current output through the photodetector is sunk into the

Package, Fabrication and Assembly considerations

Diode In its current form, the diode is in an 0603 package and hence leading to loss of yield during assembly. To avoid this, this package will have to probably be modified to a SOT or SOD package.

LED The LED is a reverse mount Z bend LED that can be mounted on the component side of the PCB but still emits light towards the other side through a through hole drilled in. Alignment and orientation of the LED light with the through hole is mediated by the surface tension of molten solder pulling it into a symmetrical position. Hence, the tCream layer dimensioning is critical for output signal. The positioning can also be corrected using a smaller drill hole ensuring a snug fit. The current version of the PCB has a higher prescribed tolerance so as to get the LED into the hole in the first place. Now that this has been confirmed, the tolerance can be reduced.

Addnl. notes When the LED is viewed from the back, the smaller metal bit in the die goes to the higher voltage.

Connections between components in the device


The pulse sensor needs to be connected to the circuit. The circuit playground has 12 ENIG contacts onto which wire from the pulse sensor/other places can be soldered onto. While soldering wires onto a wires we need to keep in mind a few things

  • How strong is the connection – Leads on to reliability considerations
  • What is the mechanical load on the joint? How can it be relieved? (glue gun?)
  • Is there a possibility of interference with other wires/signals? (parasitic capacitance, cross talk and exposed metal
  • Ease of making a connection

After thinking about this, the easiest method I can think of is generous application of the cheap aliexpress solder past on the contact and hot air gun treatment to reflow and bond. This could be followed by application of hot glue for stress relief (can’t be done if the system needs to be reconfigured. Solder can be removed using a wick, but glue is much harder.

A similar method may be used for connecting the pulse board to the wires as well.

Anatomy of the wrist and sensor positioning/interfacing


The pulse is strongest in the arteries. A strong pulse is required to get a PPG of large amplitude from which the respiratory rate induced variations can be discerned. Traditionally, medical practitioners have palpated arteries such as the carotid or the radial to estimate pulse. The really experienced ones can also figure out problems with the left ventricle from the pulse itself. There are two main arteries in the wrist, the radial and the ulnar arteries. They are named based on their anatomic location in the forearm.

Images of actual palpation give further clues towards the sensor position on the wrist.

After deciding a suitable position, the method of mounting on skin has to be decided. The sensor breakout could be house in a 3D printer enclosure with a hole through which the sensor package on the PCB is inserted. The enclosure can be covered with black silicone (from 3M) to interface to the skin acting as a vibration dampener to remove motion artifacts due to sensor motion. The motion artifacts introduced into the pulse signal itself cannot be corrected for. From a design standpoint, we can only expect that respiratory depression due to opioids is also accompanied by cessation of unnecessary motion.

Crowdsourcing algorithm development


When one has an open sourced project like this, it makes sense to get as many people pitching in as possible. This provides diverse perspectives and speeds up the development process as well, leading to a better device getting into the hands of the user faster. Crowdsourcing hardware might be hard, as not everyone has access to a work bench or the large time chunks it demands. Software, however is more accessible, requiring only a charge laptop, and arduino and the sensor breakout. The hardware needs to work reliably and capture a physiological reading sufficiently well, before one can even think about testing various algorithms. (sub goal – make reliable housing)

Hence, goal – build atleast 3-4 prototypes and reach out to people who would be interested in testing device out. Is this the seed for a “developer testing program” of an open sourced project?

Conversation with Sarah Blyth


Sarah Blyth is a two term vancouver parks board commissioner, volunteer with the overdose prevention society, manager of the DTES markets and an all-round amazing person. When I reached out to her twitter asking to know more information about the conditions on the ground regarding opioid overdoses, she got back to me immediately and we had a great chat about the problem at hand.

Sarah confirmed the working hypothesis for the overdose deaths I had formulated after Andrea Woo’s (the Globe and mail) gracious response to my unsolicited tweets. The overwhelming majority of deaths occur indoors in users homes and apartments due to respiratory depression. The user cannot detect signs of distress/self inject Narcan in time, nor are any capable bystanders present. 

This scenario is captured very well in this heart-rending overdose incident that led to Mary Purdy’s death.

Marie (Mary’s sister) said Purdy died Jan. 17 of a fentanyl overdose at home. Her two boys sat beside her lifeless body for hours until they were discovered by an ex-boyfriend, who had come to check on her.

“(The six-year-old) said that she fell over, and she wasn’t breathing, but he couldn’t find the phone to call 911, so he sat with her for hours,” said Marie, who choked back tears as she talked about her younger sibling.

Unprompted, Sarah suggested that a solution that detected a flatlined pulse and called 911 to inform them of the location could help. (however, such a device would be quite expensive and would involve recurring costs due the requirement of connectivity to a mobile network). I tried to learn more about the conditions where such an overdose might occur though I didn’t get very far. Only learnt that the indoor conditions might be very similar to condos or closely spaced houses typical to Vancouver. Then, I tried to steer the discussion towards how such a device would get into the users hands. Sarah replied that the overdose prevention society’s pop-up supervised injection site where she volunteers would be a way to reach out to the community. She suggested that the device could even be tested under human supervised conditions at the pop-up tent, which has an enviable record of saving every single user who has ODed on site.

I then introduced my idea of alerting bystanders versus 911 because of the cheaper price. This solution has decreased utility as compared to a transponder with a pulseoximeter, but also can be made at a much cheaper price. While a full fledged system needs a GPS+GPRS module and a pulse oximeter on the wrist, the latter simply has the pulseoximeter, a speaker and lights.

Now, I need to make a few “testable” devices. This shall be interesting.

Standard of comparision for RR from Pulse Ox


So, hypothetically when I do extract RR from pulseOx (maybe I need to do that first, before even considering this question), how do I know what I’m measuring is right?

This question led me to ask which other methods of measuring RR could I use to increase confidence in my estimate. The simplest way is to keep count. This quickly gets irritating. The other way is to use capnography (yuuge setup and cost). Impedance capnography needs electrodes. Theoretically, I could look at the phrenic nerve/diaphragm – but there’s no practical way. IMU measurement of chest motion (which the BEST team uses for the respiratory rate). Can be used to get a decent estimate of BPM (breaths per minute).

Ideally, I’d like a way to transmit Acceleration and Gyroscope data to the PC using bluetooth at the same time the pulseox is transmitting data over serial so I could look at both together. So, I’m using the HC-05 bluetooth module to transmit this data. The module connects to VCC, GND, TX and RX of the microcontroller. The HC-05 module itself is 3.3V, but has level conversion circuitry to accept 3.3V to 6V Vcc. As for the IC, I chose the LSM6DS3 because it is cheap, has 6DOF, a huuuge FIFO buffer, good libraries and circuit schematic I can base my design off of (Amazing souls at sparkfun). The LSM6DS3 communicates to the microcontroller through I2C and 3.3V logic. As bluetooth and the main chip were using 3.3V logic, it made sense to go with a 3.3V development board. I chose to use the Arduino Pro Mini (the 0.8mm version Sparkfun makes) with an atmega 328P. The whole thing can be powered by a 3.7V LiPo battery through a JST header. I managed to fit a 4 pin right angled header for the HC-05 module, the IMU and a JST header on the footprint of the pro mini to make a header. The bluetooth module can be connected into the female header. This is my first wholly contained wireless design. Some parts may take time to arrive, so I’m looking to get this board working by the end of this month.

I hope it works : )

FDA on Pulse Oximetry – An amazing resource


If there’s one takeaway from Bruno Jaggi’s BMEG 556 at UBC, it’s that the FDA is an amazing resource through the process of medical device development. This has been something I have learnt time and again in a very organic fashion. Once I’ve finished reading all the usual internet links about a certain healthcare device and want to delve deeper, I end up on the FDA’s repositories.

In this case, I started browsing the interwebz to figure out what the best housing for reflectance pulse oximetry was. I started off on an FDA report describing pulseox issues from the perspective of reflection and transmittance. This report talks about the 510k approval process for new pulse oximeters (comparison to an existing approved device with similar specs, for those curious) with a special note on the use of pulse oximeters for over the counter uses.

You see, one of the biggest questions I’ve been asking myself since starting this project was how this device (if marketed), would be classified and if it could ever be “given away” to the intended user without a prescription. A “vital sign” monitor like pulseox, HAS to be classified as a medical device. However, this report refers to nonin finger oximeters for use by high altitude climbers to detect for signs of altitude sickness. Could recreational drug use be one of the exceptions for over the counter use of the MAX30102 sensor? Do I still have to jump through all the regulatory hoops?


Additionally, the document gives a great summary of the types of oximeters, reflectance and transmittance in a single paragraph, which I shall reproduce here.

Pulse oximeter sensors may be implemented in either a transmittance or reflectance configuration. In both configurations, light is scattered by blood, which has time dependent characteristics, and bone or other tissue structures which are not time dependent. Transmittance sensors are configured in a manner where the emitter outputs light which travels through tissue (e.g. finger, toe, and ear) and is received on the opposite side by the detector. Reflectance sensors are configured with the emitter and detector in the same plane. Emitted light must reach the detector by reflection off a surface which typically results in smaller signal strengths in comparison to transmittance sensors. Significant differences in the tissue region sampled are a function of emitter/detector geometry. Differences in light propagation between the transmission and reflectance-based system would affect the relative amount of arterial blood sampled, average photon path length, the absorption characteristics of non-blood regions sampled (e.g. dermis, fat, bone, etc.).

  • Blood has time dependent light scattering characteristics while bone and other tissue does not
  • Reflectance sensors typically have smaller signal strengths as compared to Transmittance
  • Critical variables affecting signal
    • Emitter/detector geometry
    • Amount of arterial blood sampled
    • Average photon path length
    • Absorption on non blood regions
  • Motion artifacts!!!!!

For approval of applications, they ask for a desaturation study (6 minute walk test, and looking at SpO2) with 200 data points.

The guidance document for 510k submissions on pulseoximeters is a good resource as well. But this one talks more about what needs to part of the 510k for the