

This circuit is designed to measure weight using a load cell and display the readings on the Arduino UNO's serial monitor. It includes an HX711 amplifier to interface the load cell with the Arduino. An LED is used as an indicator that lights up when the measured weight exceeds a predefined threshold. The Arduino UNO microcontroller is programmed to read the weight data from the HX711 and control the LED accordingly.
#include "HX711.h"
// Pin setup for HX711 amplifier
#define DOUT A1
#define CLK A0
// Threshold in kg
float thresholdWeight = 5.0;
HX711 scale;
int ledPin = 13;
void setup() {
Serial.begin(9600);
// Initialize HX711
scale.begin(DOUT, CLK);
// Calibrate the scale (this value may vary, you can calibrate it manually)
scale.set_scale(2280.f); // Adjust to match your load cell calibration factor
scale.tare(); // Reset scale to 0
// Setup LED pin
pinMode(ledPin, OUTPUT);
}
void loop() {
// Get weight in kg
float weight = scale.get_units(10); // Average of 10 readings
// Display weight on serial monitor
Serial.print("Weight: ");
Serial.print(weight);
Serial.println(" kg");
// Check if the weight exceeds threshold
if (weight >= thresholdWeight) {
// Blink LED if the weight exceeds 5kg
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
} else {
// Keep LED off if below threshold
digitalWrite(ledPin, LOW);
}
delay(1000); // Delay for 1 second before next reading
}
This code is designed to run on the Arduino UNO. It initializes the HX711 amplifier and the load cell, performs tare to zero the scale, and continuously reads the weight. If the weight exceeds the threshold of 5 kg, it blinks the LED connected to pin D13. The weight is also printed to the serial monitor for observation.