// 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 = 0.125; // kg
int analogvalA = 200; // analog reading taken with load A on the load cell
float loadB = 0.218; // 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;
}
Hi,
Check how many wires should be coming off pin2 of the IC.
I see one in your picture, but the overlay diagram shows a connection from pin2 to positive rail.
What is pin7 supposed to be connected to?
Which is the correct connections, pin 7 is a supply pin.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Draw the circuit you have in the picture on protoboard.
Then post it for us.
Do you have a DMM to help check voltages around your circuit?.
Where did you get the circuit from, the IC is designed for +5 and -5 supply but the datasheet does show a single 5V circuit.
TomGeorge:
Hi,
Check how many wires should be coming off pin2 of the IC.
I see one in your picture, but the overlay diagram shows a connection from pin2 to positive rail.
What is pin7 supposed to be connected to?
Which is the correct connections, pin 7 is a supply pin.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Draw the circuit you have in the picture on protoboard.
Then post it for us.
Do you have a DMM to help check voltages around your circuit?.
Where did you get the circuit from, the IC is designed for +5 and -5 supply but the datasheet does show a single 5V circuit.
Tom...
From pin 2, 1 wire to load cell signal - . Pin 7 is to Arduino 5V .
Here is diagram of my ckt.
TomGeorge:
Hi,
Check how many wires should be coming off pin2 of the IC.
I see one in your picture, but the overlay diagram shows a connection from pin2 to positive rail.
What is pin7 supposed to be connected to?
Which is the correct connections, pin 7 is a supply pin.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Draw the circuit you have in the picture on protoboard.
Then post it for us.
Do you have a DMM to help check voltages around your circuit?.
Where did you get the circuit from, the IC is designed for +5 and -5 supply but the datasheet does show a single 5V circuit.
Tom...
It took me a minute to work out too, Tom. On the breadboard, the red wire from pin7 passes underneath the IC and continues to the +ve rail, and the green wire only connects to pin2.
@rdbhaxor, since it's a 4-wire load cell, you probably don't need additional resistors. (See attached diagram, "4 wire load cell")
I might be wrong, but I think it's already a full-bridge.
I'm not too familiar with load cell circuits, but should the op-amp's ref pin be connected to gnd, or to half the supply voltage? Can you post a link to the source of the circuit you copied?
(I just found a circuit, (also attached, "ADC620 Load Cell Circuit"), that indicates that the ref pin should be connected to half the supply voltage and not to ground.)
@Wawa, I think you meant "Wheatstone" bridge in stead of "Wien" bridge.
OldSteve:
I'm not too familiar with load cell circuits, but should the op-amp's ref pin be connected to gnd, or to half the supply voltage?
Mid-voltage if you want to measure force going both directions.
Ground for one-way force, e.g. scales.
Mind the polarity of the Wheatstone bridge.
If it's wrong, weight will want to go negative.
Output of the AD620 on a single 5volt supply will only swing 2.5-3volt, so only ~500 digital values.
5kg will have 10gram granularity if you have a perfectly stable 5volt rail.
Leo..
OldSteve:
It took me a minute to work out too, Tom. On the breadboard, the red wire from pin7 passes underneath the IC and continues to the +ve rail, and the green wire only connects to pin2.
@rdbhaxor, since it's a 4-wire load cell, you probably don't need additional resistors. (See attached diagram, "4 wire load cell")
I might be wrong, but I think it's already a full-bridge.
I'm not too familiar with load cell circuits, but should the op-amp's ref pin be connected to gnd, or to half the supply voltage? Can you post a link to the source of the circuit you copied?
(I just found a circuit, (also attached, "ADC620 Load Cell Circuit"), that indicates that the ref pin should be connected to half the supply voltage and not to ground.)
@Wawa, I think you meant "Wheatstone" bridge in stead of "Wien" bridge.
I am new to load cell as well. How should i connect the ref ping to half supply volt ? i am just using arduino as source. Should connect it to arduino 3.3 v ?
Wawa:
Mid-voltage if you want to measure force going both directions.
Ground for one-way force, e.g. scales.
Mind the polarity of the Wheatstone bridge.
If it's wrong, weight will want to go negative.
Output of the AD620 on a single 5volt supply will only swing 2.5-3volt, so only ~500 digital values.
5kg will have 10gram granularity if you have a perfectly stable 5volt rail.
Leo..
Ty for the info. Can u tell me if i have any problem on the ckt ?
HX711 breakout boards are commonly used for load cells.
The boards I know have a 4.3volt Vref, derived from the 5volt rail, to supply the load cell.
And an onboard 24bit A/D converter.
Leo..
I sometimes bend the load cell (carefully) untill the "zero" reading is the lowest A/D possible.
Because the datasheet states that the output of the A/D is ~1.1volt minimum, min value will be ~225.
Maybe aim for 250.
Then use a gain resistor so the maximum weight (5kg) is an A/D value of about 750.
Because the datasheet states 3.8volt max (A/D = 778).
Maybe you can mod this sketch I wrote for a pressure sensor.
Leo..
int rawValue; // A/D readings
int offset = 102; // ~0.5volt zero pressure adjust
int fullScale = 920; // ~4.5volt max pressure (span) adjust
float pressure; // final pressure in psi
void setup() {
Serial.begin(9600);
}
void loop() {
rawValue = analogRead(A0);
pressure = (rawValue - offset) * 150 / (fullScale - offset); // pressure conversion
Serial.print("The pressure is ");
Serial.print(pressure, 1); // one decimal place
Serial.println(" psi");
delay(500);
}
Wawa:
Mid-voltage if you want to measure force going both directions.
Ground for one-way force, e.g. scales.
Mind the polarity of the Wheatstone bridge.
If it's wrong, weight will want to go negative.
Output of the AD620 on a single 5volt supply will only swing 2.5-3volt, so only ~500 digital values.
5kg will have 10gram granularity if you have a perfectly stable 5volt rail.
Leo..
Right, it sounds like you know the subject better than I do. I bought some (1/2 bridge) load cells last week, but haven't got around to playing with them yet. I know I'll use two wired together to complete the bridge, but that's as far as I've got.
You can also use a single load cell on one input of the IC.
And two equal value resistors for the other input.
That also completes a Wheatstone bridge (with half the sensitivity).
If you use two single load cells, make sure one goes up in voltage, and the other one goes down (with weight).
So mount on opposite sides OR swap positive and negative wires of ONE cell.
Leo..
Wawa:
You can also use a single load cell on one input of the IC.
And two equal value resistors for the other input.
That also completes a Wheatstone bridge (with half the sensitivity).
If you use two single load cells, make sure one goes up in voltage, and the other one goes down (with weight).
So mount on opposite sides OR swap positive and negative wires of ONE cell.
Leo..
Thanks for the tip. I have a schematic here somewhere, but haven't had a chance to look closely yet.
(I've been busy playing with my little robot car. :D)
Wawa:
I sometimes bend the load cell (carefully) untill the "zero" reading is the lowest A/D possible.
Because the datasheet states that the output of the A/D is ~1.1volt minimum, min value will be ~225.
Maybe aim for 250.
Then use a gain resistor so the maximum weight (5kg) is an A/D value of about 750.
Because the datasheet states 3.8volt max (A/D = 778).
Maybe you can mod this sketch I wrote for a pressure sensor.
Leo..
int rawValue; // A/D readings
int offset = 102; // ~0.5volt zero pressure adjust
int fullScale = 920; // ~4.5volt max pressure (span) adjust
float pressure; // final pressure in psi