• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Układ z tensometrami i HX711
#3
Próbuję uruchamiać różne kody do kalibracji, jednak z tego co widzę problem jest stały. Zamieszczam kod, nad którym najczęściej siedzę, jest to kod ściągnięty z opracowania z internetu, jednak większość używając modułu HX711 korzysta z gotowej belki tensometrycznej.

Kod:
/*
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 5 -> HX711 CLK
Arduino pin 6 -> HX711 DOUT
Arduino pin 5V -> HX711 VCC
Arduino pin GND -> HX711 GND
*/

#include "HX711.h"

HX711 scale(A2, A3);

float calibration_factor = -375; // this calibration factor is adjusted according to my load cell
float units;
float ounces;

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press + or a to increase calibration factor");
  Serial.println("Press - or z to decrease calibration factor");

  scale.set_scale();
  scale.tare();  //Reset the scale to 0

  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);
}

void loop() {

  scale.set_scale(calibration_factor); //Adjust to this calibration factor

  Serial.print("Reading: ");
  units = scale.get_units(), 10;
  if (units < 0)
  {
    units = 0.00;
  }
  ounces = units * 0.035274;
  Serial.print(units);
  Serial.print(" grams");
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == '+' || temp == 'a')
      calibration_factor += 1;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 1;
  }
}
 
Odpowiedź
  


Wiadomości w tym wątku
Układ z tensometrami i HX711 - przez Zebedeusz - 21-06-2019, 21:39
RE: Układ z tensometrami i HX711 - przez kaczakat - 21-06-2019, 21:49
RE: Układ z tensometrami i HX711 - przez Zebedeusz - 21-06-2019, 21:53
RE: Układ z tensometrami i HX711 - przez Zebedeusz - 22-06-2019, 11:16
RE: Układ z tensometrami i HX711 - przez es2 - 23-06-2019, 08:11
RE: Układ z tensometrami i HX711 - przez kaczakat - 23-06-2019, 16:26
RE: Układ z tensometrami i HX711 - przez Zebedeusz - 24-06-2019, 22:37

Skocz do:


Przeglądający: 1 gości