Using the Sip and Puff Code

Once installed and running, the code is pretty simple. When the program starts it will set the currently measured barometric air pressure and set it as 0 hPa so that the following measurements are made relative to it. While idle the screen will display the following:

  • WAITING FOR INPUT - This is the current measurement state. This will be updated during use to include the current measurement state to be one of WAITING FOR INPUT, SIP/PUFF STARTED...,  or DETECTED:
  • min - The low pressure threshold in hPa. Any measurement negative or positive will have to be this many hPa above or below the ambient pressure. This helps prevent incidental variations in the air pressure from triggering events when not intended. You may wish to tune this value to your particular needs
  • hi - The high pressure threshold in hPa. Measurements that are this many hPa above or below ambient pressure will be registered as a Strong event. Anything below it but above the low pressure threshold will be registered as a Soft event
  • Press - The current pressure measurement in hPa. This value will vary in real time as negative or positive pressure is applied to the sensor. You can use these measurements to determine what your min and hi thresholds should be. If you watch this measurement while the sensor is idle, you will be able to see the regular variations in ambient pressure that make the low threshold necessary.

Detecting Sips

While the program and sensor are idle, applying positive pressure above the min amount will trigger the start of a puff event.

If you don't exceed the hi threshold, releasing the pressure will result in a SOFT SIP event being triggered.

If you do exceed the hi threshold, when you release the pressure it will trigger a STRONG PUFF event.

Along with the type of event detected, the Duration of the event in seconds will be displayed.

Along with the information displayed on the OLED screen, the pressure events will also be printed to the serial console:

Detecting Puffs

While the program and sensor are idle, applying positive pressure above the min amount will trigger the start of a puff event.

If you don't exceed the hi threshold, releasing the pressure will result in a SOFT PUFF event being triggered.

If you do exceed the hi threshold, when you release the pressure it will trigger a STRONG PUFF event.

Along with the type of event detected, the Duration of the event in seconds will be displayed.

Like with sips, puff events will be printed to the serial log as well:

Configuring the Pressure Thresholds

Since people will have their own needs when it comes to how much or little pressure they will want to to trigger events, we've made it possible for you to easily change these thresholds by adding a simple JSON file to the root of the CIRCUITPY drive along with the code. Edit the JSON below to have your desired pressures and then save it to the CIRCUITPY drive, making to preserve the filename of settings.json

{
  "MIN_PRESSURE": 10,
  "HIGH_PRESSURE": 60,
  "DISPLAY_TIMEOUT": 1
}
This guide was first published on Feb 17, 2020. It was last updated on Feb 17, 2020.
This page (Usage) was last updated on Oct 24, 2020.