Arduino Load Cell Monitor Using a HX711

by LAworkshop in Circuits > Arduino

75 Views, 0 Favorites, 0 Comments

Arduino Load Cell Monitor Using a HX711

signal-2026-04-21-221350.jpeg

I Made A Simple One Or Two Load Cell Monitor with A Arduino And 0.91 Inch OLED

Supplies

PARTS NEEDED

  1. One Arduino Uno
  2. One Or Two HX711 Load Cell Amplifier
  3. One Or Two Load Cells Of Any Weight Capacity
  4. One 0.91 inch OLED Display
  5. One Momentary Push Button
  6. One Breadboard (any size works)
  7. A Whole Bunch Of Jumper Wires
  8. A USB cord ( for connecting Arduino to Computer )
  9. A Computer ( or mobile phone )

Pictures

tinkercadHX711.png
signal-2026-04-21-221350.jpeg
signal-2026-04-21-221110_002.jpeg
signal-2026-04-22-211129.jpeg
signal-2026-04-21-221110_004.jpeg

Pictures

Arduino Libraries

Libraries Needed

  1. HX711 Arduino Library By Bogdan Necula
  2. Adafruit GFX Library By Adafruit
  3. Adafruit SSD1306 By Adafruit

GitHub Pages Below

https://github.com/bogde/HX711

https://github.com/adafruit/Adafruit-GFX-Library

https://github.com/adafruit/Adafruit_SSD1306

Calibration Code

Calibration Code Run This Code First On Your Arduino And take The Final Number In The Serial Monitor And Put It In The Calibration_factor_1 Or 2 On The Main Code

When In The Serial Monitor Enter Either A For + 100 or Z For - 100

You Need To Have A Object That You Know The Exact Weight Of To Put On The Load Cell to calibrate

( example, you have a weight that is 1LB And Your Serial Monitor And/or Display Is Showing 2LBs You Would Need To Enter In The Serial Monitor Command Line Z Until It Shows 1LB And Then Put It Into The Main Code )


#include "HX711.h"

#define LOADCELL_DOUT_PIN 3
#define LOADCELL_SCK_PIN 2

HX711 scale;

float calibration_factor = -7050;

void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");

scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale();
scale.tare();

long zero_factor = scale.read_average();
Serial.print("Zero factor: ");
Serial.println(zero_factor);
}

void loop() {

scale.set_scale(calibration_factor);
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" lbs");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();

if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 100;
else if(temp == '-' || temp == 'z')
calibration_factor -= 100;
}
}

Final Code

Main Code Use this Code Last For Final Setup

You Can Use The Same Code For Both One And Two Load Cells And/Or No Display


#include "HX711.h"
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Calibration factors (adjust each separately!)
#define calibration_factor_1 -7050
#define calibration_factor_2 -7050

// Load Cell 1 pins
#define DOUT1 3
#define SCK1 2

// Load Cell 2 pins
#define DOUT2 5
#define SCK2 6

#define TARE_BUTTON_PIN 4

HX711 scale1;
HX711 scale2;

void setup() {
Serial.begin(9600);

pinMode(TARE_BUTTON_PIN, INPUT_PULLUP);

// Initialize both scales
scale1.begin(DOUT1, SCK1);
scale1.set_scale(calibration_factor_1);
scale1.tare();

scale2.begin(DOUT2, SCK2);
scale2.set_scale(calibration_factor_2);
scale2.tare();

// Initialize display
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("OLED not found");
while(true);
}

display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);

display.setCursor(0,0);
display.println("Scale Ready");
display.display();

delay(1000);
}

void loop() {
// Tare both scales with one button
if (digitalRead(TARE_BUTTON_PIN) == LOW) {
scale1.tare();
scale2.tare();

display.clearDisplay();
display.setCursor(0,0);
display.println("Taring...");
display.display();

delay(500);
}

float weight1 = scale1.get_units();
float weight2 = scale2.get_units();

// Serial output
Serial.print("Scale 1: ");
Serial.print(weight1, 1);
Serial.print(" lb | Scale 2: ");
Serial.print(weight2, 1);
Serial.println(" lb");

// Display output
display.clearDisplay();

display.setTextSize(1);
display.setCursor(0,0);
display.print("1: ");
display.print(weight1, 1);
display.print(" lb");

display.setCursor(0,16);
display.print("2: ");
display.print(weight2, 1);
display.print(" lb");

display.display();

delay(500);
}