Go Down

Topic: Arduino based uroflowmeter (Read 774 times) previous topic - next topic

wvmarle

I'm quite sure the error is in the part you didn't post. Such as your current sketch.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Poetschevleesch

Here is the sketch

#include "HX711.h"

// HX711.DOUT   - pin #5
// HX711.PD_SCK   - pin #6

HX711 scale(5,6);      // parameter "gain" is ommited; the default value 128 is used by the library

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 Demo");

  scale.set_scale(-350);// this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();
 
}

void loop() {
 
  float v1=5;
  Serial.println(v1);
  delay(1000);
 

wildbill

No surprise there. You've apparently dropped the most important part:
Code: [Select]

float v1= scale.get_units();

Poetschevleesch

OK ! Great !
Here is the solution :

#include "HX711.h"

// HX711.DOUT   - pin #5
// HX711.PD_SCK   - pin #6

HX711 scale(5,6);      // parameter "gain" is ommited; the default value 128 is used by the library

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 Demo");

  scale.set_scale(-350);// this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();
 
}

void loop() {
 
  float v1= scale.get_units(5);
  delay(1000);
  float v2= scale.get_units(5);
    Serial.println(v2-v1);
  delay(1000);
 
 
}

Poetschevleesch

Now , I want to program the fact that the measure has to begin as soon as the weight is increasing and has to stop when it remains stable during 10 seconds.
And, to print and calculate the total weight in the end of the measure
And calculate the average rate and print it
And display the maximum rate and print it.

Do yo think it is possible ?

wvmarle

Definitely possible.

The hardest part is going to be the "stable" time. It will never be stable: the values will continuously change. Noise in the line, air flow, vibrations from a truck driving by your building, etc. You have to decide how much change is allowed when it's "stable".
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up