Arduino Load Cell / Scale

343,693

131

156

Posted in TechnologyArduino

Introduction: Arduino Load Cell / Scale

About: Professionally, I'm an IT Engineer (Executive Level) and Electronics Tech. I'm a Amateur Radio Operator (KK4HFJ). I lived off grid, with Solar (PV), Wind, and veggie oil fueled diesel generator power for 6 y...

From the minds at http://arduinotronics.blogspot.com/

Important Update!

Since so many people were having problems with the INA125P, we now have a new and improved version that uses the Hx711 24bit ADC amplifier module. http://arduinotronics.blogspot.com/2015/06/arduino-hx711-digital-scale.html


My goal was to create a programmable scale for weighing objects, parts counting, even directing product flow on a conveyor system.

I needed a load cell, a Arduino, and an amplifier.

Step 1: The Load Cell

On this load cell (from a Accuteck  W-8260-86W Postal Scale) the 4 wires coming from the load cell are:

Red: Excitation +
White: Signal +
Green: Signal -
Black: Excitation -

This matches the GSE / NCI / Sensotec wiring scheme.

http://www.controlweigh.com/loadcell_colors.htm
I disconnected the 4 wires from the control board in the scale, so they would be available for the next step.

Step 2: The Amplifier

To increase the output of the load cell so that the Arduino can read it on an analog input, we will need a INA125P amplifier and a 10 ohm resistor. Connect to the Arduino as indicated on the attached schematic.

Data Sheet: http://www.ti.com/lit/ds/symlink/ina125.pdf

Step 3: The Code

// Arduino as load cell amplifier
// by Christian Liljedahl
// christian.liljedahl.dk

// Load cells are linear. So once you have established two data pairs, you can interpolate the rest.

// Step 1: Upload this sketch to your arduino board

// You need two loads of well know weight. In this example A = 10 kg. B = 30 kg
// Put on load A
// read the analog value showing (this is analogvalA)
// put on load B
// read the analog value B

// Enter you own analog values here
float loadA = 10; // kg
int analogvalA = 200; // analog reading taken with load A on the load cell

float loadB = 30; // kg
int analogvalB = 600; // analog reading taken with load B on the load cell

// Upload the sketch again, and confirm, that the kilo-reading from the serial output now is correct, using your known loads

float analogValueAverage = 0;

// How often do we do readings?
long time = 0; //
int timeBetweenReadings = 200; // We want a reading every 200 ms;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int analogValue = analogRead(0);

  // running average - We smooth the readings a little bit
  analogValueAverage = 0.99*analogValueAverage + 0.01*analogValue;

  // Is it time to print?
  if(millis() > time + timeBetweenReadings){
    float load = analogToLoad(analogValueAverage);

    Serial.print("analogValue: ");Serial.println(analogValueAverage);
    Serial.print("             load: ");Serial.println(load,5);
    time = millis();
  }
}

float analogToLoad(float analogval){

  // using a custom map-function, because the standard arduino map function only uses int
  float load = mapfloat(analogval, analogvalA, analogvalB, loadA, loadB);
  return load;
}

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Step 4: Calibration and Use

You'll now see data displayed in the Serial monitor, but it won't make much sense until you calibrate the scale. Follow the steps in the code for calibration, and you are now ready to use this scale, add additional features like buttons for zeroing tare weight, or controlling servos and relays  for process control.

http://arduinotronics.blogspot.com/2013/01/working-with-sainsmart-5v-relay-board.html

Share

Recommendations

  • Make it Move Contest

    Make it Move Contest
  • Casting Contest

    Casting Contest
  • Woodworking Contest

    Woodworking Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

156 Comments

i am trying to get my fixed bowl that will be sitting on top of my load cell to be my zero points. can you tell me how to do this?

my bowl weighs 0.147 kg and the analog reading i got is 96.

i created a variable and set it to 96 and then subtracted analogValueAverage = analogvalA - variable. I do get the analog value to read zero, but when something is added to the bowl the analog value will not change why?

i am getting:

analogValue: 0.00
load: -6.40610

1 reply

Don't try and do that on the hardware side, do that on the software side. Every time you read an analog value, just subtract the analog value of just the bowl from it and you'll get the difference (i.e., what is inside the bowl).

Looking at the comments there are a lot of confusion relating to calibration.... It's important to select the correct load cell for the correct application.

A max = 200g loadcell won't cope with 5 kg, the same way that a 20t won't cope with 5 kgs.

It's important to define the zero (no load) and a full load calibration with a knowing weigh mass or object. Also is important to define the division (or increments) that you trying to establish.

A 20Kg X 0.100g = 200 divisions, mean the displayed weight will be 0.00kg (for zero).

Hope this helps.

The cell gives output even though im not pressuring the load cell.

Please help. I juse hx711

1 reply

So it should!? do you mean floating output? what's the capacity of it?

it's in the directions, btu I have found the ina to be troublesome unless wired very carefully.

I am working on my final year project in college and I chose this project topic. Please can I get the schematic to this project. If not can you show me how to. It will make my day. thanks a lot.

1 reply

Schematics are posted in the instructable.

how can i get the results to be read in grams or ounces?

1 reply

Use a HX-711, those are calibrated fro grams, and it's easy to do a math conversion to ounces.

It's possible that load cell (4 wire?) will not work with the hx-711. I don't know.

I noticed this in the spec: excitation voltage 9 VDC – Maximum 12 VDC

Also How do you have the load cell mounted?

3 replies

I used arduino to power the hx711 circuit .My arduino was powered using USB cable.It shows 50 gms for 40 kg weight.

weight.pngESP-mounting-example.jpg

Are you using channel a or channel b, B is fixed amplification, A is programmable.

I am using channel A.

what weight does it show, and what weight should it say?

i got random data sir, how to calibrate hx711 with 5kg loadcell?

1 reply

if you loaded the hx-711 library, it should be outputting in grams. make sure your s (a) wires are not reversed.