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/...
  • НаукаНаука

Комментарии • 117

  • @georgbrunhuber2329
    @georgbrunhuber2329 5 лет назад +8

    Hello, I have loaded your code always brings me error 'POSITIVE' which is not declared in this scope you can help me.
    Greeting Georg

    • @mschoeffler
      @mschoeffler  3 года назад +3

      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.

    • @stephenkamin1345
      @stephenkamin1345 3 года назад +2

      @@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?

    • @prajwalbs600
      @prajwalbs600 3 года назад

      Did any one find the solution for this line????

    • @stephenkamin1345
      @stephenkamin1345 3 года назад +3

      @@prajwalbs600 I used the LiquidCrystal lib from here.... aws1.discourse-cdn.com/arduino/original/3X/4/5/45a281b9d61bdb6af3c8d67148a836411c892696.zip

    • @prajwalbs600
      @prajwalbs600 3 года назад

      @@stephenkamin1345 did it work?

  • @FilmFactry
    @FilmFactry 6 лет назад

    Thank you!
    I really enjoy how clear your tutorials are.

  • @julimarcoxim
    @julimarcoxim 6 лет назад +1

    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

  • @eCitizen1
    @eCitizen1 5 лет назад

    Thank you. This was very informative and easy to understand.

  • @bablugaonkar666
    @bablugaonkar666 Год назад +1

    Your explanation is very clear and i have done this loadcell it's successful good vedio

  • @martindare5803
    @martindare5803 5 лет назад +2

    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

  • @amirmomin5283
    @amirmomin5283 6 лет назад

    Very nice project encoder + load cell

  • @vickieng4454
    @vickieng4454 6 лет назад +5

    i keep having the error, positive was not declared in this scope. May i know what might have gone wrong?

  • @johnxisde
    @johnxisde 6 лет назад

    Thank you for the video

  • @andrisaputra7946
    @andrisaputra7946 4 года назад

    thank you ,
    you solved my problem

  • @crcpeart
    @crcpeart 5 лет назад

    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!

  • @adeshinaodukoya
    @adeshinaodukoya 6 лет назад

    Nice tutorial, thanks. But how is it possible to get the HX711 BOARD and load cell on proteus. Thanks

  • @rakhmataditra9976
    @rakhmataditra9976 2 года назад

    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.

  • @SushmaMantaganiYT
    @SushmaMantaganiYT 6 лет назад

    Instead of measuring weights if i have to measure voltage in hx711 ,how will be the connection? and how to read 24 bit value?

  • @nikowinter833
    @nikowinter833 4 года назад

    Thanks for the video. Can i also use this with a Wemos D1 mini or do i have to buy the Arduino Uno

  • @yogiparmar1290
    @yogiparmar1290 6 лет назад

    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

  • @detdamdongbori_Diy_inventer
    @detdamdongbori_Diy_inventer 4 года назад

    ดีครับโปรแกรมใช้งานได้จริง

  • @adeshinaodukoya
    @adeshinaodukoya 6 лет назад

    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

  • @mnouredine9900
    @mnouredine9900 5 лет назад

    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

  • @anubis1416
    @anubis1416 5 лет назад

    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.

  • @nakshav7030
    @nakshav7030 5 лет назад

    hello sir ive done the same connections exactly but im getting an error which says "sda_pin" was not declared in this scope

  • @serhatkoroglu5537
    @serhatkoroglu5537 6 лет назад

    great thanks!

  • @carlagatil5089
    @carlagatil5089 5 лет назад +1

    how did you calibrate the load cell?

  • @supernova6553
    @supernova6553 6 лет назад

    can i use any arduino single board? eg. pro mini would work too?

  • @koushikkk4822
    @koushikkk4822 6 лет назад

    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

  • @SciDOCMBC
    @SciDOCMBC 4 года назад

    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?

  • @amitarathi8430
    @amitarathi8430 4 года назад

    plz elaborate how we take calibration value for 1 Kg load cell

  • @mythorganizer4222
    @mythorganizer4222 5 лет назад

    Thanks man

  • @user-dr2pg8fk2i
    @user-dr2pg8fk2i 4 года назад

    Could you do an updated video that goes into adding a Tare (zeroing out) feature and other weight units?

    • @charliejonas3416
      @charliejonas3416 4 года назад

      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.

  • @ceciliabotta9516
    @ceciliabotta9516 5 лет назад

    Can I use an Arduino Micro for this project?

  • @hamptonray5945
    @hamptonray5945 6 лет назад

    Which LCD library did you use.

  • @luchodovidio7202
    @luchodovidio7202 3 месяца назад

    Do you know if I can use that product for tension and compression??

  • @wonderwang1585
    @wonderwang1585 4 года назад

    Hi, its a such inspring vedio. Where i can get 0.001g precision strain bar? I need one to set up my kitchen lab.

  • @EagleEyeShooting
    @EagleEyeShooting 6 лет назад +3

    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

    • @user-et9im5mg9b
      @user-et9im5mg9b 6 лет назад +1

      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!

    • @EagleEyeShooting
      @EagleEyeShooting 6 лет назад

      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

    • @mschoeffler
      @mschoeffler  6 лет назад

      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.

    • @EagleEyeShooting
      @EagleEyeShooting 6 лет назад

      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

    • @karanjagichangi8424
      @karanjagichangi8424 6 лет назад

      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.

  • @mikephilmelendez
    @mikephilmelendez 2 года назад

    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?

    • @mschoeffler
      @mschoeffler  2 года назад

      Typically, the load cells come with the wiring.

  • @fikriahmadi4493
    @fikriahmadi4493 5 лет назад

    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?

  • @soussiamouhtadi7423
    @soussiamouhtadi7423 4 года назад

    Hello,
    can you help me solve a problem in this context
    Thank you.

  • @abdelhafidchafi4194
    @abdelhafidchafi4194 3 года назад

    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

  • @ahmetselim1166
    @ahmetselim1166 3 года назад

    is your load censor better or the square one

  • @1701Mackan
    @1701Mackan 10 месяцев назад

    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) ?

  • @vickieng4454
    @vickieng4454 6 лет назад +2

    i need your help, where did you get the liquidcrystal_I2C.h

    • @franciscomoo2917
      @franciscomoo2917 6 лет назад +1

      You need to look for the library online, what helped to compile this was library 1.0.2v

  • @XB-bhagyashreeKulkarni
    @XB-bhagyashreeKulkarni 3 года назад

    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

  • @geraldoroc2495
    @geraldoroc2495 Год назад

    How can i set the calibration factor in kilograms using this code

  • @ahmetselim1166
    @ahmetselim1166 3 года назад +1

    is calibration same in all 5kg china loadcell

  • @makshay157
    @makshay157 5 лет назад

    Whats d sck frequency to read DIN

  • @tumenbayarmunkhjargal6677
    @tumenbayarmunkhjargal6677 4 года назад

    hello! how to use 2pcs of sensor ???

  • @vinceadriandemesa9846
    @vinceadriandemesa9846 5 лет назад +1

    How do we make the initial value stay at 0? Becoz it change along with the calibration factor

  • @Maxwellmarquito
    @Maxwellmarquito 4 года назад

    Com display 7 segmentos 4 dígitos? Não encontrei nada na rede

  • @yassineyass3538
    @yassineyass3538 2 месяца назад

    can i make the scale wher the display screnn is my computer ?

  • @jananim6198
    @jananim6198 2 года назад

    what is calibration factor??.. if anyone knows let me know plz

  • @23leovan
    @23leovan 5 лет назад +4

    Hello Michael, how would i solve the problem “POSITIVE was not declared in this scope” thank you

    • @prajwalbs600
      @prajwalbs600 3 года назад

      Sir did you solve the problem for positive ?

  • @user-ke2fg2fj8g
    @user-ke2fg2fj8g 5 лет назад +1

    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.

  • @brettrichard78
    @brettrichard78 6 лет назад

    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.

    • @mschoeffler
      @mschoeffler  6 лет назад

      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)

  • @johnmaloney8161
    @johnmaloney8161 6 лет назад

    I can't get this to compile. Can you help me make my load cell work? thanks,

    • @mschoeffler
      @mschoeffler  6 лет назад

      Can you tell me the error message of the compiler? If I have it, I might be able to help ;)

  • @tuyennguyenvan5964
    @tuyennguyenvan5964 4 года назад

    oh thank you,I have watched many videos but their instructions are not detailed

  • @osdigi7138
    @osdigi7138 5 лет назад +1

    Which software you used to write the program ?

  • @starklightning8893
    @starklightning8893 5 лет назад

    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

  • @SATYAMSINGH-ei5jt
    @SATYAMSINGH-ei5jt 2 года назад

    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 .

  • @serious-rc933
    @serious-rc933 4 года назад

    is it possible to control an engine with it? So when 500g is reached that the engine stops?

    • @stevensheldon9271
      @stevensheldon9271 3 года назад

      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.

  • @valmirqueiroz9336
    @valmirqueiroz9336 4 года назад

    hi! good project, is possible send the weight with modbus rs232? i´m from Brasil

  • @geraldoroc2495
    @geraldoroc2495 Год назад

    Can i calibrate this code in kilograms?

  • @jananim6198
    @jananim6198 2 года назад

    What is the software name?? we can use this code for run

  • @xz86
    @xz86 4 года назад

    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.

    • @N0Matchf0und
      @N0Matchf0und 4 года назад

      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.

  • @jonathansiew652
    @jonathansiew652 4 года назад +1

    Hello Michael, how can I solve the error 'POSITIVE' which is not declared in this scope? Thank you

    • @janithbandara9552
      @janithbandara9552 4 года назад

      i have the same problem, havent you fixed it yet?

    • @constantingavril4713
      @constantingavril4713 4 года назад

      @@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.

    • @mschoeffler
      @mschoeffler  4 года назад

      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.

  • @kartikmehetre7736
    @kartikmehetre7736 6 лет назад

    when i uploaded your sketch it shows an error-"POSITIVE was not declared in this scope". what to do? please reply asap

    • @jasimmallick8182
      @jasimmallick8182 6 лет назад

      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.

    • @anthonymcdaniel2812
      @anthonymcdaniel2812 6 лет назад

      I am also getting the same problem

    • @mschoeffler
      @mschoeffler  6 лет назад +2

      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 :/

    • @carlosalbertomacielramirez2340
      @carlosalbertomacielramirez2340 6 лет назад

      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)

  • @billakis7591
    @billakis7591 6 лет назад +1

    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

    • @mschoeffler
      @mschoeffler  6 лет назад +1

      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).

    • @billakis7591
      @billakis7591 6 лет назад

      thanks allot...please need your mail for (little help) my mail is billakis658@gmail.com...thanks again

  • @hamidalizadeh2950
    @hamidalizadeh2950 4 года назад

    How can I connect two hx711 with an arduino in software

    • @mschoeffler
      @mschoeffler  4 года назад +1

      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);

  • @mhojunction
    @mhojunction 6 лет назад

    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

  • @SEKEDARTUTOR434
    @SEKEDARTUTOR434 5 лет назад

    my lcd cannot show up the point

  • @kodjosodjineakpane9796
    @kodjosodjineakpane9796 6 лет назад

    Cool

  • @marklouiealforte4388
    @marklouiealforte4388 5 лет назад

    😄😄😄

  • @tripramanautama2561
    @tripramanautama2561 6 лет назад

    mr. michael i need ur help,, i use load cell 200kg, can i use this program?

    • @mschoeffler
      @mschoeffler  6 лет назад

      Yes, it should work! At least in theory ;) I used the same code also for 10kg and 20kg load cells.

    • @rajeshjolly1490
      @rajeshjolly1490 5 лет назад

      Sir weght machine ka sensor

  • @jacksymon91
    @jacksymon91 4 года назад

    How about 5ton of loadcell

  • @doglabdogtraining-gus.8873
    @doglabdogtraining-gus.8873 2 года назад

    dont work

  • @williamcampbell9859
    @williamcampbell9859 3 года назад

    "Ardoo eeno"
    fucking stop

  • @tobia9376
    @tobia9376 2 года назад

    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)