Tutorial: How to make a weighing scale with the HX711, a load cell and an Arduino | UATS A&S #14
HTML-код
- Опубликовано: 2 авг 2024
- In this tutorial, it is shown how to make a weighing scale based on the Arduino platform. In particular, a HX711 breakout board and a load cell is utilized to measure weight.
Written tutorial: www.mschoeffler.com/2017/12/04...
-- Arduino Uno
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
-- Jumper wires (female/male)
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
-- Breadboard
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
-- load cell
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
-- HX711 module
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
-- LCM1602 IIC V1 (LCD Module)
- Aliexpress: 1smart.click/search/st/ali/ms...
- Amazon: 1smart.click/search/st/azn/ms...
- ebay.com: 1smart.click/search/st/eby/ms...
Video Chapters:
0:00 Tutorial Introduction
1:01 Load Cell Preparation
2:13 Wiring
4:26 Wiring Schematic
4:38 Programming
5:52 Example demonstration
Credits:
Songs: Killing Time
Artist: Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License
creativecommons.org/licenses/... Наука
Hello, I have loaded your code always brings me error 'POSITIVE' which is not declared in this scope you can help me.
Greeting Georg
I pinned the comment, since I get many emails from people having the same problem:
There might be something wrong with the LiquidCrystal_I2C library -> Look for another variant of the library and/or check whether the library is correctly installed.
In at least 50% of all cases, looking for another variant of the library or reinstalling the library did help.
@@mschoeffler Well how about you just give us the correct line? its apparent the line "LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);" does not work. and use a different library is not a proper answer since in your own words it only works less than 50% of the time... I have looked at the library, I find no mention of 'POSITIVE'. so what is this meant to be? and do? is it the backlight function? what is the proper input?
Did any one find the solution for this line????
@@prajwalbs600 I used the LiquidCrystal lib from here.... aws1.discourse-cdn.com/arduino/original/3X/4/5/45a281b9d61bdb6af3c8d67148a836411c892696.zip
@@stephenkamin1345 did it work?
Thank you!
I really enjoy how clear your tutorials are.
Thanks for the good class of arduino and hx711, although our languages are very different I could understand by the images and translations of subtitles.
My project failed because I did not solder the pins yet, but it already helped me a lot.
Brasil
Thank you. This was very informative and easy to understand.
Your explanation is very clear and i have done this loadcell it's successful good vedio
Thanks for the video, its better than anything I could do. However IMHO .. . the HX711 example board shown does not have the recommended bridge supply smoothing capacitor (10uf) as per datasheet. Also the shielding/grounding of the beam is not shown or explained. This is why the output of the amplifier is so jittery and noisy. Ideally a connector is not a good thing as this is a further source of noise and offset, soldered joints are best. For maximum performance screen amplifier and strain gauges on load cell and keep analogue leads as short as possible.
Best Regards
Very nice project encoder + load cell
i keep having the error, positive was not declared in this scope. May i know what might have gone wrong?
Thank you for the video
thank you ,
you solved my problem
Hi Michael, thank you for your video. Is it possible to create an output as a digital signal via CANbus for example?
For example to be read and stored on another device that reads CANbus signals?
Thank you!
Nice tutorial, thanks. But how is it possible to get the HX711 BOARD and load cell on proteus. Thanks
Hi Michael. Thank you for this tutorial. I am completely new in this arduino and your simple example really fits to my need. There is just one problem. Somehow my LED backlight is so bright. Is there any way to dim it? Thank you.
Instead of measuring weights if i have to measure voltage in hx711 ,how will be the connection? and how to read 24 bit value?
Thanks for the video. Can i also use this with a Wemos D1 mini or do i have to buy the Arduino Uno
Great vedio.can you please make same project with 1602 lcd keypad and code.i have lcd keypade with all uno,hx711 and load cell.
Thanks
ดีครับโปรแกรมใช้งานได้จริง
Or how can i get the libary for load cell so i can get the load cell and load cell amplifier. I would appreciate you answer ASAp, really need this urgently. Thanks
hello Michael Schoeffler
I use the same hx711 code and I have very good result what I'm looking for is how to modify the code to print the average of 4.5, ....... ADC readings
thank you in advance
Quick question, very, very new to Arduino, how would I create a trigger for the scale to change to a message once the scale gets to a certain point. I am using it to measure when a tray under a dispenser gets full and then triggers a message on the lcd. So essentially I want it to display the mass as this tutorial shows, and then tell me when its overweight.
hello sir ive done the same connections exactly but im getting an error which says "sda_pin" was not declared in this scope
great thanks!
how did you calibrate the load cell?
can i use any arduino single board? eg. pro mini would work too?
I have uesd 16*2 liquidcrystal dispaly. I cant clear the values in lcd to zero after the load has been removed.plz hlp by sending me the code
How sensitive are such weighing cells, can you also use them to weigh in the mg range, e.g. 0.001 g or even 0.0001 g?
plz elaborate how we take calibration value for 1 Kg load cell
Thanks man
Could you do an updated video that goes into adding a Tare (zeroing out) feature and other weight units?
To tare you would just need a button, which when pressed the current value is captured. Then that value will be subtracted from the display.
Can I use an Arduino Micro for this project?
Which LCD library did you use.
Do you know if I can use that product for tension and compression??
Hi, its a such inspring vedio. Where i can get 0.001g precision strain bar? I need one to set up my kitchen lab.
Great tutorial. How Would I print screen to display grains? And also turn off a motor on preset weight? Im building a auto powder dispensor
I also am looking to turn off a motor on a preset weight. Let me know if you find a solution I'm new to arduino!
Maddie Lenschow, Actually I have! I found a form on some1 that is doing this exactly I just mock built it and it works!
forum.arduino.cc/index.php?topic=304695.0
Second pg has the whole code near the bottom. Ill build this and post it on my channel
Nice that you already found a solution! If you use the code from my tutorial as starting point, then in my opinion the easiest way is to add an if-condition to the loop function:
void loop() {
LoadCell.update(); // retrieves data from the load cell
float i = LoadCell.getData(); // get output value
if (i > 500.0) { // weight is greater than 500g
// add your code to turn on the motor
} else {
// add your code to turn off the motor
}
...
Did you also solve how to display grains? That seems a bit challenging for me. If you know the average weight of a single grain, you can divide the total weight by the average weight. As a result, you have an estimate of how many grains are on the weight scale.
Ya i manage to find a few ways. 1 being lcd.print(scal.get.units() * .154324). Im not sure how this code is doing it but I need help getting the delete key to function correctly w/o displaying the character. Also I would like to speed up the servo without pause and slow it down when it gets close to weight also I want to display in .01 grains not .1
heres my ino file I got for now. It works but not the best.
drive.google.com/open?id=175X_I7RwHv7PGZhdzqs_5EkxG068JwJv
Hello am looking for a simple solution for a premix dosing machine in a hammer mill which is diesel powered(no electricity access).The production capacity of the mills is between 100 and 150 kg per hour.The dosing unit should be able to detect the maize being fed in the mill and in turn dose the required premix powder required in the x kgs of maize fed or if the mills does the above x kgs of maize in say 5 minutes the dosing unit should be set to dose the required powder in x kgs of maize in those five minutes.Any one who can solve this or need more details please contact me on email at karanjagichangi@gmail.com.am based in Nairobi Kenya.
Awesome video dude! I'm trying to build my own mini weight scale. Do all of these circuits and load cells come with the wiring?
Typically, the load cells come with the wiring.
so, the 1st step if u want to calibrate is make sure the weight that u want to measure has the same value with the real weight scale?
Hello,
can you help me solve a problem in this context
Thank you.
Hello
Michael,
I used the same organs like you. The problem is, on the screen I get a variation on the value obtained after the weighing.
So I need to stabilize this value, I don't know if there is a component / organ that I can use to stabilize the displayed value
?
Type of scale: Brehm B30-30 Single weighing scale + Capacity 30Kg
The weighed weight: between 0.01g and 200g
Thank's in advance for your return
is your load censor better or the square one
is it possible to connect as the other one, Half-bridge weighing sensor load cell (
rectangle load cell 50kg/110lb) (multiple load cels to one hx711) ?
i need your help, where did you get the liquidcrystal_I2C.h
You need to look for the library online, what helped to compile this was library 1.0.2v
Sir can I get a vdo based on both automatic height and weight BMI calculator using arduino uno board coding and model plz it is essential for my project
How can i set the calibration factor in kilograms using this code
is calibration same in all 5kg china loadcell
Whats d sck frequency to read DIN
hello! how to use 2pcs of sensor ???
How do we make the initial value stay at 0? Becoz it change along with the calibration factor
Havd you found any solution till now?
Com display 7 segmentos 4 dígitos? Não encontrei nada na rede
can i make the scale wher the display screnn is my computer ?
what is calibration factor??.. if anyone knows let me know plz
Hello Michael, how would i solve the problem “POSITIVE was not declared in this scope” thank you
Sir did you solve the problem for positive ?
Hello,sir! I am Thai student. And I follow you in every steps but I got a problem that the LCD, the weight always run as non-stop(it is not 0.00). Please, I need help sir.
how would you add a tare function to this scale with a push button sorry if this is a simple solution im new to using arduinos.
Do you know how to add a button to your setup? If so, then you can make use of the tare-function that is offered by the library (github.com/olkal/HX711_ADC/blob/master/src/HX711_ADC.h line 48)
I can't get this to compile. Can you help me make my load cell work? thanks,
Can you tell me the error message of the compiler? If I have it, I might be able to help ;)
oh thank you,I have watched many videos but their instructions are not detailed
Which software you used to write the program ?
Which?
I do not understand why it always say positive is was not declare in this scope, i did try all the tutorial here i youtube but none of them works
hello sir , i am getting an error while compiling this program code , error is positive was not declared in scope . can you plz help me .
is it possible to control an engine with it? So when 500g is reached that the engine stops?
You can easily control a relay with the arduino to turn things on and off. So, code could be written that when an input reaches a certain level, then a relay is turned off.
hi! good project, is possible send the weight with modbus rs232? i´m from Brasil
thanks!!!!!!!!!!!!
Can i calibrate this code in kilograms?
What is the software name?? we can use this code for run
I notice that it take 2 -3 second for the display to settle down. what is causing the delay? is it because Arduino is too slow or the load cell need time to bend back 0 value? I am looking for 1 second or less respond time. is this possible? will teensy 4.0 help? please help me figure out.
I guess it would be the loading cell bending back into position. If you need it to bend back faster, maybe try to support it with a spring for example.
Hello Michael, how can I solve the error 'POSITIVE' which is not declared in this scope? Thank you
i have the same problem, havent you fixed it yet?
@@janithbandara9552 , try instead that line code for 1602 LCD, this one : LiquidCrystal_I2C lcd(0x27,16,2);
Or the adress can be 0x3F if the backlight of the LCD is green. 0x27 is the adress for the blue backlight.
I'm not a 100% sure, since I published this tutorial a long time ago: I think it has something to do with one of the libraries. Either they are not correctly installed or you have the "wrong" library. I remember that a visitor of my website solved this issue by installing another "LiquidCrystal_I2C" library.
when i uploaded your sketch it shows an error-"POSITIVE was not declared in this scope". what to do? please reply asap
kartik mehetre did u got the answer of ur question? If yes plz tell the solution m also getting this error . Plz help me asap tomorrow is my submission.
I am also getting the same problem
I get this question very often... it's always the same problem: I guess you have installed the "wrong" lcd library (see e.g. here forum.arduino.cc/index.php?topic=214356.0). Unfortunately, there are multiple LCD libraries out there :/
there are two I2C liquid crystal libraries, in one of them you need to define your display as above, but in the other one, you only need to set the I2C chip direction (0x27 by default), and the LCD columns and rows (number of cells)
hi..great tutorial..have a questions..need only the actual weight no the decimal digits..any help ?
i mean 140 no 140.75 and to the zero point need 0 or 0.0 now show 0.3654 and play its no stable...like crazy...thanks for your time
Hi, you can simply convert the retrieved value to an integer:
float value1 = LoadCell.getData();
int value2 = (int) value1;
If you print out value2, the decimal places are gone.
If you require an accurate rounding, e.g. 12.5 becomes 13 instead of 12, you can apply a simple hack:
int value2 = (int) (value1 + 0.5);
As value1 will always be greater than 0, this should give you correct results (does not work this way for negative values).
thanks allot...please need your mail for (little help) my mail is billakis658@gmail.com...thanks again
How can I connect two hx711 with an arduino in software
Not 100% sure, as I did not try it out:
Create two HX711_ADC objects. For example if you second load cell is on pin 6 and 7, the beginning of your code should look like this:
HX711_ADC FirstLoadCell(4, 5);
HX711_ADC SecondLoadCell(6, 7);
Hi Michael, Thanks for sharing your knowledge. I had the same problem with the LCD, but got it fixed, but I have another problem which is:
Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\MHOJUN~1\AppData\Local\Temp\ccf3GMCr.ltrans0.ltrans.o:(.rodata+0x18): undefined reference to `Print::write(unsigned char const*, unsigned int)'
c:/program files/windowsapps/arduinollc.arduinoide_1.8.10.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
Can you help me...Thanks
How did you fix the LCD problem
my lcd cannot show up the point
Cool
😄😄😄
mr. michael i need ur help,, i use load cell 200kg, can i use this program?
Yes, it should work! At least in theory ;) I used the same code also for 10kg and 20kg load cells.
Sir weght machine ka sensor
How about 5ton of loadcell
dont work
"Ardoo eeno"
fucking stop
i have the same positive error tried to download a lot of library but still not working do u have another solution or another part to the code so that i can change it and work LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 0x27 is the i2c address of the LCM1602 IIC v1 module (might differ)