Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Based Load Cell Weight Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino-Based Load Cell Weight Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to measure weight using a load cell and display the measured weight on a 16x2 I2C LCD. The system includes an Arduino UNO for processing the data from the load cell via an HX711 load cell amplifier. Additionally, an ESP8266 NodeMCU is used for potential wireless communication. The circuit is powered by a DC power source.

Component List

  1. Load Cell - Red/white/black/green

    • Description: A sensor used to measure weight.
    • Pins: E+, A-, E-, A+
  2. SparkFun Load Cell Amplifier - HX711

    • Description: An amplifier to interface the load cell with the microcontroller.
    • Pins: VDD, VCC, DAT, SCK, GND, B+, B-, A+, A-, AVDD
  3. Arduino UNO

    • Description: A microcontroller used for processing the data from the load cell and controlling the LCD.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  4. 16x2 I2C LCD

    • Description: A display module to show the measured weight.
    • Pins: GND, VCC, SDA, SCL
  5. ESP8266 NodeMCU

    • Description: A Wi-Fi module for potential wireless communication.
    • Pins: D0, D1, D2, D3, D4, 3V3, GND, D5, D6, D7, D8, RX, TX, A0, RSV, SD3, SD2, SD1, CMD, SD0, CLK, EN, RST, VIN
  6. DC Power Source

    • Description: Provides power to the circuit.
    • Pins: Ground, Positive

Wiring Details

Load Cell - Red/white/black/green

SparkFun Load Cell Amplifier - HX711

Arduino UNO

16x2 I2C LCD

ESP8266 NodeMCU

DC Power Source

Documented Code

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

#define DT A0
#define SCK A1
#define sw 10
const int buzzer=13;
long sample=0;
float val=0;
long count=0;
int position = 0;     

unsigned long readCount(void)
{
    unsigned long Count;
    unsigned char i;
    pinMode(DT, OUTPUT);
    digitalWrite(DT,HIGH);
    digitalWrite(SCK,LOW);
    Count=0;
    pinMode(DT, INPUT);
    while(digitalRead(DT));
    for (i=0;i<24;i++)
    {
        digitalWrite(SCK,HIGH);
        Count=Count<<1;
        digitalWrite(SCK,LOW);
        if(digitalRead(DT))
            Count++;
    }
    digitalWrite(SCK,HIGH);
    Count=Count^0x800000;
    digitalWrite(SCK,LOW);
    return(Count);
}

void setup()
{
    Serial.begin(9600);
    lcd.begin();
    pinMode(SCK, OUTPUT);
    pinMode(buzzer, OUTPUT);
    lcd.backlight();
    lcd.clear();
    lcd.print("Vehicle Over-Weight: ");
    lcd.setCursor(0,1);
    lcd.print("Monitoring system");
    delay(3000); /* Power On Warm Up Delay */
    lcd.clear();
    calibrate();
    delay(150); // waits 15 ms for the servo to reach the position
}

void loop()
{
    count= readCount();
    int w=(((count-sample)/val)-2*((count-sample)/val));
    lcd.setCursor(0,0);
    lcd.print("Measured Weight");
    lcd.setCursor(0,1);
    lcd.print(w);
    lcd.print("grams");
    Serial.print("*");
    Serial.print(String(w));//FIRE
    Serial.print("/");
    Serial.print(String(0));//FIRE
    Serial.print("/");
    delay(3000);  

    if(w>1000)
    {
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("Over-Weight ");
        lcd.setCursor(0,0);
        lcd.print("High Alert....");
        Serial.print("*");
        Serial.print(String(w));//FIRE
        Serial.print("/");
        Serial.print(String(100));//FIRE
        Serial.print("/");
        digitalWrite(buzzer,HIGH);
        delay(3500);
        digitalWrite(buzzer,LOW);
        while(1);
    }
}

void calibrate()
{
    lcd.clear();
    lcd.print("Calibrating...");
    lcd.setCursor(0,1);
    lcd.print("Please Wait...");
    for(int i=0;i<100;i++)
    {
        count=readCount();
        sample+=count;
    }
    sample/=100;
    lcd.clear();
    lcd.print("Put 100g & wait");
    count=0;
    while(count<1000)
    {
        count=readCount();
        count=sample-count;
    }
    lcd.clear();
    lcd.print("Please Wait....");
    delay(2000);
    for(int i=0;i<100;i++)
    {
        count=readCount();
        val+=sample-count;
    }
    val=val/100.0;
    val=val/100.0; // put here your calibrating weight
    lcd.clear();
}

This code initializes the LCD, reads data from the load cell via the HX711 amplifier, and displays the measured weight on the LCD. If the weight exceeds a certain threshold, an alert is triggered.