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.4.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.4-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serial_scale_hx711-2.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.4.tar.gz
Algorithm Hash digest
SHA256 2f327da20d24c72417360a99834f715584f94573056a46edbdd8a67ab8b42ff1
MD5 10f590bfd58c59b188376332ba5e95b2
BLAKE2b-256 c1ca337ce114753c0887353856219c0f6eeda38215c851e227d8e52ba8ad0821

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serial_scale_hx711-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d19684a4a3a856fc7a4f7e5e566f3ee64797886592a91b0345e5dd59139f7fa0
MD5 a785fa83773794a3785cf9ec6ffdc65b
BLAKE2b-256 ac5d07f793c5dba9ee2ee3dba1a103c93fa646e00b2f8d5f9efd143581863a9e

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