Go Down

Topic: Measuring 3- Wire Strain Gauge (Read 3856 times) previous topic - next topic

mike390

Hi I have bought a scale and am having a lot of trouble repurposing the strain gauge sensors to measure the voltage changes.  I have been searching alot and have found that I need to use a bridge and an amplifier.  I have the same scale and sensors that this person was mentioning in his topic http://arduino.cc/forum/index.php/topic,20941.0.html
I am just not sure how to connect the gauge into the bridge.  It has 3 wires,
Black
White
Red
The resistance between them are as follows:
white and red = 1k
Black - red = 1k
white - black = 2k

I was going to use a wheatstone bridge but and unsure which resistors to use for the 3 other resistors.  (I only want you use one strain gauge in the bridge).  And also which 2 wires to connect the strain gauge into the bridge.

Thanks!

aliirmak

#1
Sep 20, 2011, 12:12 am Last Edit: Sep 20, 2011, 12:16 am by aliirmak Reason: 1
Hi mike930,

You need to search for "quarter-bridge setup" in wheatstone bridge type. In your case, if you don't want to use other three strain gages, assuming r1 is your active resistor, you should replace r2, r3, and r4 in your bridge with dummy resistors. Since they will be passive it doesn't matter what type of resistor you are going to use. But to be coherent in the entire bridge keep all of the resistors as 1k ohm.

A regular strain gage should be excited with Vc so that you can measure voltage output Vo. Usually, red wire is connected to positive pole of power supply and one of the black/white pair is connected to negative pole of power supply. Depending on your circuit, the other wire of black/white pair should be connected an analog pin since it is a continuous analog signal.
The voltage you are going to read will be about 0-1 mV based on your excitation voltage.

Conditioning the signal is a whole different animal. Probably, you need amplifiers maybe capacitors to have noisless data.

++addition
it is really hard to measure small signal output with arduino, so i guess you don't have a choice other than using amplifier. Remember it is analog quantization is 5V/1024

dc42

That sensor is probably meant to be used as half a wheatstone bridge, not a quarter. I would connect black to gnd, white to +5v, and then red is one of the outputs from the bridge. Connect it to the non-inverting input of an op-amp. For the other side of the bridge, connect two 1k resistors in series between +5v and gnd, then the junction between them is the other output from the bridge. Connect that to the inverting input of the op-amp. Also connect a resistor from the op-amp output to the inverting input, say 10K to give a gain of about 20. Also connect the output of the op-amp to your Arduino analog input pin.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mike390


That sensor is probably meant to be used as half a wheatstone bridge, not a quarter. I would connect black to gnd, white to +5v, and then red is one of the outputs from the bridge. Connect it to the non-inverting input of an op-amp. For the other side of the bridge, connect two 1k resistors in series between +5v and gnd, then the junction between them is the other output from the bridge. Connect that to the inverting input of the op-amp. Also connect a resistor from the op-amp output to the inverting input, say 10K to give a gain of about 20. Also connect the output of the op-amp to your Arduino analog input pin.


What would be the 4th resistance in the half bridge? Do you think i should use 2 strain gauges?

dc42

The first 2 resistors in the bridge are the strain gauge, and the 3rd and 4th resistors are the two 1K resistors connected to Vcc and Gnd.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mike390

#5
Sep 21, 2011, 03:18 pm Last Edit: Sep 21, 2011, 03:38 pm by mike390 Reason: 1
Okay i finally got it working, thanks guys! Now theres a problem programming it with the arduino to convert the voltage into a weight.  I know the analog pin reads a voltage from 0 - 5 and converts it into steps from 0 - 1023.  However the analog pin seems to be very random giving a reading between 0 and1023 steps without me putting any weight on the scale.  My multimeter shows a constant 2.08V so the voltage is not changing too much.  Stepping on the scale produces a .55 change in the voltage, yet the analog sensors readings do not even seem to be affected, however this could also be because they are constantly changing from 0 - 1023 constantly and randomly.  Any idea why this could be happening?

dc42

What circuit are you using? Are you certain that your sketch is reading from the correct pin? If the mcu is in a socket, check that the pin concerned hasn't got bent under the chip instead of going into the socket.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

retrolefty

Quote
Any idea why this could be happening?


Perhaps if we could see your code and a wiring drawing.


mike390

#8
Sep 21, 2011, 07:11 pm Last Edit: Sep 21, 2011, 11:05 pm by mike390 Reason: 1
I tinkered with it and now the reading seems to be kind of stable.  However at rest it stays around 434 - 437 which is fine and it goes up with weight, however it always randomly goes up and down anywhere from 1 - 3 steps and it messes up with the weight.  When i put 10 lbs on the scale it reads 10 pounds but it may change to any value from 12.00 to 8.00.  Is there any way to stabilize these readings?  With a capacitor maybe? My circuit and code is below. Thanks for all your help so far guys!


Code: [Select]


/* ------------------------------------------------------------------------------- */

#include <LiquidCrystal.h>
#include <Keypad.h>
int sensorPin = A3; //designated the pin the sensor is connected to. In this case Analog 5(A5) for digital pins you just have to write the pin number e.g. sensorPin =13;
int sensorValue = 0; //declares sensorvalue variable
int active = 0; //declares active flag


/*---- LCD INIT
LCD LEGEND:
Pins    Function       Arduino Pin
1       VSS            GND
2       VCC            5V
3       VEE            GND (or POT, or PIN on Arduino to control Brightness)
4       RS             8
5       Read / Write   7
6       Enable         6
7       Data0          NONE
8       Data1          NONE
9       Data2          NONE
10      Data3          NONE
11      Data4          5
12      Data5          4
13      Data6          3
14      Data7          2
15      LED+           5V
16      LED-           GND
*/

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8); // initializes LCD with the pins we are using

// 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(3);
 int Number = (analogValue * 5.0) / 1024.0;
 analogValueAverage = 0.99*analogValueAverage + 0.01*Number;
 float weight = (analogValue - 433) * 1.2;
 // Is it time to print?
 if(millis() > time + timeBetweenReadings){
   float load = analogToLoad(analogValueAverage);
 //  float weight =
   Serial.print("analogValue: ");Serial.println(analogValueAverage);
   Serial.print("             load: ");Serial.println(load,5);
   time = millis();
   lcd.begin(8,2);  //LCD init for 8x2 display
   lcd.clear(); //Clears lcd
   lcd.setCursor(0,0); //starts writing the first 8 characters on the lcd
   lcd.print(weight);
   //lcd.setCursor(0,1); //starts writing the last 8 characters on the lcd
   //lcd.print(load,5);
 }
}

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;
}
   

 //lcd.print(sensorValue); //used it to print the value of the motion detector while testing

/* ------------------------------------------------------------------------------- */


Circuit:
http://i51.tinypic.com/2zedqo0.jpg

For Rg I used a 1k resistor 200k + 5/1k = 205 Gain\
Rs are the 4 strain gauges i used in the full bridge.  

mike390

Or is there a way to take a reading every half second for 3 seconds for example and display the average of that and loop that? so it doesnt seem to jump as much?

dc42


Or is there a way to take a reading every half second for 3 seconds for example and display the average of that and loop that? so it doesnt seem to jump as much?


That is what I would do.

I have a few questions about the circuit:

1. Are you really using a separate battery to power the strain gauge, or is the battery meant to represent Vcc and Gnd?
2. What is the type number of the chip are you using to amplify the strain gauge output?
3. Which of the 4 resistors marked Rs is/are the strain gauge?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mike390




That is what I would do.

I have a few questions about the circuit:

1. Are you really using a separate battery to power the strain gauge, or is the battery meant to represent Vcc and Gnd?
2. What is the type number of the chip are you using to amplify the strain gauge output?
3. Which of the 4 resistors marked Rs is/are the strain gauge?


Sure,
1. I meant it to represent the +5 and GND, the circuit and arduino are powered by the same power rails
2. The chip is a INA122P Datasheet here ->http://www.datasheetcatalog.com/datasheets_pdf/I/N/A/1/INA122P.shtml
3. All 4 resistors in the bridge are strain gauges, the scale has one gauge on each of its feet.

I am not too sure how i would write the code to average it out

dc42


3. All 4 resistors in the bridge are strain gauges, the scale has one gauge on each of its feet.


That will only give you good readings if two of the strain gauges on opposite corners of the bridge increase their resistance when subject to weight, and the two in the other opposite corners decrease their resistance. If (for example) all 4 increase their resistance, then if the scale is loaded perfectly evenly, the bridge remains balanced and you will get no output from it.

If they are 3-terminal strain gauges, it is likely that one of the two elements in each one will increase its resistance when loaded and the other will decrease its resistance.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mike390

#13
Sep 22, 2011, 02:30 am Last Edit: Sep 22, 2011, 02:34 am by mike390 Reason: 1
Hmm thats true.. I will try that tonight

mike390

#14
Sep 22, 2011, 06:27 am Last Edit: Sep 22, 2011, 07:25 am by mike390 Reason: 1
I tried hooking it up like you said and the resolution is even worse now, its only varying about 20 steps from 140lbs.  Should the 3rd left over wires from the gauges go to ground or stay unplugged? i tried both and it gave no improvement.  The thing about this method is if i apply a weight evenly in the middle of the scale all the sensors get even pressure and cancel eachother out making the circuit keep the same voltage.

Go Up