/*
* circuits4you.com
* 2016 November 25
* Load Cell HX711 Module Interface with Arduino to measure weight in Kgs
Arduino
pin
2 -> HX711 CLK
3 -> DOUT
5V -> VCC
GND -> GND
Most any pin on the Arduino Uno will be compatible with DOUT/CLK.
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/
#include "HX711.h"//You must have this library in your arduino library folder
#define DOUT3
#define CLK2
HX711 scale(DOUT,CLK);
//Change this calibration factor as per your load cell once it is found you many need to vary it in thousands
float calibration_factor = -9650worked for my 40Kg max scale setup
//=============================================================================================
// SETUP
//=============================================================================================
void setup()
Serial.begin(9600);
Serial.println("Press T to tare");
scale.set_scale(-96650);//Calibration Factor obtained from first sketch
scale.tare(); //Reset the scale to 0
}
//=============================================================================================
// LOOP
//=============================================================================================
void loop() {
Serial.print("Weight: ");
Serial.print(scale.get_units(),3);//Up to 3 decimal points
Serial.println(" kg"); //Change this to kg and re-adjust the calibration factor if you follow lbs
if(Serial.available())
{
char temp = Serial.read();
if(temp == 't' || temp == 'T')
scale.tare();//Reset the scale to zero
}
}
//=============================================================================================