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.3.tar.gz (9.7 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.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serial_scale_hx711-2.1.3.tar.gz
  • Upload date:
  • Size: 9.7 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.3.tar.gz
Algorithm Hash digest
SHA256 d9202706ed251470225cecf27644fe16a7f4e032bf3237143f16c99cdb7b2240
MD5 4f4d63ce7fa249708b76e39d75d8b294
BLAKE2b-256 68cbd3c15a42981d8a742ba3ecc4e1a9b3dda9f9e79547b0c08af3d9e9018957

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serial_scale_hx711-2.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ff885a9a442080b2ab21fb0fd4e73f5f283715126041909cdfed829822a8d786
MD5 d318ec410626a3de798a3430606488af
BLAKE2b-256 abb45688a841c33a0421fe23ee54d29bba46602e0c02636ba39376aeb870454b

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