Skip to main content

Python driver for Arduino+HX711 serial weighing scales.

Project description

serial-scale-hx711

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.0.tar.gz (9.0 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.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serial_scale_hx711-2.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for serial_scale_hx711-2.1.0.tar.gz
Algorithm Hash digest
SHA256 df52105e625a313977fa7b21a2399735f9f033797d8bb193a98bc2b4006d8304
MD5 2b3ffa8e7206f8b179ffde8def176585
BLAKE2b-256 02f4202a5da167342b08234b5be8a61c425be663c6d24bfc78fce29a612cc0eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for serial_scale_hx711-2.1.0.tar.gz:

Publisher: release.yml on MurineShiftWork/serial-scale-hx711

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for serial_scale_hx711-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ad0b1108bad15577f6ab2c859a1f10d78a239b8644a7d760db937825173455e
MD5 410cc93a6bf9408e879f6f0872173e59
BLAKE2b-256 c5f1b810718e1fdb004200523e33ef148625e493353e29cd87916b75fd74391e

See more details on using hashes here.

Provenance

The following attestation bundles were made for serial_scale_hx711-2.1.0-py3-none-any.whl:

Publisher: release.yml on MurineShiftWork/serial-scale-hx711

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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