Skip to main content

To use QMP6988 with pigpio.

Project description

# Installing

Stable library from PyPi:

  • Just run pip install piqmp6988

# PiQmp6988’s Methods

## Constructor(config={})

‘config’ is dictionary type.

### ‘address’

Configure I2C address of QMP6988.

  • Address.LOW.value
    • I2C address is 0x70

    • Default

  • Address.HIGH.value
    • I2C address is 0x56

### ‘filter’

Configure Infinite Impulse Response(IIR) Filter coefficient of QMP6988.

  • Filter.COEFFECT_OFF.value
    • Do not use IIR Filter

    • Default

  • Filter.COEFFECT_2.value
    • IIR filter coefficient is 2

  • Filter.COEFFECT_4.value
    • IIR filter coefficient is 4

  • Filter.COEFFECT_8.value
    • IIR filter coefficient is 8

  • Filter.COEFFECT_16.value
    • IIR filter coefficient is 16

  • Filter.COEFFECT_32.value
    • IIR filter coefficient is 32

### ‘mode’

Configure Power Mode of QMP6988.

  • Powermode.SLEEP.value
    • Power Mode is SLEEP

    • Default

  • Powermode.FORCE.value
    • Power Mode is Force

  • Powermode.NORMAL.value
    • Power Mode is Normal

### ‘pressure’

Configure average times for pressure measurement of QMP6988.

  • Oversampling.SKIP.value
    • Do not measure pressure

    • Default

  • Oversampling.X1.value
    • Single Shot value

  • Oversampling.X2.value
    • Average 2 times for mesurment value

  • Oversampling.X4.value
    • Average 4 times for mesurment value

  • Oversampling.X8.value
    • Average 8 times for mesurment value

  • Oversampling.X16.value
    • Average 16 times for mesurment value

  • Oversampling.X32.value
    • Average 32 times for mesurment value

  • Oversampling.X64.value
    • Average 64 times for mesurment value

### ‘temperature’

Configure average times for temperature measurement of QMP6988.

  • Oversampling.SKIP.value
    • Do not measure temperature

    • Use 25.0 celsius value when ‘pressure’ measure

    • Default

  • Oversampling.X1.value
    • Single Shot value

  • Oversampling.X2.value
    • Average 2 times for mesurment value

  • Oversampling.X4.value
    • Average 4 times for mesurment value

  • Oversampling.X8.value
    • Average 8 times for mesurment value

  • Oversampling.X16.value
    • Average 16 times for mesurment value

  • Oversampling.X32.value
    • Average 32 times for mesurment value

  • Oversampling.X64.value
    • Average 64 times for mesurment value

## read()

Read temperature and pressure. Return value is dictionary type.

### ‘temperature’

  • OK
    • Type: float

    • Celsius temperature value [℃]

  • NG
    • Type: False

### ‘pressure’

  • OK
    • Type: float

    • Atmospheric pressure value [hPa]

  • NG
    • Type: False

# Sample

Run sudo pigpiod before running the sample.

## Indoor navigation (from QMP6988 Datasheet)

# -*- coding: utf-8 -*-
import piqmp6988 as QMP6988
import time

config = {
    'temperature' : QMP6988.Oversampling.X4.value,
    'pressure' :    QMP6988.Oversampling.X32.value,
    'filter' :      QMP6988.Filter.COEFFECT_32.value,
    'mode' :        QMP6988.Powermode.NORMAL.value
}

obj = QMP6988.PiQmp6988(config)

try:
    while True:
        value = obj.read()
        if (isinstance(value['temperature'], float)):
            print("%8.2f" % round(valueb['temperature'], 2))
        if (isinstance(valueb['pressure'], float)):
            print("%8.2f" % round(valueb['pressure'], 2))
        time.sleep(10)
except KeyboardInterrupt:
    pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piqmp6988-1.0.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

piqmp6988-1.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file piqmp6988-1.0.1.tar.gz.

File metadata

  • Download URL: piqmp6988-1.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for piqmp6988-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1a757fb1408f8c9da2a9299e05280d859777a216fd72685aeded938d1e5e024b
MD5 a823eb4f15bc3ddabcb31086421b7871
BLAKE2b-256 352094ef3ab59cd1ba4b6b022ee5dcf775bc3a28b35dd3b3b1b3ff086d1d08ae

See more details on using hashes here.

File details

Details for the file piqmp6988-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: piqmp6988-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for piqmp6988-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39e63223ce74e46ba9404a769f1be8529b749ce8d8a57eba3ef841fb5ea0194
MD5 f6aebf711f31c746c1834c4450c2950b
BLAKE2b-256 973ec863ce62190013fbdc84536296be500fb69ddde208ddedc220596b18ae31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page