Coder Social home page Coder Social logo

Calculating the proper SCALE value about hx711 HOT 10 OPEN

bogde avatar bogde commented on July 18, 2024
Calculating the proper SCALE value

from hx711.

Comments (10)

vicatcu avatar vicatcu commented on July 18, 2024 2

@vainell https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide does a far more thorough job of it than anyone could do justice to in a github issue response. If that doesn't sort you out, then you should probably post questions to a relevant forum, like https://forum.arduino.cc/ or https://electronics.stackexchange.com/, but certainly you should provide a well thought out question with details demonstrating the extent to which you have (tried to) make progress on your own, when doing so.

Also, you should look at https://github.com/bogde/HX711/tree/master/examples for sample code.

from hx711.

vicatcu avatar vicatcu commented on July 18, 2024 2

@vainell you can use this line of code to get a raw Analog-to-Digital conversion from the HX711:

int32_t weight_adc = hx711.read_average(1); 
// this will be a 24-bit signed integer value, 
// and frankly who cares what it represents, except 
// recognize that its magnitude is directly (i.e. linearly) 
// related to the mass attached to the load cell

If you print that value out for multiple known loads (at least two), you should be able to figure out the slope / intercept to convert the ADC reading into a mass (e.g. by doing your own least squares regression or whatever). Then you can apply that model to your ADC reading. That's the best you can do, and given that you are doing something one-off, certainly what I would recommend doing. So basically two steps: (1) determine the slope and intercept for your HX711 + Load Cell combination, and (2) use those as runtime parameters to DIY the conversion to mass.

from hx711.

bogde avatar bogde commented on July 18, 2024

thanks for that. i have a green chinese board and a dfrobot one. i'll try to apply your math to see how it goes.

from hx711.

vicatcu avatar vicatcu commented on July 18, 2024

@Bartimaeus- I'm trying to understand this and at the end of the day SCALE should have units of ADC counts per unit weight (e.g. ticks / kg), because that's what it's used for here. The term that is throwing me off the most is:

output = the output rating of the load cell (mV/V). Should be in volts, if your final result looks wrong see if it is off by some factor of 10 to see if you forgot to account for the unit changes.

... this primer describes output rating as:

the difference in the output of the sensor between when it is fully loaded to its rated capacity, and when it’s unloaded. Effectively, it’s how sensitive the sensor is, and corresponds to the gain calculated when calibrating the sensor. More expensive sensors have an exact rated output based on an individual calibration done at the factory.

So what would you use for the "output rating" of this load cell? Something tells me 1.0 (listed as Rated Output) isn't the right idea, but perhaps 0.001 is? If I try and reconstruct how you ended up where you ended up, I think it's predicated on the fact that you have a coefficient of linearity from the manufacturer, encapsulated in the 'output' constant (or have otherwise characterized this for yourself), right?

Coming back around to where I started, if I apply dimensional analysis to the equation you came up with, and 'output' has units of V, then SCALE ends up in units of: (V * 1 * ticks * V)/(kg * V) = V * ticks / kg... what am I missing?

from hx711.

Draeeannae avatar Draeeannae commented on July 18, 2024

Hello All!

Currently looking to use a HX711 in a school project, the force sensor we are using is a FSS020WNSB (link listed below)
https://sensing.honeywell.com/index.php?ci_id=50137

We are attempting to calculate the SCALE value for the output, but are having some difficulties. We are not finding the output rating of our load cell, which should be clearly stated within out datasheet. The sensitivity is provided, and we have been multiplying this value by the maximum load (20 N) in order to get a value with the correct units (1.8 mV/V/N * 20 N = 36 mV/V).

Additionally, looking at the discussion above, we are not sure how the adc_range accounts into the function. When we attempt to multiply this value in our calculations, it seems to inflate out output to an unrealisticly high value. Does the output value compensate for this?

Using the guideline listed above, this is where we are at:

Output: not sure how to calculate this value (currently using 36 mV/V)

adc_range: Same as provided in example above

Excitation: 5V, same as Vcc

cell_range: 20 N (from datasheet listed above)

Vcc: 5V, same as Excitation


scale = (36 * 128 * 16777215 * 5) / (20 N * 5) = 3650721984

(Does not seem like a valid value, considering scale = 1 in provided code)

Any assistance in this would be much appreciated! Thank you for your time!

from hx711.

bogde avatar bogde commented on July 18, 2024

can you test and verify your math using a known weight or something like that?

i think the typical output rating for your load cell is 1.8 (sensitivity - in your datasheet). see @vicatcu 's comment above.

scale = 1 provided in the code has no special meaning, it doesn't mean your value must be close to that.

from hx711.

Bartimaeus- avatar Bartimaeus- commented on July 18, 2024

@vicatcu from Wikipedia:
"The cell output is rated in millivolts per volt (mV/V) of the difference voltage at full rated mechanical load. So a 2.96 mV/V load cell will provide 29.6 millivolt signal at full load when excited with 10 volts. "

The equation becomes simplified a bit if your excitation voltage is also the VCC of your amplifier because the two terms cancel out.

from hx711.

louiepaguilar avatar louiepaguilar commented on July 18, 2024

guys, im an IT student, and my project currently involves weighing scale. So i bought arduino mega 2560, hx711, and 4pcs of 50kg load scale (total of 200kg). now, i still dont understand how to make this thing work (to get the kilogram).. can someone please explain it to me or atleast provide a sample code?

from hx711.

louiepaguilar avatar louiepaguilar commented on July 18, 2024

@vicatcu i tried the sample code but im still in puzzle because i dont know how to get the kilogram from it, and also on how to get the proper calibration value to pass to set_scale(); to get the proper result for my own load scale. ive tried many calibration value but to no luck im still not getting the exact result. im sorry, im just a newbie and am also not an ECE student so i dont understand much of their terms

from hx711.

davidjonz2005 avatar davidjonz2005 commented on July 18, 2024

just write down what you read from Hx711 and what is the exact load in a row for each sample .
the more sample the better precision

use Excel and make a scatter drawing by those pair point, exact measure as y and module reading as x axis.
right click on the graph and choose add trend lines ,select linear , and in the bottom select display equation in chart,

equation is like y=ax+b which means that you must multiple each reading to a and then add it by b

from hx711.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.