I want to know about the electronic components weight. So I decided to do my own weighing machine :)
To do that you have to download some libraries which are listed below
LiquidCrystal_PCF8574
Wire
HX711
Micro-Voltage Physics: Electronic Weighing Machine
If you attach a piece of metal to an Arduino analog pin, you get nothing. When you place a 1-pound weight on a block of Aluminum, the metal physically bends by an invisible fraction of a millimeter. The Electronic Weighing Machine project uses strain-gauges to literally measure that microscopic atomic stretching! Because the voltage change is barely 0.0001 Volts, it requires the legendary HX711 24-Bit ADC to rip the reading into the digital realm!
The HX711 24-Bit Amplifier Engine
The Arduino's internal 10-bit ADC is a complete joke for this task (it only sees 1024 steps). The HX711 sees 16 Million Steps!
- The Load Cell uses 4 wires (usually Red, Black, White, Green), comprising a physical Wheatstone bridge.
- The Arduino connects to the HX711 via two distinct pins:
DT (Data)andSCK (Clock). - The
<HX711.h>library abstracts the terrifying synchronous serial timing arrays.
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale(2280.f); // The required mathematical calibration factor!
scale.tare(); // Zero out the scale, resetting the EEPROM weight!
float currentWeight = scale.get_units(10); // Take exactly 10 high-speed averaged readings!
Connect all components as per the circuit diagram.
Metrology Base Components
- Arduino Uno/Nano (Standard architecture).
- HX711 Load Cell Amplifier Board (Do not swap data pins, the protocol is extremely strict).
- Aluminum Bar Load Cell (1kg, 5kg, or 20kg variants. You must bolt it physically between two rigid wooden boards in a 'Z' shape, or it will not bend and the readings will stay at zero!).
- I2C 16x2 LCD for displaying the fractional gram readouts!
Programming part is critical
1. Calibration
Calibrating the Aluminum Physics
A brand new Load Cell does not output "Grams." It outputs massive, chaotic raw vector integers like -845601.
- The Calibration Sequence:
- You must write a specific "Calibration Sketch" first. Place exactly
100 gramsof known dead-weight on the sensor. - The Serial Monitor reads
500000. You mathematically divide500000 / 100 = 5000. - The number
5000becomes your permanentcalibration_factor! Without this exact mathematical constant, your scale is a random number generator!
In Calibration open the calibration sketch upload with out any load on the tray. Then put some known weight element then open serial port increment or decremented the calibration factor util you see the known value.
For example if you put 250gram weight, on first time it will give 400 gram or 1kg before calibration.. You use a, s, d, f or z, x, c, v keys to correct the calibration level until you get 250 grams from 400gram or 1kg. Then just note down the calibration factor.
2. Actual Sketch
Put the calibrated value xxxxxxx on this line and upload thats all....
scale.set_scale(xxxxxxx);
3. To reset the tare value I use one push button.