commit aa3bad78f35cc99a5a65d7dfc957fd25c8c504ad Author: Daniel Mevec Date: Wed Nov 12 09:43:01 2025 +0100 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..29e50b6 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# HX711 Based Torque Measurement + +[SparkFun HX711 Load Cell Amp Board](https://www.sparkfun.com/sparkfun-load-cell-amplifier-hx711.html) + +[Arduino Library by Rob Tillaart](https://github.com/RobTillaart/HX711/) diff --git a/arduino_strain.ino b/arduino_strain.ino new file mode 100644 index 0000000..7c75e8e --- /dev/null +++ b/arduino_strain.ino @@ -0,0 +1,58 @@ +// +// FILE: HX_plotter.ino +// AUTHOR: Rob Tillaart +// PURPOSE: HX711 demo +// URL: https://github.com/RobTillaart/HX711 + + +#include "SevSeg.h" +#include "HX711.h" + +HX711 scale; + +// adjust pins if needed +uint8_t dataPin = A1; +uint8_t clockPin = A0; + +float f; + + +void setup() +{ +// + byte numDigits = 4; + byte digitPins[] = {2, 3, 4, 5}; + byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13}; + bool resistorsOnSegments = false; // 'false' means resistors are on digit pins + byte hardwareConfig = COMMON_ANODE; // See README.md for options + bool updateWithDelays = false; // Default 'false' is Recommended + bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros + bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected. Then, you only need to specify 7 segmentPins[] + + sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, + updateWithDelays, leadingZeros, disableDecPoint); + + + Serial.begin(115200); + // Serial.println(); + // Serial.println(__FILE__); + // Serial.print("HX711_LIB_VERSION: "); + // Serial.println(HX711_LIB_VERSION); + // Serial.println(); + scale.begin(dataPin, clockPin); + scale.set_scale(1); // TODO you need to calibrate this yourself. + scale.tare(); + +} + + +void loop() +{ + // continuous scale 4x per second + f = scale.get_units(1); + Serial.println(f); + delay(250); +} + + +// -- END OF FILE --