You are on page 1of 10

technology

workshop

craft

home

food

play

outside

costumes

Arduino Load Cell / Scale


by sspence on April 22, 2013

Table of Contents
Arduino Load Cell / Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Intro: Arduino Load Cell / Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 1: The Load Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 2: The Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 3: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 4: Calibration and Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

Author:sspence Arduinotronics
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 years, and design my own off grid power systems.

Intro: Arduino Load Cell / Scale


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.

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

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)

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

{
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

Related Instructables

Make your
weighing scale
hack using
arduino and
hx711 by

How to interface
with 5kg
Balance Module
or Load Cell by
mybotic

Arduino Nano
and Visuino:
Measure Weight
with HX711
Load Cell

Reprap Load
Cell Z-Probe by
palmerr23

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

SmartCityZen
Recycle with
HX711 by
rickhank

FluidTrakker
Intro by
RajDenver

Amplifier and
ADC by BoianM

SohamG

Advertisements

Comments
50 comments Add Comment

view all 155 comments

StevenH178 says:

Sep 2, 2016. 10:09 PM REPLY


I am trying to calibrate my tal220 10 kg load cell by following your instructions, but I am confused in the code. For the first part where you said to enter two
known weights I entered 0.018 kg for A and 0.308 kg for B. Am I suppose to put anything or comment anything out so I can obtain the analogvalA and
analogvalB or do I put a 0 in where you have 200 and 600? The amplifier I am using is a ina122 with a 200 ohm resistor to get a gain of 1000. I am in the
process of making an automatic dog feeder where the bowl will sit on top of the load cell to determine if the dog has food or not in its bowl. if you could give
me any tips on how i can have the bowl as my zero I would appreciate it. Any help with how to get this load cell working would be appreciated!

StevenH178 says:

Sep 2, 2016. 10:16 PM REPLY

Here is a schematic of how I have my circuit configured

sspence says:

Sep 2, 2016. 7:00 AM REPLY

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

sspence says:

Aug 23, 2016. 11:31 AM REPLY

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


Also How do you have the load cell mounted?

NaveenI7 says:

Sep 2, 2016. 1:17 AM REPLY

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

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

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

Sep 2, 2016. 4:07 AM REPLY

NaveenI7 says:

Sep 2, 2016. 6:46 AM REPLY

I am using channel A.

sspence says:

Aug 23, 2016. 11:29 AM REPLY

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

NaveenI7 says:

Aug 21, 2016. 2:58 AM REPLY


I am using hx711 with 200kg loadcell.This is my code but output is very bad even though I put a platform for weighing scale it shows zero weight.But when I
give pressure it changes but to small extent.
#include <hx711.h>
// Hx711.SCK - pin #A0
Hx711 scale(A1, A0);
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print(scale.getGram(), 0);
Serial.println(" g");
delay(200);
}

sspence says:

Aug 23, 2016. 4:19 AM REPLY

Are you using a 4 wire load cell?

NaveenI7 says:

Aug 23, 2016. 10:18 AM REPLY

Yes , it's a 4 wire load cell.Below is the link for image


http://www.gjimpex.co.in/load-cell-czl-601ac.htm

NaveenI7 says:

Aug 23, 2016. 10:37 AM REPLY


Actually when I give pressure to one end of sensor ,weight increases but showing wrong weight.In rest position ,it shows zero value.

NomatoG says:

Aug 11, 2016. 4:21 PM REPLY

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

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

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

Aug 12, 2016. 4:32 AM REPLY

NomatoG says:

Aug 17, 2016. 10:20 AM REPLY

i have trouble sir, any idea?

sspence says:

Aug 17, 2016. 10:31 AM REPLY

Your wires are reversed.

ShreeB3 says:

Jul 28, 2016. 9:30 PM REPLY

how can i get the output in kg .tell me the code for this and also i needthe basic of this gram program

sspence says:

Jul 29, 2016. 7:45 AM REPLY

The hx-711 version outputs in grams. Use that version.

ChenH9 says:

Jul 20, 2016. 8:52 AM REPLY

Can u estimate from the results, what is the accurecy rate of the results? Is it possible to get grams?

sspence says:

Jul 20, 2016. 8:58 AM REPLY

The HX-711 version is accurate, and outputs in grams.

ChenH9 says:

Jul 20, 2016. 9:22 AM REPLY

Thanks for your reply, can i count on it to return 50g differences?

sspence says:

Jul 20, 2016. 9:29 AM REPLY

I've measured 0.05 gram differences

ChenH9 says:

Jul 20, 2016. 12:35 PM REPLY

Amazing, thank you sir!

DominicM23 says:

Feb 22, 2016. 6:21 PM REPLY

Can a load cell be programmed to alert when something weighs less than it did when it was first placed on the sensor?

sspence says:

Feb 22, 2016. 6:27 PM REPLY

yes, you can program it to alert on any decision code you write.

DominicM23 says:

Feb 23, 2016. 3:51 AM REPLY


Thanks for the quick response. Would there be any instructions that come with the product on how to do this or is it something that only a tech savvy
person knows?

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

sspence says:

Jul 7, 2016. 12:00 PM REPLY


The companies that make the parts have no way of knowing how you will use them, but they do provide data sheets. You have to know what you
want to do with it, and how.

Shankar NarayanP says:

Apr 11, 2016. 3:57 AM REPLY


All the hacks on internet pertaining to load cell recommends use of an amplifier to get the signal readable by any microcontroller like Atmega (arduino).
That's fair. But what I always wonder is how does the lcd work without an amplifier? How is that the scale is able to work without that amplifier??!!

sspence says:

Jul 1, 2016. 5:51 PM REPLY

The LCD is digital, no amplifier is needed. it works on the same 5v signalling the arduino uses.

PaulJ75 says:

Jul 1, 2016. 5:17 PM REPLY


Hello. The amplifier is needed to change the signal (in this case voltage in anaologue form) to a readable level but proportional to what a load cell uses.
The lcd communicates at the same voltage level already. A load cell system built for the arduini platform is already working witht he same voltage
reqyiremwnts and will not need an aditional aplifier circuit. I hope that this is helpful. The sensors built for arduino are designed to be modular and have
these presets already desig ed to work together.

KeyurV1 says:

Apr 10, 2016. 11:17 PM REPLY


I have made same circuit but I am getting a problem in amplifying the voltage. I have tried this with a 3 wired load sensor in which I am keeping 2 resistors on
the breadboard and 2 wires (black and white) coming out of load sensor are connected to make a Wheatstone bridge and I am reading the value of voltage
between red wire of load sensor and its other end in Wheatstone bridge. Now when I am applying force on load sensor then it's value are changing ( very
minute change but still change I have to amplify that). Now my problem is I am able to amplify the value of the voltage but the change is so minute that it's
amplification doesn't show up in comparison to the actual voltage. How should I go about it?

matti.virta.1 says:

Mar 6, 2016. 2:10 AM REPLY

I have weight sensor(load cell) 4 wire sensor+hx711 amp,+arduino uno r3, test code what i found at net working fine.
but how i adding code weight limit alarm led ?
mean if value = X then ledpin output hight else low. i try many code but no working ?
full code need be if button1 high ledpin1 high.(run pump) then value == X limit then ledpin2 high else low(alarm stop pump). but i try many time write code and
all style not working ,how thats must made ??????

Christelle JoyL says:

Feb 27, 2016. 10:20 AM REPLY


Hi, sir! I have a project about BMI Machine and I use the load cell as my sensor in weight. I just want to ask if how to call the output of the amplifier so I can
manipulate it in the program, and use it in my actuator, which is the servo motor. Thank you so much for the response.

Nur Amelinaz says:

Feb 24, 2016. 4:28 AM REPLY


hello sir, I use the weight sensor for my final project. so, I want to ask you some question about weight sensor coding. can I use, the arduino coding in the
microcontroller coding? its same or not? or in microcontroller have a other coding to make a programming? that,s all. thank you.

sspence says:

Feb 24, 2016. 4:34 AM REPLY


The arduino is a microcontroller, based on the Atmel 328P. If you have a different microcontroller, you will have to modify the code and library
appropriately.

sspence says:

Feb 23, 2016. 3:59 AM REPLY


Well, I posted all the code that make this project work, so you are free to change the code, but it does require some C programming savvy. I am available for
custom programming. Cost would depend on the scope of the changes, but might be as little as $25

TannerW4 says:

Jan 4, 2016. 8:49 PM REPLY


I got a Taylor scale (http://www.taylorusa.com/kitchen/food-scales/glass-digital-kitchen-scale.html) and can't seem to find the manufacturer, unless they are
the manufacturer in which case they're not listed on the color charts you linked. The labels seem to be misaligned as well. Is there any other way to tell which
are signal and excitations?

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

sspence says:

Jan 5, 2016. 4:07 AM REPLY


assume red and black are power and ground, and white and green are signal, if scale reads funny, reverse white and green.

tunay02 says:

Dec 26, 2015. 5:42 AM REPLY


Hello! Can you help me very urgent I need all the code for the operation of this scale var.ltf hx711 I am using the Layout in this project? I'm sorry for bad
english.

sspence says:

Dec 26, 2015. 5:52 AM REPLY


code for the hx711 is at http://arduinotronics.blogspot.com/2015/06/arduino-hx711-digital-scale.html make sure you download and install the library.

myrakhan says:

Nov 9, 2015. 8:42 AM REPLY

hey i want to know can i use AD620 amplifier instead of this one in the circuit??

sspence says:

Nov 9, 2015. 8:56 AM REPLY

The code would be different.

myrakhan says:

Dec 2, 2015. 12:26 PM REPLY


can you help me with the code i am using ad620 amplifier with pic18f452
and output after amplifier fluctuate's alot what should i do?
and i generate a formula from the practicle values of load (weights) and output voltage but it did not give write answer on proteus :(

sspence says:

Dec 2, 2015. 12:39 PM REPLY

There's no ad620, pic18f452 or proteus in this project. I regret that I cannot help you.

gs12 says:

Nov 27, 2015. 2:57 AM REPLY


im new to arduino.. wat basic launguage to prog arduino for all type of arduino project.? is there possible to create own library.? and wat language to be learn for
library code....

sspence says:

Nov 27, 2015. 5:09 AM REPLY


arduino code and libraries are most commonly written in C/C++ it's easy to write a library, see http://arduinotronics.blogspot.com/2014/07/creating-supersimple-library.html

steria says:

Nov 6, 2015. 2:44 AM REPLY


Hi, We are creating a PoC with the load sensor attached to the shopping cart to weigh the weight of the items in the shopping cart. Can we use this kind of a
scale fixed to the shopping cart. Do you see any issues?

sspence says:
I don't see an issue. If the cart weight is included, subtract that out of your total before displaying.

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

Nov 6, 2015. 4:29 AM REPLY

RazanI says:

Nov 1, 2015. 12:48 PM REPLY

can this scale be applied to a travelling bag to show its weight?

sspence says:
you can put anything you want on the scale, assuming you pick an appropriate load cell.

view all 148 comments

http://www.instructables.com/id/Arduino-Load-Cell-Scale/

Nov 2, 2015. 8:34 AM REPLY

You might also like