Skip to main content

A HX711 Driver

Project description

HX711 driver library

Description

This library allows to drive a HX711 load cess amplifier with a Raspberry Pi by using gpiozero library.

  • to set channel and gain
  • to read raw value

This package requires gpiozero to be installed in Python 3.

Example

from hx711_gpiozero import HX711
from time import sleep

spi = HX711()
print("Initiatin ...")
init_reading = spi.value

sleep(1)
input("Put a known mass on the scale, then press `enter`.")

try:
    rel_weight = float(input("What is the weight of the known mass?\n"))
except ValueError as err:
    print(err)
    print("(The input of weight can only be numbers)")
    exit(1)
rel_reading = spi.value
scale_ratio = rel_weight / (rel_reading - init_reading)

sleep(1)
while True:
    weight = (spi.value - init_reading) * scale_ratio
    print(weight)
    sleep(1)

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

hx711_gpiozero-0.0.3.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hx711_gpiozero-0.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file hx711_gpiozero-0.0.3.tar.gz.

File metadata

  • Download URL: hx711_gpiozero-0.0.3.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for hx711_gpiozero-0.0.3.tar.gz
Algorithm Hash digest
SHA256 312aa0f6ed9623d6cf17b560eb8340da9cf0e0a763d72deb0294ffd1ac637b4f
MD5 8029622b3b80c712ad0a1ceb07303c2a
BLAKE2b-256 056c922cccec22afade34d006e4dcb027e9b97f95eee7458b71acbf8253b0af7

See more details on using hashes here.

File details

Details for the file hx711_gpiozero-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: hx711_gpiozero-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for hx711_gpiozero-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aac2c00290cf1761ccb940a532f6e91df42e6a23ff61c80b0dbbedf51efcf90a
MD5 807eae0d95c192da68704e605ee1bf8e
BLAKE2b-256 6146a2201359e02c42a3af67a8b36f3579d3419b0b80b1de645084f82628ef3c

See more details on using hashes here.

Supported by

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