This circuit is designed to measure weight using a Load Cell and display the readings on a 16x2 I2C LCD. The Load Cell's signals are interfaced with an HX711 Bridge Sensor Interface, which is responsible for converting the analog signals into digital data that the Arduino Nano can process. The Arduino Nano serves as the central processing unit, running the embedded code to read the weight measurements, perform calculations, and control the LCD for output display. The circuit is powered by a 9V Battery, and the Arduino Nano regulates the voltage for other components.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 3; // Arduino Nano D3
const int LOADCELL_SCK_PIN = 2; // Arduino Nano D2
// Create LCD object
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Create HX711 object
HX711 scale;
// Replace this with your calibration factor
const float CALIBRATION_FACTOR = 420;
void setup() {
// Initialize the LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Weight Scale");
// Initialize the scale
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
// Set calibration factor
scale.set_scale(CALIBRATION_FACTOR);
// Tare the scale
lcd.setCursor(0, 1);
lcd.print("Taring...");
scale.tare();
lcd.clear();
// Initialize Serial Monitor for debugging
Serial.begin(9600);
}
void loop() {
// Read weight value from the scale
float weight = scale.get_units(10);
// Display the weight on the LCD
lcd.setCursor(0, 0);
lcd.print("Weight: ");
lcd.print(weight);
lcd.print(" kg");
lcd.setCursor(4, 1);
lcd.print(weight * 1000);
lcd.print(" gm");
// Print the weight to the Serial Monitor for debugging
Serial.print("Weight: ");
Serial.print(weight);
Serial.println(" kg");
// Delay before the next reading
delay(500);
}
This code is designed to run on the Arduino Nano. It initializes the HX711 and the LCD, performs taring of the scale, and continuously reads the weight measurements from the Load Cell, displaying the results on the LCD and the Serial Monitor. The CALIBRATION_FACTOR
should be adjusted according to the specific Load Cell used to ensure accurate readings.