Skip to main content

Python driver for Arduino+HX711 serial weighing scales.

Project description

serial-scale-hx711

PyPI

Python driver for Arduino+HX711 serial weighing scales.

Renamed from serial-weighing-scale (PyPI: serial-weighing-scale ≤ 2.0.4). New releases publish under serial-scale-hx711. A deprecation stub remains on PyPI under the old name pointing here.

Hardware

  • Arduino Uno (USB-A to USB-B cable)
  • HX711 load cell amplifier (e.g. SparkFun SEN-13879)
  • Load cell 100 g or 500 g (e.g. SEN-14727 / SEN-14728)
  • Firmware: see scale_firmware/ (uses olkal/HX711_ADC)

The scale identifies itself as <SerialWeighingScale> over 115200 baud.

Install

pip install serial-scale-hx711

Or editable from this repo:

pip install -e .

Usage

from serial_scale_hx711 import Scale

scale = Scale(serial_port="/dev/ttyACM1")
scale.start()          # connect and wait for firmware init
scale.tare()
weight = scale.read_weight_blocking()   # grams, blocks until stable
scale.disconnect()

Auto-detect port

from serial_scale_hx711 import connect_serial_scale

scale = connect_serial_scale(["/dev/ttyACM0", "/dev/ttyACM1", "/dev/ttyACM2"])

API

Method Description
start(timeout=10) Connect and wait for firmware ready
tare() Zero the scale
read_weight() Single reading (float or None)
read_weight_blocking(n_valid, timeout) Block until N valid readings, return median
read_weight_reliable(n_readings, measure) Repeated reads with custom aggregation
identify() True if firmware responds with identity string
get_calibration_factor() Read calibration factor from firmware
disconnect() Close serial connection

murineshiftwork integration

Used via murineshiftwork.logic.scale.SerialWeighingScaleAdapter. Install with:

pip install "murineshiftwork[calibration]"

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

serial_scale_hx711-2.1.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

serial_scale_hx711-2.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file serial_scale_hx711-2.1.2.tar.gz.

File metadata

  • Download URL: serial_scale_hx711-2.1.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for serial_scale_hx711-2.1.2.tar.gz
Algorithm Hash digest
SHA256 a7152c00b9e09b308b3df6f334c25432428b47473d8310656572c5ed5fa66877
MD5 277b4cdd21c8c2f8782d7384088e0cf9
BLAKE2b-256 1efc8cf8d4a63d8fe37c03b51055033998609c21c3ff4e540bae9f40fe8842a1

See more details on using hashes here.

File details

Details for the file serial_scale_hx711-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: serial_scale_hx711-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for serial_scale_hx711-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a20185926e2b3d57560e0ee4db81eab25d6f382775819460917947e3fe939ec1
MD5 21772a76f60c947dcc9a7ad38d5d5d39
BLAKE2b-256 a510cc6cc158f23bca5a3bcca1106a503251fbcef8e4115bfec7ad5201c2c447

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