HX711 is a precision 24bit ADC IC designed for weigh scales and industrial control applications to interface directly with a bridge sensor.
A load cell is a transducer that is used to create an electrical signal whose magnitude is directly proportional to the force being measured.
The library you can find here is usefull to implement a weigh scale using the HX711.
References used to implement this library are
This HX711 Arduino library, https://github.com/bogde/HX711
And that other library here https://github.com/getsiddd/HX711
Methods to get raw values and unit values from the HX711 are provided.
Also you can find function to calibrate the IC.
Before using this IC you have to calibrate it against the load cell used.
The calibration task is split in 2 steps:
1) The tare raw value offset needs to be obtained, To perform this task you have to run the calibrate step 1 function without any weight on the load cell.
2) Using the tare raw value and a know weight put on the scale you can capute the scale value that is used to obtain the weighted value.
For this reason is important that the reference weight has a well know value.
Once you have obtained the scale value, you can use it to get weight, and you can also perform a new tare without having to calibrate the scale again.
The sample provieded contains all the step needed to calibrate the sensor and obtain raw and unit values.
This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1Mhz.
Changelog
- v02: fixed a bug in read function, clean code
- v01: first version
hello the schematics and the picture of the connection is different
ReplyDeleteHello, what's the difference?
Deletewhat about d LCD displau
ReplyDeleteHello, yes you can add it. Just use an LCD driver and code a little the sample file to show it on LCD.
DeletePls did use USB to ttl to interface with pc and pls what app did u use on the PC and how did u do it
ReplyDeleteHello, you have to implement your own protocol over UART, and use a USB to TTL adapter like the CP210x based one.
Deletehello,
ReplyDeletecan atmega32/atmega16 be used instead of atmega8?
Hello, yes it can run it.
Deletethanks for your immediate response,
DeleteI already connected the dout and sck pin to A0 and A1 pin respectively, but am unable to get any output on a 20X4 lcd connected to the IC with internal clock off 1 MHz.
Should i connect the pins to digital inputs?
You just have to connect DOUT and PD_SCK, remember to set proper pins in hx711.h file. Also I would not use LCD for the first test, I would use uart. If you have a logic analizer you can find out DOUT and SCK trace to debug what's going on.
DeleteHi, amazing work! Thanks alot.
ReplyDeleteI am having an issue that my weight reading is NOT changing. Can you help me please?
Please let me know if there is any thing to check?
DeleteHello Saad, you could use a logic analizer to inspect the DOUT and PD_SCK lines. Alternatively you can add an uart library and put some uart debug point in the code to check what's wrong. Also consider double checking your wiring, or try with other hx711 board and load cell, it also may be some hardware related error. That's what i would do, hope this helps.
Deletehi sir.
ReplyDeleteI use a 10kg sensor, what should I change.
sorry. |double weight = hx711_getweight();|
Is the value here calculated in kilograms or grams?
I use google translate to ask questions. hope you forgive me.
Xin Cảm Æ n - Thanks You
Dear Thach. The getweight function return the weight based on the calibration weight you have put during calibration. In order to use this sensor you have to calibrate it. You can test the calibration using the sample code provided (take a look at HX711_MODECURRENT), but in a production environment you have to expose the calibration functionalities.
Deletethat means, i need to change the "Offset and scale" parameters ?
DeleteXin Cảm Æ n Ngà i
Yes, those two depends on you load cell.
DeleteXin Cảm Æ n Ngà i :3
DeleteHello brother, This code for Codevision avr?? Or not?
ReplyDeleteHello, no. This library was developed on Eclipse, built with avr-gcc.
DeleteSir I am successfuly build this project but sir I am using 1000 kg load cell but sir reading is fluctuating ,I am want .5 kg accuracy
ReplyDeleteThe reading should not be fluctuating. I think there's something workng. About the accurancy take a look at the combined error of your load cell too.
DeleteSir I am use hx711 ready-made module,pin no 13(VfB) is not used in your ckt VfB is use,in any effe
Deletect this,and what is used this pin?
Hello, there are just two pin you have to score, they usually are named DOUT and SCK.
DeleteCan you interface weight sensor to MegaTRon Atmega 16 Board
ReplyDeleteHello, yes. You should just change the ports used by the chip.
DeleteI have used the B port for LCD display and HX711 load cell also uses B port. what should I do?
DeleteYou can use other ports for one of the two. In case of HX711 you can set the ports in the header file of this library.
DeleteSir I am use load cell at a+ ,a- and sir b+ and b- is connect ground or keep open?
ReplyDeleteHello, you should use A+- and E+- pins, like schematic attached.
DeleteSir, thanks for sharing your own library. I stil got some trouble with your lib, so can i see your main.c to understand more?
ReplyDeleteThanks alot!
Hello. You can find the main,c in the sample project.
DeleteCan you Please show the Weights in LCD Display 16X2. Like if we put a Weight on Load Cell it as to be display in LCD even when weight changes
ReplyDeleteHello, you can build this using the P.Fleury LCD library for AVR, putting all togheter with this library.
DeleteHi. Can I connect 5 HX711 modules to the SCK pin on the ATmega328P. I want to measure force in all 3 axes.
ReplyDeleteHello, you can connect more than one HX711 but you have to change the code for this library. This library just support one ic at time. It wouldn't be that hard.
DeleteSir I am use 1000 kg load cell I want 1 kg accuracy but sir load cell count not sense below 2kg weight.mean loadcell give no count of 1 kg wieght
ReplyDeleteHello, take a look at comment "May 21, 2021 at 6:48 AM"
DeleteSir in here when we use atmega32 should we need to resolute the digital signal to 24 bit to 8 bit?
ReplyDeleteHello, you can use the library as provided, there should not be problem using this on ATmega32.
DeleteI need to get force and then it send to activate vibration motor. What kind of vibration motor should I use? Can I use 12V DC motor?
ReplyDeleteHello B, i don't understand your question.
Delete