Comments (10)
hello,
you just need to do the calibration once for each load cell, so you don't have to use the calibration function in your "production" code. you can just use parts of the included example to calibrate your load cell and get that constant value you need to use in your code.
also, you just need to use the tare function once, when you start weighting, for instance before placing the beehive on the scale (or just after you placed it if you want to get the weight of the honey only).
let me know if you have any questions.
btw, what do you plan to use for gsm communication?
bogdan
from hx711.
Can you give me an example of the code I would use to get the calibration value?
So the tare function wont kick in each time the arduino wakes and runs the code? - effectively zeroing with the weight of the hive on it?
I will use a gsm Sim900 shield. This is just a prototype, I will go to a more barebones setup if it works well.
thanks for the response!
from hx711.
the calibration procedure is described in the readme file:
How to Calibrate Your Scale
Call set_scale() with no parameter.
Call set_tare() with no parameter.
Place a known weight on the scale and call get_units(10).
Divide the result in step 3 to your known weight. You should get about the parameter you need to pass to set_scale.
Adjust the parameter in step 4 until you get an accurate reading.
so you would do a simple program that does everything in setup(): call set_scale, call set_tare, output something like "you have 10 seconds to place a known weight on the scale" to the serial console, delay 10 seconds (while you place your weight), call get_units, divide the result to the known weight and output it to the serial console, something like that.
depending on your application you may or may now want to run the tare function every time the device is powered on. in your particular case, i wouldn't run it, but you know your requirements better.
from hx711.
something like:
#include "HX711.h"
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0
HX711 scale(A1, A0); // parameter "gain" is ommited; the default value 128 is used by the library
void setup() {
Serial.println("You Have 20s to Place a Known weight on the Sensor:"); // Time delay to place weight
delay(20000);
scale.set_scale(); // this value is obtained by dividing the calibration value with the known weight;
scale.tare(); // reset the scale to 0
Serial.println("Calibration Value:"); // divide this bby the weight of the load used
}
void loop() {
Serial.print("Divide this by value by the weight used in desired output units e.g. Grams/Kilograms:\t");
Serial.print(scale.get_units(10));
scale.power_down(); // put the ADC in sleep mode
delay(1000);
scale.power_up();
}
from hx711.
Is it better to have the get_units take the average from more readings? - in the example I assume it is the average of 10 readings, but will the weight be more accurate if we used 100?
I am using a load cell rated at 300kg, but I am only using a 10kg sample weight to calibrate, will I get more accurate readings using a larger weight?
I also notice, when I have weight on, the values fluctuate dramatically, is this likely to just be because I haven't calibrated it successfully?
Thanks!
from hx711.
you have to call set_scale() and tare() before placing your weight on the scale, so before starting the 20 seconds delay.
i dont know if reading the sensor 100 times is more accurate, but most likely you will see less fluctuation in the resulting value.
i can't answer your other questions. i don't have extensive experience with load cells and don't know anything about your specific setup.
good luck with your project!
from hx711.
can someone please post an example of how to get the kilogram. im using 4pcs Human Body scale load cell sensor resistance strain 50kg half-bridge sensors ..
from hx711.
Thanks again for the code, but I am confused. There is no member in the library set
_tare(). I don't expect you to remember every piece of code you've written, but you are referring to the call (for an object instantiated as scale) scale.tare(); correct?
from hx711.
@kbickham yes, that's correct. i also updated my comment above.
from hx711.
This sketch could be helpfull:
#include "HX711.h"
const int PIN_SCK = 32;
const int PIN_DOUT = 33;
HX711 scale;
float calibration;
void setup() {
Serial.begin(9600);
scale.begin(PIN_SCK, PIN_DOUT);
Serial.println("Please place a known weight on the scale and enter its weight:");
scale.set_scale(); // this value is obtained by dividing the calibration value with the known weight;
scale.tare(); // reset the scale to 0
float m = 0;
boolean f = 0;
while (f == 0) {
if (Serial.available() > 0) {
m = Serial.parseFloat();
if (m != 0) {
Serial.print("Known mass is: ");
Serial.println(m);
f = 1;
}
else {
Serial.println("Invalid value");
}
}
}
float unit = scale.get_units(20);
Serial.print("Calibration Value: ");
calibration = unit / m;
Serial.println(calibration);
}
void loop() {
Serial.print("Read: ");
Serial.println(scale.get_units(20) / calibration);
delay(100);
}
from hx711.
Related Issues (20)
- Creep effect removal. Load cell storage over long time HOT 5
- Arduino 2 support
- Formula to find hx711 output of load cell voltage output HOT 1
- Arduino MKR 1010 Upload failure
- Arduino freezes after about 1 hour of continuous reading
- serial monitor freezes on arduino uno when data or clock from HX711 is connected to the arduino digital data pin
- Should function "scale.tare();" need a parameter? HOT 2
- add NRF to compatible boards list
- Verify my wiring (HX711 with four strain gauges) HOT 2
- Multiple HX711 with one clock HOT 1
- warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
- Reason behind using D2 and D3 pins HOT 1
- HX711 only reads once on startup HOT 2
- How to check load cell is connected or not
- What are possible values for scale.set_scale(2280.f); HOT 2
- 71
- self-calibration of load cell
- HX711 not thread safe?
- HX711 high current consumption
- Error on `make build-all` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hx711.