Electronic scale based on Arduino and HX711 modules

Electronic scale based on Arduino and HX711 modules

Today we are going to make a simple electronic scale based on Arduino and HX711 modules.

Adeept HX711 parameter introduction:

Bracket diameter: 10CM (tray diameter)

Operating voltage: DC 5V or 3.3V (5V recommended)

Maximum load: 5Kg

Appearance height: 3.5cm (including pillars)

Complete set weight: 100g (including upper and lower housing)

AD module: HX711 (24-bit AD conversion, professional pressure AD chip)

Accuracy after calibration: less than 1g

Output signal: Digital signal (the analog voltage signal collected by the pressure sensor is amplified and converted into digital signal by the AD module.) It only needs to occupy two common digital interfaces of the controller.

The sensor we used has a strain gauge on each of the upper and lower surfaces, and there are two pressure resistors in each strain gauge. A total of four pressure resistors compose a full bridge circuit. The full bridge circuit can improve the accuracy of the measurement.

Production steps

Firstly, prepare the material list.

1x   Adeept HX711 kit

1x   Adeept UNO R3

1x   USB Cable

Secondly, connect the circuit as the following diagram.

Thirdly, add the HX711 function library.

Fourthly, write the code.

//-------------------------------------------------------------------------------------
// HX711_ADC.h
// Arduino master library for HX711 24-Bit Analog-to-Digital Converter for Weigh Scales
// Thanks Olav Kallhovd 
// Tested with      : HX711 asian module on channel A 
// Tested with MCU  : Adeept UNO R3
// Code modification :Tom
//-------------------------------------------------------------------------------------
// This is an example sketch on how to use this library
// Settling time (number of samples) and data filtering can be adjusted in the HX711_ADC.h file

#include <HX711_ADC.h>

//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell(9, 10);

long t;

void setup() {
  Serial.begin(9600);
  Serial.println("Wait...");
  LoadCell.begin();
  long stabilisingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilising time
  LoadCell.start(stabilisingtime);
  LoadCell.setCalFactor(696.0); // user set calibration factor (float)
  Serial.println("Startup + tare is complete");
}

void loop() {
  LoadCell.update();
  //get smoothed value from data set + current calibration factor
  if (millis() > t + 250) {
    float i = LoadCell.getData()/58*100;
    Serial.print("Measured weight value: ");
    Serial.print(i);
    Serial.println(" g");
    t = millis();
  }
}

Fifthly, download the code to Adeept UNO R3, open the Serial Monitor: weigh it.

Leave a Reply