Giter VIP home page Giter VIP logo

hx711_adc's Introduction

Latest release and change log here: https://github.com/olkal/HX711_ADC/releases

This an Arduino library for the HX711 24-bit ADC for weight scales. Data retrieval from the HX711 is done without blocking the mcu, also on the 10SPS rate setting and with Multiple HX711's performing conversions simultaneously. Tare function can also be performed without blocking the mcu.

Filtering and smoothing: "Moving average" method from a rolling data set combined with removal of high/low outliers is used for the retrieved value.

Selectable values in the config.h file:

  • Moving average data set of 1, 2, 4, 8, 16, 32, 64 or 128 samples (default:16).
  • Ignore high outlier; one sample is added to the data set, the peak high value of all samples in the data set is ignored (default:1)
  • Ignore low outlier; one sample is added to the data set, the peak low value of all samples in the data set is ignored (default:1)
  • Enable delay for writing to sck pin. This could be required for faster mcu's like the ESP32 (default: no delay)
  • Disable interrupts when sck pin is high. This could be required to avoid "power down mode" if you have some other time consuming (>60µs) interrupt routines running (default: interrupts enabled)

Caution: using a high number of samples will smooth the output value nicely but will also increase settling time and start-up/tare time (but not response time). It will also eat some memory.

Important: The HX711 sample rate can be set to 10SPS or 80SPS (samples per second) by pulling pin 15 high (80SPS) or low (10SPS), ref HX711 data sheet. On fabricated HX711 modules there is usually a solder jumper on the PCB for pin 15 high/low. The rate setting can be checked by measuring the voltage on pin 15. ADC noise is worst on the 80SPS rate. Unless very quick settling time is required, 10SPS should be the best sample rate for most applications.

Start up and tare: from start-up/reset, the tare function seems to be more accurate if called after a "pre-warm-up" period running conversions continuously for a few seconds. See example files.

Hardware and ADC noise: Wires between HX711 and load cell should be twisted and kept as short as possible. Most available HX711 modules seems to follow the reference design, but be aware that some modules are poorly designed with under-sized capacitors, and noisy readings. The Sparkfun module seems to differ from most other available modules as it has some additional components for noise reduction.

To get started: Install the library from Arduino Library Manager. Begin with the Calibration.ino example file, then move on to the Read_1x_load_cell.ino example file.

If you need to keep the tare/zero-offset value after a device reboot, please see example Persistent_zero_offset.ino example file.

HX711_ADC Library Documentation

Initialization:
 begin(): Initializes the communication with the HX711 and sets the gain to 128 (default).
 begin(uint8_t gain): Initializes the communication with the HX711 and sets the gain (32, 64, or 128).
 Tare (Zero Point Calibration):
 tare(): Performs tare operation (blocking, waits until finished).
 tareNoDelay(): Initiates tare operation (non-blocking, continues in background).
 getTareStatus(): Returns true if the tare operation is complete.

Data Acquisition:
 update(): Reads a new weight sample (blocking, waits for conversion).
 dataWaitingAsync(): Checks if new weight data is available (non-blocking).
 updateAsync(): Reads new weight data if available (non-blocking, called after dataWaitingAsync).
 getData(): Returns the latest weight value (after applying calibration and filtering).

Calibration:
 setCalFactor(float cal): Sets the calibration factor for weight conversion (weight = raw data / calFactor).
 getCalFactor(): Returns the current calibration factor.
 getNewCalibration(float known_mass): Calculates and sets a new calibration factor based on a known mass.

Other Functions:
 setSamplesInUse(int samples): Sets the number of samples used for averaging and filtering (rounded down).
 getSamplesInUse(): Returns the current number of samples in use.
 resetSamplesIndex(): Resets the index for the dataset.
 refreshDataSet(): Refreshes the entire dataset with new conversions (blocking).
 getDataSetStatus(): Checks if the dataset is filled with conversions.
 getSignalTimeoutFlag(): Indicates if the HX711 communication timed out.
 setReverseOutput(): Reverses the output value (positive/negative).
 getTareOffset(): Gets the current tare offset (raw data value).
 setTareOffset(long newoffset): Sets a new tare offset (raw data value).
 powerUp(): Powers up the HX711 chip.
 powerDown(): Powers down the HX711 chip.
 getReadIndex(): Returns the current dataset read index (debugging).
 getConversionTime(): Returns the latest conversion time in milliseconds (debugging).
 getSPS(): Estimates the HX711 conversions per second (debugging).
 getTareTimeoutFlag(): Returns the tare operation timeout flag (debugging).
 disableTareTimeout(): Disables the tare operation timeout.
 getSettlingTime(): Calculates the estimated settling time based on conversion time and sample count (debugging).

hx711_adc's People

Contributors

darkb0ts avatar jodaille avatar malcolmboura avatar medlor avatar olkal avatar per1234 avatar xoration avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hx711_adc's Issues

mutli load cells on single CLK pin

Hello
Thank you for sharing your code.
One of your examples have 2 load cell, but they use different CLK pin
Any chance there might be possible to hook up multi HX711 boards that share the same CLK pin?

How to disable moving average

Hi,
Is there any way to disable the smoothing ?
I need no settling time and also the 80 sps for my project because it is in real time and the measurement increases very quickly.

Regards,
Yves

Can we disable tare?

I have a simple code to setup and read the data from the load cell. However when I start the scale with load on it, it starts at 0 rather than the initial weight of the object on it.
Is there a way to disable the tare() so it gets the actual weight on the loadcell even at the start point?

Code I have:

HX711_ADC LoadCell(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
void setup() {
  LoadCell.begin(); // start connection to HX711
  LoadCell.start(2000); // load cells gets 2000ms of time to stabilize
  LoadCell.setCalFactor(200.0); // calibration factor for load cell
}
void loop(){
  LoadCell.update(); // retrieves data from the load cell
  long reading = LoadCell.getData(); // get output value
  Serial.print("HX711 reading: ");
  Serial.println(reading);
}

function for re-calibrating within a sketch

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?

Originally posted by @msevland in #33 (comment)

Feature request: setTareOffset()

Hi! First of all, thanks for this wonderful library! I have a question: there is getTareOffset() but no setTareOffset(): that would remove the need to tare the scale which is useful for permanent scale projects. Will you add such a function in the future? Best regards, jpk73

Struggling to get 80 sps

Hi Olav,

Is the HX711 really able to provide 80 sps ?
I soldered the two pins on the back of the board together.
I wrote a code with an interrupt on the DOUT pin and another code using micros() function.
I get the same value several times so it creates a curve with aliasing.
I also tried the code you wrote in the issue #25.
I get a curve without aliasing but with much less SPS.

Regards,
Yves

data smooth index check needs to be fixed

currently when doing an update(), the code writing to the data smooth index handling looks to see if it is buffer size - 1 and then sets it to 0. Unfortunately, if you create this with new, or you are putting it into stack memory that has already been used, the index initially can be outside the range 0 - buffersize -1.

To fix this the safest thing would be before it writes to the buffer, the index should be checked to ensure it is >= 0 and < buffer size and if it is outside that range, set to 0,.

An alternative would be to initialize the index to 0 on construction, but this does leave the possibility of some other bug setting it out of range and the update() continuing to overwrite memory it doesn't own.

Getting Load_cell output val: nan

image
I am using a HX711 amplifier for my load cell..After calibration I am getting value as nan...what does that mean? I am pretty sure that my connections are correct.
Thanks in advance

Change number of samples on smooth average

First of all, congratulations for the library. This was the only one I used that managed to get data from multiple HX711 without any problem.

My question: is there a way to change the number of samples used for the smooth average without changing the library (HX711_ADC.h) itself? As far as I noticed there isn't any function to change this variable.

If there isn't indeed, would you accept it as a Pull Request?

more speed to find the right weight

hello guys.

have anny change can i do to make the program more fast to find my weight? actually he takes 2 seconds to give me my right weight but for my aplication i need that a little bit more fast.

i tried some alterations on smoothData and not work (in hexadecimal values).

thanks for you time.
Allan Johnson

Multiply faster than divide

In general multiplication is faster than division. The Atmega 328 (and I assume 168) has hardware multiply but not hardware division so multiply is very much faster. I suggest changing calFactor to a multiplier internally.

calFactorRecip = 1 / calFactor;

and then multiply raw values by calFactorRecip.

I may be able to get a pull request done with proposed changes but I don't know when so I will raise this as an issue.

Issue with reading data from load cell

Hi,

Board - Arduino uno
IDE - Arduino 1.8.1
Code - HX711_ADC/examples/Calibrate/Calibrate.ino
ADC + Amplifier - HX711 Breakout board (Green color)
Sensor - 1Kg load cell
Vcc - 3.3
Gnd - Gnd pin
data - pin 3
clock -pin 4

I am trying to read data from load cell.I only get the output as 0 sometimes -0.00 even if i put some load on the load cell.

output -
Wait...
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: 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

some one please help me?

Thank you

Units of measurement

Hi,
I haven't found any units for measurement ? Have I overlooked it or units aren't written anywhere ?

Cheers

Endless loop, if no HX711 is connected

I use the code on my ESP8266 and the tare command doesn't finish, if no Hardware is connected. This results in unwanted watchdog-Resets.
For me the hardware should be optional and recurrent reset is not an option.

My changes:

void HX711_ADC::tare()
{
uint8_t rdy = 0;
doTare = 1;
tareTimes = 0;
int okcounter = 200;
while(rdy != 2) {
rdy = update();
if (okcounter-- == 0){
// Prevents from endless loop and watchdog-firing, if no HX711 is connected
break;
}
}
}

Using the library with Arduino MKR 1010 Wifi

Hello,

I'm truing to use the library with an Arduino MKR1010 Wifi, however the MKR boards don't have EEPROM. I was wondering if there's any advice on how to get this done.

Thanks!

How to get tare?

This code work perfect, calibrating i so easy.

After I calibrated the calFactor using examples/Calibration.ino, its save to eeproom.

And i just run another examples and get calFactor from eeprom.
It's work perfectly.

But, when I restart the serial monitor with mass at the load cell, the value is reset to 0. And value become negative when taking out mass from the loadcell.

How to start the code if we have mass at the loadcell without reset the value?

Thank you

sorry, i m not using english

Drift Issue using 50 MT x 4 LoadCell (200 MT)

Hi,
I have big LoadCell with total 200 MT.
Using this library on 5KG and 10 KG has no issue,
But when connected to 200MT LoadCell,
Reads of get data is unstable and fluctuated.

Do you have any idea to resolve this problem?

Thank you

Issue with tare timeout in startMultiple()

Hi,

I've found an issue in the startMultiple() function(s) of your library. At the beginning of the function (lines 86 and 135), the timeout for the tare completion is initialized as:

static unsigned long timeout = millis() + tareTimeOut;

This makes the timeout variable to be set the first time the startMultiple() function is executed. So, it assumes the tare completion has to occur tareTimeOut milliseconds after that first execution. Nevertheless, since the function executes some conversions (update()) continuously during the stabilization time, before the tare is triggered (doTare is set), it is possible (and frequent) that the timeout has already completed even before triggering the tare. This causes the tareTimeoutFlag to be set in situations it shouldn't.

To solve the issue, I think moving the timeout initialization line (as is, keeping the "static") just before doTare = 1 (lines 106 and 157) should suffice.

P.S. I'm too lazy right now to make a pull request.

Add license

Hi,
could you add license such as MIT or LGPL so other can use your library ?

Cheers

Some warnings from the compiler

Hello @olkal,

first of all: great library!

When compiling your example sketches I get several warnings. You can easily improve the code:

  • all variables which are related with millis(), e.g. t, startMultipleTimeStamp, startMultipleWaitTime should be defined as unsigned long
  • variable t should be initialized with a value, e.g. t =0;
  • there are few unused variables in your code

See all warnings below.

Best wishes, Wolfgang

C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\examples\Read_1x_load_cell\Read_1x_load_cell.ino: In function 'void loop()':
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\examples\Read_1x_load_cell\Read_1x_load_cell.ino:69:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (millis() > t + serialPrintInterval) {
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\examples\Read_1x_load_cell\Read_1x_load_cell.ino:80:11: warning: unused variable 'i' [-Wunused-variable]
float i;
^
In file included from C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\examples\Read_1x_load_cell\Read_1x_load_cell.ino:22:0:
C:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\libraries\EEPROM\src/EEPROM.h: At global scope:
C:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\libraries\EEPROM\src/EEPROM.h:145:20: warning: 'EEPROM' defined but not used [-Wunused-variable]
static EEPROMClass EEPROM;
^~~~~~
Compiling libraries...
Compiling library "HX711_ADC"
"C:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\cores\arduino" "-IC:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\variants\standard" "-IC:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src" "-IC:\Users\Ewald\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\libraries\EEPROM\src" "C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp" -o "C:\Users\Ewald\AppData\Local\Temp\arduino_build_388271\libraries\HX711_ADC\HX711_ADC.cpp.o"
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp: In member function 'int HX711_ADC::startMultiple(unsigned int)':
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp:99:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(millis() - startMultipleTimeStamp > startMultipleWaitTime) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp: In member function 'int HX711_ADC::startMultiple(unsigned int, bool)':
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp:148:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(millis() - startMultipleTimeStamp > startMultipleWaitTime) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp: In member function 'void HX711_ADC::setSamplesInUse(int)':
C:\Users\Ewald\Documents\Arduino\libraries\HX711_ADC\src\HX711_ADC.cpp:425:6: warning: unused variable 'old_divbit' [-Wunused-variable]
int old_divbit = divBit;
^~~~~~~~~~

possible hang up in tare function

In function HX711_ADC::tare() , there is a while (rdy !=2) {...

This while loop can cause an endless loop if no valid conversions are received (e.g. due to a hardware issue). I propose to add a timeout to the function:

void HX711_ADC::tare()
{
uint8_t rdy = 0;
uint8_t timeout = 255;
doTare = 1;
tareTimes = 0;
while(rdy != 2) {
rdy = update();
if (timeout == 0) {
Serial.println("Tare timed out");
break;
}
timeout++;
}
}

Load cell reading issue?

When i put the calibration code in for the load cell, I get the output of zeros over and over again and when I press the load cell it doesn't read it. Sometimes though when I'm not touching it at all it jumps to high number like 3000. Help

Scale without tare

Hi,
I'm building a scale, with load cells, HX711 as a signal amplifier and Esp 32 as a microcontroller.
I chose Esp 32 because with sleep mode I can save much energy and therefore feed the system with a photovoltaic panel and a small lead-acid battery (the scale is in a remote site).
The problem I would like to solve concerns the tare of the scale: I have to use the system continuously "sleeping down" (and "wakeing up") the controller every hour ... As you can imagine the system performs the tare at each wakeup so that already at the second weighing the object to be weighed is included in the tare and the weight shown on the display is zero.
Has anyone found themselves having to solve a similar problem?
Thank you for the answer...

weird output

18:56:24.402 -> ⸮⸮⸮⸮⸮⸮j⸮⸮�#⸮⸮ĥ1⸮⸮�⸮DaA⸮
18:56:28.321 -> c⸮�⸮!��PŲ

hello, I am getting the above output when I run the calibration file with a single load cell and using arduino uno, please can you tell me why is the output so weird?

SCK_DELAY 1 necessary for ESP32

more a FYI.
It seems that ESP32 needs the 1s sck_delay. Maybe you could add this to Readme

Previously i used Version 1.0.2 or 1.1.0 and updated now to 1.1.6 . With the new Version and no delay the values went like this: From 0 to around 50 fine , and after that than suddenly jumped to around -33500 and stayed there in the 5 digits, slightly decreasing with increasing force.

With the delay everything seems to be back to normal.

Overflow of data when there is a small offset at the beginning

I dont know if this is the expexted behavior but i got a lot of issued because of this.

When you connect a weight cell to the hx711 without a load. We get a value close to zero out of conversion24bit()
If you now pull on the weightcell, the data overflows and we get a value close to 2^24.

The problem is, that some weightcells and or HX711 Chips have an offset at the beginning...
This means when you have no load on the weightcell than we get a value close to 2^24 out of conversion24bit().
When you now start to put a weight on the weightcell then the data out of conversion24bit() overflows and it jumps close to zero.
This means you meassure a huge negative value and you cant really meassure anymore...

My Solution:
By inverting the MSB we can shift the data we get out of conversion24bit() to the middle of the range.
This results in a decrease in number when we pull on the weightcell and an increase when we put a weight on it. An offset at the beginning has no effect anymore because there is no overflow near to zero/no weight.

I added this line to conversion24bit() which fixes the problem for me...
data = data ^ 0b10000000000000000000000; //Invert MSB

Here i try to visualize it... xD
Before the "fix"

 0
|-------------------------|

After the fix

             0
|-------------------------|

0 Is the position with no weight on the loadcell and |--| the range of the 24 bit.

Erroneous data after setSamplesInUse()

When doing

LoadCell.begin();
long stabilizingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
LoadCell.start(stabilizingtime, _tare);
LoadCell.setCalFactor(calibrationValue); // user set calibration value (float)
LoadCell.setSamplesInUse(1)
if (LoadCell.update()) newDataReady = true;
//get smoothed value from data set
if (newDataReady) {
  float a = LoadCell.getData();
}

I get wrong data. Shouldn't

long lastSmoothedData;

be initialized to 0?

Loadcell to be global, but assign Pins later on.

Is there a way to construct the HX711_ADC object without assingning pins right away? For my program it is needed to ask for the pins of the HX711 in a dialog and then construct the HX711. All while Loadcell beeing a global object. Like this:


`HX711_ADC Loadcell();

void setup(){
dialog(); //user sets pin1 and pin2 through serial dialog
HX711_ADC Loadcell(pin1, pin2);
}`


Thanks for anyone who can help!

Can't read data when using external crystal

I am trying to use a 20mhz external oscillator with hx711 and according to its datasheet it is in spec.
When using 20mhz crystal, Reading data doesn't work and it only shows 0 and some high number when a force is applied.

I can read data with a quick test sketch I've made (didn't use the library) to check if all is working, so connections are right and oscillator is working.

Inconsistent return types for start() and conversion24bit()

The return type for HX711_ADC::start() is int, though it does not return anything.
The return type for HX711_ADC::conversion24bit() is uint8_t, though it also returns nothing.

It does compile fins with these errors in Arduino IDE, but I am getting errors in Sloeber. I have fixed them by modifying the source code, I suggest this is done here as well.

getSingleConversionRaw() not working

Hi! I am successfully using your lib with an ADS1231, but I can't get getSingleConversionRaw() to work, it seems it is missing in the cpp file...? Regards and Thanks!!!

how does using 80Hz change the code?

Hi,

Before anything thanks for creating this library! it's really helpful, i've been using it in a personal project and it uses 4 LC's (each with it's owns HX711) and i'm using 80Hz as i need the faster response.

I was wondering what changes in the code, if anything, when using 80 Hz, since i've been testing the examples 'read1x' and 'read2x' and i didn't notice a big difference between using 80Hz or 10Hz.

Thank you very much!

Flushing data after mcu performs a blocking task

First of all, thanks for this awesome library!

I'm not sure if this is the case, but it feels like if I perform some task in loop() that takes some time to finish (but only needs to be done once in a while), LoadCell.getData(); takes some time to flush out data recorded in the past, and only after some time does it go back to fresh / current weight reading. I want to first confirm that this is indeed the case - since I could be imagining things I guess... But if this is the case, is there a way to clear the "stale" data so that LoadCell.getData(); starts reporting more "real-time" data even after a blocking task on mcu?

Thanks!

Linear drift in readings

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.

Originally posted by @aaromalila in #33 (comment)

Works with esp8266?

Hello,
is this supposed to work with the ESP8266 module?

Get only errors and the module restart and restart

`⸮Wait...

Soft WDT reset

ctx: cont
sp: 3ffef220 end: 3ffef430 offset: 01b0

stack>>>
3ffef3d0: 3ffe84a0 00000000 3ffee3e4 40202139
3ffef3e0: 3ffe8425 feefeffe 3ffee2ac 40201ea6
3ffef3f0: feefeffe feefeffe 3ffee2ac 40201ed3
3ffef400: 3fffdad0 3ffee2ac 3ffee3e4 40201c2b
3ffef410: feefeffe 00000000 3ffee400 402025f4
3ffef420: feefeffe feefeffe 3ffee410 40100114
<<<stack<<<
⸮⸮b !⸮⸮d
Wait...
`

Reset weight value to zero

hi, i have an issue with my sketch.
when i'm measuring an item and i remove it, the weight value not return to 0 . i would like to know if it is possible to recall a void or a function that reset the weight value or return to tare value propertly, so i can assign this function to a phisic button.
like the tare button on a kitchen scale for example.

thanks for now...waiting news. regards

Start up without tare

I love this library, thank you for creating it. It worked well first time. My application will be to have an esp-01 on deep sleep and to wake up once per day to take a reading. If I start the the sample code with a mass on the sensor, then it tares it as zero and removing it takes the value negative. Is it possible to start the loadcell without a tare, using my setCalFactor to calibrate the gauge and give me the actual mass on the sensor at start up? I guess I'm asking if tare can be disabled on initiating the sensor?

Thanks

read data step by step (slowly change)

When I read the value, the resonse data increase or decrease slowly in step of aroud 3~4 g and finally stablize in the item weight. Is that possible to get the data immediately or much faster? I use the Ardiuno UNO board for testing. Code as below.

#include <HX711_ADC.h>
#include <LiquidCrystal.h>

float Weight = 0;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell(10, 13);

void setup() {
Serial.begin(9600);
lcd.begin(16, 2);

lcd.print("Welcome!");
LoadCell.begin();
long stabilisingtime = 100; // tare preciscion can be improved by adding a few seconds of stabilising time
LoadCell.start(stabilisingtime);
LoadCell.setCalFactor(696.0); // user set calibration factor (float)
delay(3000);
}

void loop() {
lcd.clear();
LoadCell.update();
Weight = LoadCell.getData();
lcd.print("Weight = ");
lcd.print(Weight); //the true weight
lcd.print(" g");

delay(1000);
}

Implement in a new sketch

Hi I am a beginner in Arduino. I wanted to use the HX711_ADC library in my sketch. I want to set the calibration factor myself. My sketch is meant for issuing an abort signal to a process when the mass measured by load cell crosses a certain value.

  1. Can u pls tell me which all functions are to be used from the library
  2. Without the serial communication is it possible to provide calibration factor by the user as part of sketch, so that every time the Arduino restarts, we dont need to provide calibration factor. Is there any zero offset value included like as in y = mx + c If so, how to set the zero offset value.

Pardon my questions as I am only a beginner.

Clock wrap not catered for and other issues from a code read through

In HX711_ADC::startMultiple(unsigned int t) appears the line

if(millis() < startMultipleTimeStamp + startMultipleWaitTime)

which will fail to work as expected if startMultipleTimeStamp + startMultipleWaitTime wraps around the clock. The fix is to work with durations instead of times.

if ( millis() - startMultipleTimeStamp > startMultipleWaitTime)

See https://www.norwegiancreations.com/2018/10/arduino-tutorial-avoiding-the-overflow-issue-when-using-millis-and-micros/
I will create a PR but it may be a few days before I can do that.

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.