From 5c9a753955ab9bc6e32a0b06ad185261dd3a7e45 Mon Sep 17 00:00:00 2001 From: DAProgs Date: Wed, 14 Jan 2026 14:29:48 -0500 Subject: [PATCH] Upload files to "libraries/HX711/examples/HX_performance" --- .../HX_performance/HX_performance.ino | 108 ++++++++++++++++++ .../HX_performance/performance_0.3.1.txt | 29 +++++ .../HX_performance/performance_0.3.2.txt | 31 +++++ .../HX_performance/performance_0.3.4.txt | 34 ++++++ 4 files changed, 202 insertions(+) create mode 100644 libraries/HX711/examples/HX_performance/HX_performance.ino create mode 100644 libraries/HX711/examples/HX_performance/performance_0.3.1.txt create mode 100644 libraries/HX711/examples/HX_performance/performance_0.3.2.txt create mode 100644 libraries/HX711/examples/HX_performance/performance_0.3.4.txt diff --git a/libraries/HX711/examples/HX_performance/HX_performance.ino b/libraries/HX711/examples/HX_performance/HX_performance.ino new file mode 100644 index 0000000..4c4c739 --- /dev/null +++ b/libraries/HX711/examples/HX_performance/HX_performance.ino @@ -0,0 +1,108 @@ +// +// FILE: HX_performance.ino +// AUTHOR: Rob Tillaart +// PURPOSE: HX711 performance measurements +// URL: https://github.com/RobTillaart/HX711 + + +#include "HX711.h" + +HX711 scale; + +// adjust pins if needed +uint8_t dataPin = 6; +uint8_t clockPin = 7; + +uint32_t start, stop; +volatile float f; + + +void setup() +{ + Serial.begin(115200); + Serial.println(); + Serial.println(__FILE__); + Serial.print("HX711_LIB_VERSION: "); + Serial.println(HX711_LIB_VERSION); + Serial.println(); + + scale.begin(dataPin, clockPin); + + Serial.println("\nUNCONFIGURED"); + delay(1000); + measure(10); + + // TODO find a nice solution for this calibration.. + // load cell factor 20 KG + // scale.set_scale(127.15); + + // load cell factor 5 KG + scale.set_scale(420.0983); // TODO you need to calibrate this yourself. + // reset the scale to zero = 0 + scale.tare(); + + Serial.println("\nCONFIGURED"); + delay(1000); + measure(10); + + Serial.println("\nSLEEP"); + scale.power_down(); + delay(2000); + scale.power_up(); + Serial.println("\nWAKE UP"); + delay(1000); + measure(10); + +/* + * PERFORMANCE + * 100x get_units(1) = 9404352 (UNO) + * VAL: 0.05 + */ + Serial.println("\nPERFORMANCE"); + delay(10); + start = micros(); + f = 0; + for (int i = 0; i < 100; i++) + { + f = scale.get_units(1); + } + stop = micros(); + Serial.print("100x get_units(1) = "); + Serial.println(stop - start); + Serial.print(" VAL: "); + Serial.println(f, 2); + + Serial.println("\nPRECISION"); + f = 0; + for (int i = 0; i < 100; i++) + { + f += scale.get_units(1); + } + Serial.print(" VAL:"); + Serial.println(f * 0.01, 4); +} + + +void loop() +{ + // continuous scale 4x per second + // f = scale.get_units(5); + // Serial.println(f); + // delay(250); +} + + +void measure(uint8_t cnt) +{ + Serial.print(" RAW: "); + Serial.println(scale.read()); + Serial.print(" AVG: "); + Serial.println(scale.read_average(cnt)); + Serial.print("VALUE: "); + Serial.println(scale.get_value(cnt)); + Serial.print("UNITS: "); + Serial.println(scale.get_units(cnt), 1); +} + + +// -- END OF FILE -- diff --git a/libraries/HX711/examples/HX_performance/performance_0.3.1.txt b/libraries/HX711/examples/HX_performance/performance_0.3.1.txt new file mode 100644 index 0000000..be9452e --- /dev/null +++ b/libraries/HX711/examples/HX_performance/performance_0.3.1.txt @@ -0,0 +1,29 @@ +LIBRARY VERSION: 0.3.1 + + +UNCONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +CONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +SLEEP + +WAKE UP + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +PERFORMANCE +100x get_units(1) = 41164 + VAL: 0.00 + +PRECISSION + VAL:0.0000 diff --git a/libraries/HX711/examples/HX_performance/performance_0.3.2.txt b/libraries/HX711/examples/HX_performance/performance_0.3.2.txt new file mode 100644 index 0000000..1de8028 --- /dev/null +++ b/libraries/HX711/examples/HX_performance/performance_0.3.2.txt @@ -0,0 +1,31 @@ +(UNO) + +LIBRARY VERSION: 0.3.2 + + +UNCONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +CONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +SLEEP + +WAKE UP + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +PERFORMANCE +100x get_units(1) = 40944 + VAL: 0.00 + +PRECISSION + VAL:0.0000 diff --git a/libraries/HX711/examples/HX_performance/performance_0.3.4.txt b/libraries/HX711/examples/HX_performance/performance_0.3.4.txt new file mode 100644 index 0000000..baca106 --- /dev/null +++ b/libraries/HX711/examples/HX_performance/performance_0.3.4.txt @@ -0,0 +1,34 @@ +BOARD: UNO +IDE: 1.8.19 +SKETCH: HX_performance.ino + +LIBRARY VERSION: 0.3.4 + + +UNCONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +CONFIGURED + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +SLEEP + +WAKE UP + RAW: 0.00 + AVG: 0.00 +VALUE: 0.00 +UNITS: 0.0 + +PERFORMANCE +100x get_units(1) = 40904 + VAL: 0.00 + +PRECISION + VAL:0.0000 +