ElectroPeak
Published © GPL3+

Digital Force Gauge & Weight Scale w/ Loadcell & Arduino

Learn how to build a digital weight scale and force gauge with HX711 load cell module and Arduino.

BeginnerFull instructions provided2 hours129,298
Digital Force Gauge & Weight Scale w/ Loadcell & Arduino

Things used in this project

Hardware components

Arduino UNO R3
×1
ElectroPeak Loadcell Sensor
×1
ElectroPeak HX711 Dual-Channel 24-bit A/D Conversion Module
×1
ElectroPeak 1602 Serial LCD Module Display
×1
ElectroPeak Male to Male Jumper Wire
×1

Software apps and online services

Arduino IDE

Story

Read more

Schematics

HX711 Library

You need HX711 Library

Code

code 2

Arduino
/* 
 *  Digital Weighing Scale with Load Cell
 *  by Hanie kiani
 *  https://electropeak.com/learn/   
 */

#include "HX711.h"  //You must have this library in your arduino library folder
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
#define DOUT  4
#define CLK  5
 
HX711 scale(DOUT, CLK);
 
float calibration_factor = 2230; // this calibration factor is adjusted according to my load cell
float units;
 
void setup() {
  lcd.begin(16,2);
  Serial.begin(9600);  
  Serial.println("Press T to tare");
scale.set_scale(calibration_factor); //Adjust to this calibration factor
  scale.tare(); 
}
 

void loop() {
  
 units = scale.get_units(), 5;
  if (units < 0)
  {
    units = 0.00;
  }
  lcd.setCursor(0,0);
  lcd.print("Weight: ");
  lcd.setCursor(8,0);
  lcd.print(units,5); //displays the weight in 4 decimal places only for calibration
  lcd.setCursor(14,0);
  lcd.print("grams");
   
   
  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == 't' || temp == 'T')
      scale.tare();  //Reset the scale to zero      
  }
}

code 1

Arduino
/* 
 *  HX711 Calibration
 *  by Hanie Kiani
 *  https://electropeak.com/learn/   
 */
/*
 Setup your scale and start the sketch WITHOUT a weight on the scale
 Once readings are displayed place the weight on the scale
 Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
*/

#include "HX711.h"
#define DOUT  4
#define CLK  5
HX711 scale(DOUT, CLK);

float calibration_factor = 2230; // this calibration factor must be adjusted according to your load cell
float units;
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.set_scale(calibration_factor); //Adjust to this calibration factor
  scale.tare();  //Reset the scale to 0

  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);
{

void loop}()

 

  Serial.print("Reading");
  units = scale.get_units(), 5;
  if (units < 0)
}
    units = 0.00;
  {
   Serial.print("Weight: ");
  Serial.print(units);
  Serial.print(" grams"); 
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

  if(Serial.available())
  }
    char temp = Serial.read();
    if(temp == '+' || temp == 'a')
      calibration_factor += 1;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 1;
{
  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == 't' || temp == 'T')
      scale.tare();  //Reset the scale to zero      
  }
}

code 3

Arduino
/*
*  Digital Force Gauge with Loa d Cell
*  by Hanie kiani
*  https://electropeak.com/learn/
*/

#include "HX711.h"  //You must have this library in your arduino library folder
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
#define DOUT  4
#define CLK  5
HX711 scale(DOUT, CLK);
 
float calibration_factor = 1; // this calibration factor is adjusted according to my load cell
float units;
 
void setup() {
  lcd.begin(16,2);
  Serial.begin(9600);  
  Serial.println("Press T to tare");
scale.set_scale(calibration_factor); //Adjust to this calibration factor
  scale.tare(); 
}
 

void loop() {
  
 units = scale.get_units(), 5;
  if (units < 0)
  {
    units = 0.00;
  }
  lcd.setCursor(0,0);
  lcd.print("Force: ");
   Serial.print("Force: ");
  lcd.setCursor(8,0);
  lcd.print(units,5); //displays the weight in 4 decimal places only for calibration
   Serial.print(units,5);
  lcd.setCursor(14,0);
  lcd.print("N");
   Serial.print("N ");
     Serial.println();
delay(2000);
   
   
  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == 't' || temp == 'T')
      scale.tare();  //Reset the scale to zero      
  }
}

Credits

ElectroPeak

ElectroPeak

57 projects • 731 followers
At ElectroPeak we want to teach you to enjoy electronics more. We offer Top-notch guides and worry-free shopping experience.

Comments