Thursday, December 19, 2024

Build Your Own Digital Weighing Machine


This article guides you through building a budget-friendly digital kitchen scale that can measure up to 5 kilograms. It’s a simple design that’s easy to put together. Need something more heavy-duty, like a bathroom scale? Just swap out the load cell, and you’re good to go—no other changes needed.

Circuit and Working

Circuit diagram of the weighing machine is shown in Fig. 2. It is built around 5V voltage regulator 7805 (IC1), analogue amplifier HX711 (IC2), ATmega328 microcontroller (IC3), load cell (strain gauge) for up to 5kg and a few discrete components. The author’s prototype is shown in Fig. 1.

Author’s prototype
Fig. 1: Author’s prototype

 

- Advertisement -
Circuit diagram of weighing machine
Fig. 2: Circuit diagram of weighing machine

HX711 is used here because it gives a digital output, is low-cost and has an Adafruit header file for Arduino, which makes it easy to use. HX711 has input channel A (A+ and A-) and channel B (B+ and B-). Here, channel B is left unused. If you want to add one more load cell to take average, you can connect it to channels B- and B+. HX711, along with male bergstrip connectors, as shown in Fig. 3.

Analogue amplifier HX711
Fig. 3: Analogue amplifier HX711

Load cell. Details of the load cell are shown in Fig. 4. The weighing scale has a metallic structure surrounded by strain-relieving frames, which pick up the strain when subjected to weight. Strain gauges are arranged in Wheatstone bridge configuration. Voltage is applied on one side, while the other side measures the change in voltage depending on the strain it suffers.

- Advertisement -
Load cell
Fig. 4: Load cell

Load or weight is applied at the free end. Strain gauges are applied on all three sides to pick up compressions and expansions. These are nothing but load signals that are processed and measured for weight measurements. Output is clubbed into four wires. Functions of the color codes of the four wires are given in the table.

A yellow wire, if present, is the shield wire that must be connected to ground.

Software

The software consists of Arduino sketch (my_load_cell.ino), HX711 header files and other related libraries. First, add the library files (floatToString, HX711 and writeAnything) to Arduino IDE library and then run the sketch. To calibrate the probe, press the push button once. To reduce the number of readings for averaging, change the following script:

x=scale.get_units(25)×45.3592 ; //convert to gram for 25 readings
scale.read_average(5); //to read 5 average

The first line takes 25 readings and averages it five times using the second line of code. To increase the speed of reading, reduce the number of averages. If input is blank, it will not take any average.

Software is built on Arduino onboard principle. After uploading the code into ATmega328 using Arduino Uno, take ATmega328 IC out and put into the PCB board.

Initial readings may have errors, as the system is not yet calibrated. Press push button S1 connected to pin 16 (PB2) of IC3 once and the system will self-calibrate. Initial reading of 0.0 will be shown on LCD1. The zero_set figure will then be stashed into the inbuilt EEPROM of Arduino.

Next time when you restart it after switch off operation, zero_set reading will be read from the EEPROM and internal calibration will be adjusted accordingly. It will be shown on the top line of LCD1. The second line will show 0.0.

If the readings reduce with increase in load, reverse the white and green wires, and the problem will be solved.

Download Source Code

Construction and Testing 

An actual-size PCB layout for the weighing machine is shown in Fig. 5 and its components layout in Fig. 6. After assembling the circuit, enclose it in a suitable box. Attach one end of the load cell in a fixed frame. The other end should be used for placing the load or object for weight measurement.

Fig. 5: PCB layout of the weighing machine circuit
Component Layout of the PCB design
Fig. 6 Component Layout of the PCB design

Download PCB and component layout PDF: click here

Calibration

Calibration is an important part of measuring devices. For HX711 there is one calibration factor 7050 that works well for Adafruit modules. Therefore it has not been changed. The other is zero_set factor for which provision should be made to do it dynamically during operations. After each calibration, zero_set figure goes into EEPROM memory of Arduino. Next time when you restart the circuit, this value will be fetched from EEPROM and zero_set achieved.However, to change zero-set reading, like for weighing milk (in a container), you would not be interested in measuring the container weight and then deducting it. So, put the container on the scale and press S1. Container weight will be added to zero_set reading and a new zero reading will be shown. Now, pour milk in the container and read the weight. To remove the container weight from zero_set reading, remove the container and press S1 again.

Multiplying Factor

Change this factor suitably by putting a known weight on the load tray the first time. Once this is done, your machine will work fine. This is explained in the source code very clearly.

Fitting of the scale

If you look at the load cell, it has strain gauge attached on all three sides with suitable strain-relieving frames inbuilt in the design. Attach a suitable tray on the load end of the load cell for holding the object for weight measurement. Put a thick washer between the base plate of the tray and the load cell, and tighten firmly. Your weighing machine is ready for use.


This article was first published on 22 July 2018, and recently updated on 23 October 2024

18 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics