pressure_sampler - bruno-beloff/scs_dev GitHub Wiki

docs > software repositories > scs_dev > commands > environmental sampling


DESCRIPTION

The pressure_sampler utility reads an ICP-10101 or MPL115A2 digital barometer. It reports pressure in kilopascals and temperature in Centigrade. The utility always reports the actual atmospheric pressure (pA). It additionally reports temperature and equivalent pressure at sea level (p0) depending on whether the host device's altitude has been configured and the MPL115A2's temperature sensor has been calibrated:

Altitude configuration Temperature calibration pA P0 tmp
not set not set yes no no
not set set yes no yes
set not set yes no no
set set yes yes yes

The pressure_sampler writes its output to stdout. As for all sensing utilities, the output format is a JSON document with fields for:

  • the unique tag of the device (if the system ID is set)
  • the recording datetime in ISO 8601 format
  • a value field containing the sensed values

Command-line options allow for single-shot reading, multiple readings with specified time intervals, or readings controlled by an independent scheduling process via a Unix semaphore.

SYNOPSIS

pressure_sampler.py [{ -s SEMAPHORE | -i INTERVAL [-n SAMPLES] }] [{ -v | -d }]

Options
--version show program's version number and exit
-h, --help show this help message and exit
-s SEMAPHORE, --semaphore=SEMAPHORE sampling controlled by SEMAPHORE
-i INTERVAL, --interval=INTERVAL sampling interval in seconds
-n SAMPLES, --samples=SAMPLES number of samples (1 if interval not specified)
-v, --verbose report narrative to stderr
-d, --debug report detailed narrative to stderr

EXAMPLES

./pressure_sampler.py -i10

FILES

~/SCS/conf/mpl115a2_calib.json
~/SCS/conf/pressure_conf.json
~/SCS/conf/schedule.json
~/SCS/conf/system_id.json

DOCUMENT EXAMPLE - v0

{"rec": "2021-10-06T11:34:18Z", "tag": "scs-be2-3", "val": {"bar": {"pA": 102.3, "p0": 103.5, "tmp": 24.0}}}

DOCUMENT EXAMPLE - v1

{"rec": "2021-10-11T11:08:24Z", "tag": "scs-be2-3", "ver": 1.0, "val": {"bar": {"pA": 103.5, "p0": 104.7, "tmp": 22.6}}}

SEE ALSO

scs_dev/climate_sampler
scs_dev/scheduler

scs_mfr/mpl115a2_calib
scs_mfr/pressure_conf
scs_mfr/schedule
scs_mfr/system_id

RESOURCES

ISO 8601