Skip to main content

A HX711 Driver

Project description

HX711 driver library


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.


from hx711_gpiozero import HX711
from time import sleep

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

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

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

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

Project details

Download files

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

Files for hx711-gpiozero, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size hx711_gpiozero-0.0.3-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hx711_gpiozero-0.0.3.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page