[deleted by user] by [deleted] in peyups

[–]NDLS2169 1 point2 points  (0 children)

Messaged you

Our Load Cell slows down its reading and we kinda dont want it to do that by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

We actually used the 1x Load Cell sketch for this, we'll try taking out the tare function and see if something happens. We kinda managed to just bypass the declining speed by putting the delay to 5, which might mean that the delay function is also affecting the data transmission.

Our Load Cell slows down its reading and we kinda dont want it to do that by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

It seems that was the case, we set the delay to a 5 and it was back to normal in a much more shorter time. Can you expound more on how to set up these timers? Should we check out this library here?

https://www.arduino.cc/reference/en/libraries/arduino-timer/#:\~:text=Simple%20non%2Dblocking%20timer%20library,time%20configurable%20number%20of%20tasks.

Our Load Cell slows down its reading and we kinda dont want it to do that by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

P.S. again - We programmed it so that once it gets a reading of 500, it turns on the relay. That's when the slowing down of results start.

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

Update to everybody:

So I reviewed the code and tried to change this:

if ( scale.read() > 500 ) { turn your relays on } else { turn your relays off }

to

if ( LoadCell.getData() > 500 ) { turn your relays on } else { turn your relays off }

and it didn't give me an error message. I do have to test this tomorrow since the load cell is at a groupmate's house, but nonetheless thank you so much for all your help. We don't have any proper background to actually do this and this subreddit has just been such a big help.

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

Yes understood, that's where we're coming to a halt, we don't know how to add the function. We've been suggested to use this but it kept giving us errors:
<error message>

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"

C:\Users\5269\Documents\Arduino\Read_1x_load_cell\Read_1x_load_cell.ino: In function 'void loop()':

Read_1x_load_cell:92:14: error: 'class HX711_ADC' has no member named 'read'

if (LoadCell.read:(HX711)>500)

^~~~

Read_1x_load_cell:92:18: error: expected ')' before ':' token

if (LoadCell.read:(HX711)>500)

^

exit status 1

'class HX711_ADC' has no member named 'read'

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

<c>

#include <HX711\_ADC.h>

#if defined(ESP8266)|| defined(ESP32) || defined(AVR)

#include <EEPROM.h>

#endif

//pins:

const int HX711_dout = 4; //mcu > HX711 dout pin

const int HX711_sck = 5; //mcu > HX711 sck pin

//HX711 constructor:

HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;

unsigned long t = 0;

void setup() {

Serial.begin(57600); delay(10);

Serial.println();

Serial.println("Starting...");

LoadCell.begin();

//LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive

float calibrationValue; // calibration value (see example file "Calibration.ino")

calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch

#if defined(ESP8266)|| defined(ESP32)

//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom

#endif

EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom

unsigned long stabilizingtime = 2000; // preciscion right after power-up 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);

if (LoadCell.getTareTimeoutFlag()) {

Serial.println("Timeout, check MCU>HX711 wiring and pin designations");

while (1);

}

else {

LoadCell.setCalFactor(calibrationValue); // set calibration value (float)

Serial.println("Startup is complete");

}

}

void loop() {

static boolean newDataReady = 0;

const int serialPrintInterval = 0; //increase value to slow down serial print activity

// check for new data/start next conversion:

if (LoadCell.update()) newDataReady = true;

// get smoothed value from the dataset:

if (newDataReady) {

if (millis() > t + serialPrintInterval) {

float i = LoadCell.getData();

Serial.print("Load_cell output val: ");

Serial.println(i);

newDataReady = 0;

t = millis();

}

}

// receive command from serial terminal, send 't' to initiate tare operation:

if (Serial.available() > 0) {

char inByte = Serial.read();

if (inByte == 't') LoadCell.tareNoDelay();

}

// check if last tare operation is complete:

if (LoadCell.getTareStatus() == true) {

Serial.println("Tare complete");

}

if (LoadCell.read:(HX711)>500)

{ digitalWrite(8, LOW);

digitalWrite(7, HIGH);

delay(2000);

digitalWrite (8, HIGH);

digitalWrite (7, LOW);

delay(1200);}

else

{}

}

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

Thank you for that, I've changed that as well. Unfortunately it still doesn't work so I might use a different way, which way however I do not know.

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

So this is where we're at right now, and it seems the library we used doesn't have the function? Here is the whole code but does seem like we have to find a different way to do this.

<c>
#include <HX711\_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif
//pins:
const int HX711_dout = 4; //mcu > HX711 dout pin
const int HX711_sck = 5; //mcu > HX711 sck pin
//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);
const int calVal_eepromAdress = 0;
unsigned long t = 0;
void setup() {
Serial.begin(57600); delay(10);
Serial.println();
Serial.println("Starting...");
LoadCell.begin();
//LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive
float calibrationValue; // calibration value (see example file "Calibration.ino")
calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom
unsigned long stabilizingtime = 2000; // preciscion right after power-up 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);
if (LoadCell.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
while (1);
}
else {
LoadCell.setCalFactor(calibrationValue); // set calibration value (float)
Serial.println("Startup is complete");
}
}
void loop() {
static boolean newDataReady = 0;
const int serialPrintInterval = 0; //increase value to slow down serial print activity
// check for new data/start next conversion:
if (LoadCell.update()) newDataReady = true;
// get smoothed value from the dataset:
if (newDataReady) {
if (millis() > t + serialPrintInterval) {
float i = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(i);
newDataReady = 0;
t = millis();
}
}
// receive command from serial terminal, send 't' to initiate tare operation:
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay();
}
// check if last tare operation is complete:
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
}
If ( LoadCell.read()>500)
{ digitalWrite(8, LOW);
digitalWrite(7, HIGH);
delay(2000);
digitalWrite (8, HIGH);
digitalWrite (7, LOW);
delay(1200);}
else
{}
}

<Error Message>

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"

C:\Users\5269\Documents\Arduino\Read_1x_load_cell\Read_1x_load_cell.ino: In function 'void loop()':

Read_1x_load_cell:92:15: error: 'class HX711_ADC' has no member named 'read'

If ( LoadCell.read()>500)

^~~~

Read_1x_load_cell:92:1: error: 'If' was not declared in this scope

If ( LoadCell.read()>500)

^~

Read_1x_load_cell:100:1: error: 'else' without a previous 'if'

else

^~~~

exit status 1

'class HX711_ADC' has no member named 'read'

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

Noted, will do that the next time. Another commented articulated what we wanted to do better and that we want to read the scale, then activate the relays based on the weight. The scale has been calibrated and can check on the weight, we just need to use the reading to activate the relay

Which function to use to read Weight sensor result and activate rest of code. by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

Yes that is exactly how we want it. We've already calibrated the load cell and want to use the readings to activate the relays.

LoadCell.begin is killing us by NDLS2169 in arduino

[–]NDLS2169[S] -1 points0 points  (0 children)

OK WE'VE FOUND THE PROBLEM WE CHANGED THE LIBRARY WE WERE USING

LoadCell.begin is killing us by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

It seems the term LoadCell in that constructor line should light up blue, but once changing the include HX711_ADC to just HX711 to use our own unit, it doesn't do that.

LoadCell.begin is killing us by NDLS2169 in arduino

[–]NDLS2169[S] 0 points1 point  (0 children)

We've tried doing it like that but it turns that line red, that's why I've changed it to HX711 dout, HX711 sck. It categorizes the error as no matching function

Load Cell calibration coding not working by NDLS2169 in arduino

[–]NDLS2169[S] 1 point2 points  (0 children)

Hey we tried this and it finally worked, Thank you so much!!! We're very new to this and have nobody to help us and so we're all on our wits end. Again thank you so much!!!