0

I am using the HX711 with a load cell attached on my Wemos D1. I have the connections correctly as if I use the same setup on my Arduino Uno board and the same code it runs fine and prints to the serial log. If I comment out the HX711 scale(DOUT, CLK); in my code the serial print is fine. I am not sure if this is an issue with the board or something I am doing with it. I would use the Arduino Uno but it does not have Wifi whereas my Wemos board does. Attached is a screenshot of the serial print from the monitor.

enter image description here

#include "HX711.h"

#define DOUT  3
#define CLK  2



HX711 scale(DOUT, CLK);

float calibration_factor = -117441.00; //-7050 worked for my 440lb max scale setup

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: ");
  Serial.print(scale.get_units(), 1);
  Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.