Load Cell HX711

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Load Cell HX711

Post by George_B »

Hello all,

I would like to read the analogue to digital converter in the link below.


https://cdn.sparkfun.com/datasheets/Sen ... nglish.pdf


Would it be possible to know how to get the data from HX711 chip?

Is there any FC6 example ?


Best Regards
George

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Load Cell HX711

Post by petesmart »

Hi George,

Attached is a macro is created in fc6, it will also work in fc7. It reads 24 bits of data from the hx711 chip....the project I used this for was a 4 load cell scale connected in a Wheatstone bridge config. Import the macro into your project and call it as a routine.

Note - given the sensitivity of the hx711 you will need to average the output .

Let me know how you go

Best

Pete
Attachments
HX711.FCM
Hx711 macro
(9.06 KiB) Downloaded 878 times
sorry about that Chief!

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Load Cell HX711

Post by George_B »

Hi Pete! Thanks for your reply and your time!

I tried to make up a program including your macro. Unfortunately i ended up with no good results although i wont be disappointed at all.

In order to avoid a lot of texting here, i will upload the FC6 program with this post so you all can have a look and/or improve the file.

I will also include the wiring i used between load cell and HX711 module .

The weight value in LCD is not stable and seems to fluctuate up and down a lot.


Thanks again!
George

http://www.ebay.co.uk/itm/291644547509? ... EBIDX%3AIT
Connec.jpg
(148.41 KiB) Downloaded 2340 times
HX711 Weight ADC Module.fcfx
(16.66 KiB) Downloaded 801 times

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Load Cell HX711

Post by petesmart »

Hi George,

The fluctuation is pretty normal to a degree - hence my reason to suggest an averaging methodology.....Also check your PSU - do you have filter caps close to the HX711 Chip/board?... this can be a source of noise...

The other thing you can do is reduce the gain and scale up... this may also assist.

When I get moment I will have a look at your project

best

Pete
sorry about that Chief!

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Load Cell HX711

Post by petesmart »

ok... had a look at your project....

when I created the macro, I left all of the config options disabled :oops: - you will need to enable the icons in the red circle and then it should work...the data sheet will give you a good insight as to the config options vs function

let me know how you go

best

Pete
Attachments
enable.JPG
enable these icons
(76.23 KiB) Downloaded 2324 times
sorry about that Chief!

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Load Cell HX711

Post by George_B »

Hi Pete,

I tried your suggestion but again the results were not very good.

I get at least a number on the LCD and i assume that the Load Cell may be a crappy one...therefore i will look for a better load cell to make my test.

Is there any load cell which operates well and been tested with this module ?


Thank you
George

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Load Cell HX711

Post by petesmart »

Hi George,

I used 4 load cells from a bathroom scale I purchased for $25...very cheap and cheerful

4 cells wire in a Wheatstone bridge config is good for 150kg with a resolution of 1 gram (ish)

Can you describe what not very good means?..do you know the scaling factor?

Best

Pete
sorry about that Chief!

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: Load Cell HX711

Post by chipfryer27 »

Hi Pete / George

First off, thanks for posts on this subject. I have found them to be very helpful.

I recently obtained one of the HX711 modules from eBay so armed with your posts and a lot of gung-ho I set about experimenting.

I see that the modules come in a variety of flavours, mine is the XFW-HX711, a green board with headers for the four Load cell connections, nothing for the screen. I also have quite a few load cells (each is its own wheatstone bridge) rated 5Kg and 20Kg. Each of these cells come with a calibration certificate stating that their accuracy is class C3.

Ages ago, using these and an Instrumentation Amp, I could get quite accurate and repeatable readings just by feeding the output of the amp into an ADC port on the uC directly. I could differentiate between the addition and removal of a "few tens of grams" at a time, and readings were quite stable in that each "read cycle" returned the same values more or less (I would like to stress that absolute accuracy was not a consideration in this application, just a means to know when certain criteria had been met, and I did have to average out readings per cycle) so I was keen to see what this module would offer.

Hooking up the HX711 to an EB-006 (PIC18F4520) via a plug-in expander on Port C and an EB083 connected for its LCD, running Pete's code with mods made to connect over Port C gave immediate results. Scaling and calibration variables in the macro I didn't care about for testing, so they were set to 1. Loop delay was set at 10ms as per Georges posted Flowchart and I varied the average, counting 5, 10, 20, 100 and 200 times.

In each instance the results returned after averaging, had a variation of approx +/- 7% between readings. By that I mean I took 20, separate "averaged" readings, and each reading varied by around 7% from each other. Not good. Repeating with other load cells gave similar results and clearly something was amiss and I initially thought the module to be at fault. Perhaps this is what George saw too?

Reading the datasheet (which is always a last resort <s>) suggested that I might be accessing too quickly, therefore I increased the loop delay from 10ms to 400ms which gave an immediate improvement. Averaging 5 times gave a variation between readings of approx +/- 0.6%, averaging 10 times gave a variation of +/- 0.3% whilst averaging 100 times returned a variation of +/- 0.12%, although admittedly it does take "ages" to update :)

As this module is far cheaper than the Instrumentation Amplifier I used, and is capable of repeatable accuracy (for my needs anyway) I think it will be included in my armoury.. :)

I hope this may help.
Regards

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times
Contact:

Re: Load Cell HX711

Post by tech »

Hi Pete,

Which variable in the macro should I use to display in an LCD?

Best

Chris

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: Load Cell HX711

Post by chipfryer27 »

Hi

I don't have access to FC just now (traveling) but from memory I believe Pete's macro, that he kindly shared, "built" a value. By that it was created taking other variables into account (such as scaling) etc, therefore the "final "weight" was if I remember correctly calculated near the very end of the macro, after averaging etc. I really can't remember it's name but I would guess it would be something like "weight" or an abbreviation of such.

Try displaying whatever variable(s) you find near the end, after all you can't break anything <s>

Hope this helps

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times
Contact:

Re: Load Cell HX711

Post by tech »

Hi,

Ok i will check this out and see what i can do!

Thank you for your help.

Chris

Post Reply