Project #1:
Arduino Body Weight Scale
For our first project, we will make an "Arduino Body Weight Scale". And below are the components and the steps to make Arduino body weight scale.
To build this project, you will need
1x Arduino Nano
1x 16x2 i2C LCD
1x HX711
4x Load Cell
These are the component which we will need to make our own body weight scale. Ne,xt, we shall look on how to integrate the load cell, HX711, and LCD with the Arduino.
Before that, let's look into the theory on how we can connect HX711 and the load cell.
HX711 is an ADC chip with preamplifier included. The chip is specifically designed for weight scale applications. The load cells which usually measure weight provide voltage outputs in millivolts. These outputs are difficult to handle directly by controllers, hence we use the HX711 IC which takes these voltage signals and provide standard digital values which can be used by microcontrollers. The chip has integrated preamplifier specifically to handle these low voltages.
The load cell and the HX711 breakout board can be bought from
Once we have all the item required on hand, we can start to build this project. In the ,firs,t part, we will see the electronics part and in the second part, we shall see the mechanical part whereby it covers the DIY weight scale machine.
The Circuit Diagram
The connection between the load cell, HX711, and the Arduino is done as per the diagram below.
And meanwhile, the connection between the Arduino and i2C LCD is done as per the diagram below
Once we have made all the connection as per the diagram shown above, next we shall write the coding for the project.
Note: Please note that in the diagram above I have used Arduino Uno R3. You may use other Arduino as well. In this project, I have decided to use the Arduino Nano, due to the restriction on the base which I made for this project.
Below is the construction of the electronic circuits for this project.
For the coding part, I have referred to some example and make changes accordingly to suite this project.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #include "writeAnything.h" #include "HX711.h" #include <LiquidCrystal.h> #include "floatToString.h" #include <string.h> #define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch // #define zero_factor 8421804 //This large value is obtained using the SparkFun_HX711_Calibration sketch //made off as this is obtained from memory //#define zero_factor 8330000 - h2 #define DOUT 2 #define CLK 3 struct config_t{ int myInteger; int myInteger1; } int2IEeprom; HX711 scale(DOUT, CLK); LiquidCrystal lcd(4,5,6,7,8,9); float x; long pos = 37; long h2,h1; int l,m; byte tracker=0; void setup() { Serial.begin(9600); lcd.begin(16, 2); pinMode(10,INPUT); lcd.setCursor(0,0); lcd.print("Wt.(gm):"); scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch EEPROM_readAnything(pos,int2IEeprom); // Read the last set valuefrom EEPROM h2= 8330000 - int2IEeprom.myInteger; //convert to the original value Serial.println(h2); lcd.print(h2); scale.set_offset(h2); //Zero set the scale using a previously known zero_factor scale.tare(); } void loop() { x=scale.get_units(25)*16.5 ; //convert to gram //The multiplying factor 16.5 . //Change this factor suitably to match a known load if (x<0.5 and x>-1) x=0.0; //just to stabilize around 0 scale String buffer1; buffer1=String(x,1); if(x<10) { lcd.setCursor(3,1); lcd.print(buffer1); lcd.print(" "); } if(x>=10 and x<100) { lcd.setCursor(3,1); lcd.print(buffer1); } if(x>=100 and x<1000) { lcd.setCursor(3,1); lcd.print(buffer1); } if(x>=1000) { lcd.setCursor(3,1); lcd.print(buffer1); } int val=digitalRead(10); if(val==LOW){ lcd.setCursor(0,0); lcd.print(" ...calibrating"); scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch scale.set_offset(scale.read_average(5) ); //Zero out the scale using a previously known zero_factor scale.tare(); l=8330000-scale.read_average(5); //Reduce the figure to a 4 digit integer value int2IEeprom.myInteger=l; tracker=EEPROM_writeAnything(pos,int2IEeprom.myInteger); //Write this into the EEPROM for next use lcd.setCursor(0,0); lcd.print("Wt.(gm):"); lcd.print("(C):"); lcd.print(l); } } |
Once we are done with the coding, next we will see the base which we will use for weighing purpose.
For the base, I have used the wood which was cut into a round shape. The image below illustrates the base which I have used.
The placement of the sensor should be equally spaced.
And below is the raw data which we get when we first try to run the code. The first part is the calibration and the second video is on the weight testing.
Weight Calibration
Weight Testing
And below is the result which i get after calibrating the sensor. Somehow i need to recalibrate the sensor in order to get a better result.
Thank you.
nice
ReplyDeleteThanks for the nice blog. It was very useful for me. I'm happy I found this blog.
ReplyDeleteDigital Scale
Welcome to the official informative website of GST admission 2020-21. Education ministry and public University authority has come to a point that they are going to arrange admission test in cluster method. This Central admission system is valid only for this year. Please visit here for important information.GST Admission Result
ReplyDeleteFor library "writeAnything.h", i can download that at where and what the keysearch for ?
ReplyDeleteThanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. situs slot online
ReplyDelete