Comments (13)
Hi
I'm not familiar with how the ESP32 behaves during sleep/wake, but the library includes som functions for tare manipulation that could be useful.
Maybe something like this:
long myTarevalue;
myTarevalue = LoadCell.getTareOffset(); //store
//go to sleep...
//wake up...
LoadCell.setTareOffset(myTarevalue); //restore
from hx711_adc.
Hi,
Thank you for the great library! With my latest CoG-scale I encountered with a problem; everything else works like earlier but there is a linear drift in readings, depending on weight area it is from 0,1 g / 5 sec to maybe 0,2 g / sec. The same issue applies on both load cell-HX711 -pairs, so I think there is no HW problem. Have you bumped in to this kind of problem? If library's smoothing function is disabled the drifting turns slower but still exists. I tried also different sample sizes (config.h) and disabling the outlier -compensation.
from hx711_adc.
So, on ESP8266 if I do not use LoadCell.start (stabilizingtime); at start, values are added and go up to -370 kg. I also need to ensure that at start there is no tare and the weight is shown with a load, and not be reset to zero at the start of the system.
from hx711_adc.
If you want to be sure that tare is not executed at the start of the sketch, just leave out function LoadCell.start (stabilizingtime) in setup().
I don't quite understand what you mean by "values are added and go up to -370 kg"?
Note that the raw conversion value from HX711 is always a positive number, and the readout can only be negative if the tare offset is grater than the conversion value. So if you dont apply a tare offset I don't think it's possible to get a negative number readout.
from hx711_adc.
negative is not a problem. Just changed the wires E +, E-. ))))
This is what I meant when I said values are added:
Starting...
Startup + tare is complete
Load_cell output val: 0.00
Load_cell output val: 23.72
Load_cell output val: 47.44
Load_cell output val: 94.89
Load_cell output val: 118.62
Load_cell output val: 142.34
Load_cell output val: 166.06
Load_cell output val: 189.78
Load_cell output val: 213.51
Load_cell output val: 237.23
Load_cell output val: 260.96
Load_cell output val: 284.68
Load_cell output val: 332.13
Load_cell output val: 355.85
Load_cell output val: 379.57
Load_cell output val: 379.58
Load_cell output val: 379.58
Load_cell output val: 379.57
Load_cell output val: 379.57
Load_cell output val: 379.57
Load_cell output val: 379.57
Load_cell output val: 379.57
`//-------------------------------------------------------------------------------------
// HX711_ADC.h
// Arduino master library for HX711 24-Bit Analog-to-Digital Converter for Weigh Scales
// Olav Kallhovd sept2017
// Tested with : HX711 asian module on channel A and YZC-133 3kg load cell
// Tested with MCU : Arduino Nano, ESP8266
//-------------------------------------------------------------------------------------
// This is an example sketch on how to use this library
// Settling time (number of samples) and data filtering can be adjusted in the config.h file
#include <HX711_ADC.h>
#include <EEPROM.h>
//HX711 constructor (dout pin, sck pin):
HX711_ADC LoadCell(12, 14);
const int eepromAdress = 0;
long t;
void setup() {
float calValue; // calibration value
calValue = 22325.24; // uncomment this if you want to set this value in the sketch
//22325,24;
#if defined(ESP8266)
//EEPROM.begin(512); // uncomment this if you use ESP8266 and want to fetch the value from eeprom
#endif
//EEPROM.get(eepromAdress, calValue); // uncomment this if you want to fetch the value from eeprom
Serial.begin(9600); delay(10);
Serial.println();
Serial.println("Starting...");
LoadCell.begin();
long stabilisingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilising time
//LoadCell.start(stabilisingtime);
if(LoadCell.getTareTimeoutFlag()) {
Serial.println("Tare timeout, check MCU>HX711 wiring and pin designations");
}
else {
LoadCell.setCalFactor(calValue); // set calibration value (float)
Serial.println("Startup + tare is complete");
}
}
void loop() {
//update() should be called at least as often as HX711 sample rate; >10Hz@10SPS, >80Hz@80SPS
//use of delay in sketch will reduce effective sample rate (be carefull with use of delay() in the loop)
LoadCell.update();
//get smoothed value from data set
if (millis() > t + 100) {
float i = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(i);
t = millis();
}
//receive from serial terminal
if (Serial.available() > 0) {
float i;
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay();
}
//check if last tare operation is complete
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
}
}`
from hx711_adc.
I took another new ESP8266, new HX711, and new 50 kg load cells. Connected on wires 5 cm to eliminate interference. The result is the same.
Starting...
Startup + tare is complete
Load_cell output val: 0.00
Load_cell output val: 0.00
Load_cell output val: 0.00
Load_cell output val: 0.00
Load_cell output val: 0.00
Load_cell output val: 0.00
Load_cell output val: 22.24
Load_cell output val: 44.49
Load_cell output val: 66.73
Load_cell output val: 88.97
Load_cell output val: 111.22
Load_cell output val: 133.46
Load_cell output val: 155.71
Load_cell output val: 177.95
Load_cell output val: 200.19
Load_cell output val: 222.44
Load_cell output val: 266.92
Load_cell output val: 289.17
Load_cell output val: 311.41
Load_cell output val: 333.66
Load_cell output val: 355.90
Load_cell output val: 355.90
Load_cell output val: 355.90
Load_cell output val: 355.90
Load_cell output val: 355.90
Load_cell output val: 355.90
Load_cell output val: 355.90
from hx711_adc.
Hi
The function getData() returns an average of the library's rolling data set (default is 16+2 samples), but when you start, the dataset is empty, thats why the first readout is 0 and then increasing until the dataset is filled up with data.
If you need to have the data correct from the very first call to getData() in loop() you must first fill up the data set with conversions so that the average value reflects the actual data from HX711.
You could try to put this code in the setup() part of your sketch to fill up the data set before the loop() is started (this code has not tested, hope it works... ):
int s = LoadCell.getSamplesInUse() + 2; // get number of samples in data set
while( s > 0 ) {
if (digitalRead(12) == LOW) { // HX711 dout pin is pulled low when a new conversion is ready
LoadCell.getData(); // add data to the set and start next conversion
s--;
}
}
from hx711_adc.
no, it did not work. I even increased the request period. Data is filled in for 3 requests of 500ms.
So the calibration went wrong too? Why do the values eventually increase to 370 kg if there is nothing on the scale? I did the calibration according to the instructions: starting on an empty scale, set the weight to 90 kg, entered 90 kg into the port.
from hx711_adc.
I forgot to include the update() function in the code snippet, that's why it didn't work. Updated and tested version below, put it at the bottom of the setup() part of your sketch.
///assuming that the dout pin is connected to D12:
int s = LoadCell.getSamplesInUse() + 2; // get number of samples in data set
while ( s > 0 ) {
LoadCell.update();
if (digitalRead(12) == LOW) { // HX711 dout pin is pulled low when a new conversion is ready
LoadCell.getData(); // add data to the set and start next conversion
s--;
}
}
The no-load value of 370 is probably because you didn't apply any tare offset. Similar; when I run your sketch (using my own calibration factor) on my 1kg loadcell without any mass, I get a no-load value of 12300gr. If I then send 't' in the terminal to perform tare offset, the no-load value is 0gr as it should be. If you don't want to use the library tare function, you will have to substract the zero value (370) in your sketch to get the actual mass. Or you can manipulate the library tare offset by using the functions described in post no. 2.
To check if calibration is correct, just add a known mass to the loadcell and observe if the value is increased by the correct number.
BTW; You probably know this, but the timing of 100ms (I assume this is what you changed to 500ms) in the example sketch does not affect the library data sampling at all, it's just the Serialprint interval.
from hx711_adc.
Thanks. But this does not always work. WatchDog on the ESP8266 sometimes turns on.
from hx711_adc.
Try to include yield(); or delay(1); at the end of the above while() loop.
from hx711_adc.
Building a dual weight with individual HX711 sensors, but need a function for re-calibrating bouth sensors individually within a sketch.
When using the Calibration Sketch, I can get the raw number using getData(), but are not able to retreive this inside a sketch. Then I only get the calibrated number.. Tried getTareOffset(), but it's not the same as what I get using getData() in the calibration sketch.
How can I easily re-calibrate HX711 (not just setting a new setCalFactor()) using two individual sensors within the Read_2x_load_cell.ino sketch?
from hx711_adc.
@msevland please don't post new and unrelated issues within existing threads! I have re-posted your question under #37
from hx711_adc.
Related Issues (20)
- Test.ino issue HOT 3
- Load_cell output val: NAN HOT 6
- ESP32 Wroom Pin For CLK HOT 2
- Question on Smoothing HOT 2
- Have problem with starting the code. HOT 2
- Slow data readings HOT 4
- UNITTTTTTTT!!!!!!!!!!!!! HOT 4
- Some error While test HOT 2
- No real issue - pls provide an example on how to use New funtions from v1.2.12 HOT 4
- Read_2x_load_cell example not working - potential issue with calling .begin() on multiple HX711_ADC objects HOT 2
- help wanted: How to set Sampling rate from ESP32 HOT 8
- Understanding Multi Point Calibration HOT 2
- Question about HX711_ADC::start functions HOT 1
- Strange Observation HOT 4
- DOUT and SCK PIN declarations HOT 1
- tare at startup HOT 6
- How , do I set calibration factor for 2 different channels HOT 4
- Compatibility issue with ESP32-S3 Dev Board HOT 3
- Hi, did the mass value needed for the calibration its unit is gram or something else? HOT 1
- How to read the value in setup method HOT 4
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_adc.