Weight scale without the tare

Hi all,
I created a weight scale using 4 load cells and one HX711. Basically I followed these tutorial: I calibrated the weight scale, and I also tried the example: Load Cell Amplifier HX711 Breakout Hookup Guide - SparkFun Learn

This example requires you to avoid having weights on the scale when the sketch will start because here there is the scale.tare().
I need to use the scale in a different way: I can't remove the weight when the sketch starts.
Basically, I need to retrieve the value, send it, and after that the Arduino will be switched off. Again, when the Arduino will be switched on, I'll need to take the weight value without removing what I have on the scale.
Basically I need to avoid to tare the scale.
How can I do this?
Obviously, I tried removing the tare line code but this doesn't work.

You can't avoid taring at all. But you can to tare scale once, write the tare value to EEPROM and read it when the sketch starts

To read the tare to write to EEPROM or to read the EEPROM and set the tare you need to use these two functions:

From your link, if you don't want to use EEPROM, you could use the calibration code, but also print out and record the offset value and use the production code.

What is calibration code?

The calibration sketch from:

/*
 Example using the SparkFun HX711 breakout board with a scale
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 19th, 2014
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 This is the calibration sketch. Use it to determine the calibration_factor that the main example uses. It also
 outputs the zero_factor useful for projects that have a permanent mass on the scale in between power cycles.

 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
 Use this calibration_factor on the example sketch

 This example assumes pounds (lbs). If you prefer kilograms, change the Serial.print(" lbs"); line to kg. The
 calibration factor will be significantly different but it will be linearly related to lbs (1 lbs = 0.453592 kg).

 Your calibration factor may be very positive or very negative. It all depends on the setup of your scale system
 and the direction the sensors deflect from zero state
 This example code uses bogde's excellent library: https://github.com/bogde/HX711
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE
 Arduino pin 2 -> HX711 CLK
 3 -> DOUT
 5V -> VCC
 GND -> GND

 Most any pin on the Arduino Uno will be compatible with DOUT/CLK.

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#include "HX711.h"

#define DOUT  3
#define CLK  2

HX711 scale;

float calibration_factor = -7050; //-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.begin(DOUT, CLK);
  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;
  }
}

ooh :slight_smile: clear
For some reason, I thought that you were suggesting using some kind of secret key-code that you enter - and that's it! scale is tared :slight_smile:

I'll try this approach…but, regarding the EEPROM, I'm not an expert, but, if I'm not wrong, there is the limitation about the maximum number of writes (around 100k) ..assuming that I’ll do one write every 10 minutes... Is this a negible thing?

I would assume that you aren't going to re-tare every 10 minutes. Maybe once per installation? Once per manual update-tare-button-push? And the every 10 minute power-on would normally be merely reading the tare from EEPROM?

Also, the the EEPROM.put() routine only writes if there is a difference, so if the tare data isn't actually changing it doesn't actually do the write.