Example Code for Arduino-Kitchen Scale

The range of the weight scale is only 1kg. So, it's very appropriate for you to make a kitchen scale. we will bring you a step by step tutorial to make one and print the data by Arduino Serial Monitor.

Hardware Preparation

  1. 1x DFRduino UNO R3
  2. 1x Weight Sensor Module
  3. 1x IO Expansion Shield for Arduino V7.1
  4. 1x Weighing platform Reference 3D model

Note: The weighing platform will be made by yourself according to the weight sensor machine drawing. The following figure show the weight sensor machine drawing.

Software Preparation

Wiring Diagram

Other Preparation Work

  1. Install the Arduino library to your Arduino IDE.

  2. Upload the sample code to UNO. When finished, you put the weight sensor horizontally, one end with four wires is fixed on the table, the other one suspended.

  3. Open the Serial montior,and press the sensor according to the label direction.

  4. Open the DFRobot_HX711 library folder, and find the file DFRobot_HX711.h, open it. Locate the statement void setCalibration(float base = 1992.f). You only need to adjust the number 1992 to find the appropriate value for weight scale. Save the h file, and upload the above code again.

Sample Code

#include <DFRobot_HX711.h>

DFRobot_HX711 MyScale(A2, A3);

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

void loop() {
  Serial.print(MyScale.readWeight(), 1);
  Serial.println(" g");
  delay(200);
}

Result

Check the Serial monitor, when you press the sensor

Left image: Normal data. The date will have a growth process with different intensity of hand.

Right image:Abnormal data.

Possible Reasons:
a. Forced direction is wrong.
b. Maybe the connection isn't firm.

Additional Information

install the weighing platform

Was this article helpful?

TOP