pimoroni-pico/micropython/modules/breakout_icp10125
Phil Howard 77a5edc83f MicroPython: Update to support new slots mp_obj_type_t.
Follows the lead from: 662b9761b3

Update to support MP_DEFINE_CONST_OBJ_TYPE with backwards compatibility.
2023-01-11 09:46:45 +00:00
..
README.md Python bindings & docs for ICP10125 2021-09-08 14:10:21 +01:00
breakout_icp10125.c MicroPython: Update to support new slots mp_obj_type_t. 2023-01-11 09:46:45 +00:00
breakout_icp10125.cpp MicroPython: Drop redundant Print. Saves 4K. 2022-06-13 18:59:51 +01:00
breakout_icp10125.h MicroPython: Drop redundant Print. Saves 4K. 2022-06-13 18:59:51 +01:00
micropython.cmake Python bindings & docs for ICP10125 2021-09-08 14:10:21 +01:00

README.md

ICP1025 High-accuracy Barometric Pressure & Temperature Sensor

The ICP1025 library is intended to drive the TDK InvenSense ICP10125 temperature and pressure sensor.

Getting Started

Construct a new PimoroniI2C instance for your specific board. Breakout Garden uses pins 4 & 5 and Pico Explorer uses pins 20 & 21.

import breakout_icp10125
import pimoroni_i2c

i2c = pimoroni_i2c.PimoroniI2C(4, 5)

icp10125 = breakout_icp10125.BreakoutICP10125(i2c)

Taking A Measurement

The measure method triggers a measurement, blocks for enough time for the measurement to complete, and returns the result as a tuple with three values:

  1. Temperature (degrees C)
  2. Pressure (Pa)
  3. Status

If the status is icp10125.STATUS_OK then the reading is valid. Otherwise you should probably discard it or attempt another reading.

For example, the following code will continuously poll the ICP10125 for NORMAL readings and print them out if they are valid:

import breakout_icp10125
import pimoroni_i2c

i2c = pimoroni_i2c.PimoroniI2C(4, 5)

icp10125 = breakout_icp10125.BreakoutICP10125(i2c)

while True:
    t, p, status = icp10125.measure()
    if status == icp10125.STATUS_OK:
        print(t, p)
    time.sleep(1.0)

Measurement Types

The ICP1025 has eight measurement commands. Four are supported by this library since the remaining four are identical save for the order of Temperature/Pressure data readout being reversed.

Each measurement type has a fixed duration.

Normal

Normal measurements are the default type, and take 7ms to complete offering a good balance of stability and speed.

result = icp10125.measure(icp10125.NORMAL)

Low Power

Low-power measurements take just 2ms and trade stability for speed/power efficiency.

result = icp10125.measure(icp10125.LOW_POWER)

Low Noise

Low-noise measurements take 24ms (roughly 3.5x as long as normal) and trade speed for stability.

result = icp10125.measure(icp10125.LOW_NOISE)

Ultra Low Noise

Ultra Low-noise measurements take 95ms

result = icp10125.measure(icp10125.ULTRA_LOW_NOISE)