wheatstone bridge

Hi there

I set wheatstone bridge with arduino uno. and I had to know Vout. so I set R1,R2,R3= 100ohm and R4=220ohm. but the result was Vout=2.5, R4=0.5…

I think the programming is not perfect. Let me know what should I do?

float vout = 0.0;

float vin = 5.0;

float R1 = 100.0;

float R2 = 100.0;

float R3 = 100.0;

float R4 ;

int value = 0;

void setup() {

Serial.begin(9600);

pinMode(A0, INPUT);

}

void loop() {

vout = analogRead(A0) * (vin / 1023.0);

R4 = (( R3 * vin) / (vout + (( R2 * vin) / (R1 + R2))) - R3);

Serial.println(vout);
Serial.println(R4);

delay(1000);

}

2.PNG

Please post your code properly, using code tags.

I think the programming is not perfect.

Fix what you think is wrong (most likely, the wrong formula), and come back if you still need help.

aquarius3993:
void loop() {

vout = analogRead(A0) * (vin / 1023.0);

R4 = (( R3 * vin) / (vout + (( R2 * vin) / (R1 + R2))) - R3);

Serial.println(vout);
Serial.println(R4);

delay(1000);

}

I think the formula you using is wrong. so going thru the math:

Vab= Vin*[R4/(R3+R4)- R2/(R1+R2)]

Vab/Vin = R4/(R3+R4)- R2/(R1+R2)

R4/(R3+R4) = Vab/Vin + R2/(R1+R2)

R4 = y*(R3+R4)

R4 = y*R3/(1-y), where y = Vab/Vin + R2/(R1+R2).

based on the above, try this in your loop:

void loop() {
float Vratio = analogRead(A0)/1023.0; //no need to calculate Vab since only the ratio is relevant

float Rratio = Vratio + R2/(R1+R2); //dont really need to do R2/(R1+R2) each time if R1,R2 are constants.
                        //just pre-calculate the value  and put it here instead of calculating it every time


R4 = (Rratio*R3)/(1-Rratio);


Serial.println(Vratio*vin); //your vout
Serial.println(R4); 

delay(1000);

}

hope that helps

With only one voltage measurement (referenced to ground), you have a simple voltage divider, not a Wheatstone bridge.

One of the resistor pairs is irrelevant.

Hi,
Is this to do with this thread?

Can you please post a copy of your complete circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom. :slight_smile:

This is my circuit

float vin = 5;

float R1 = 100.0;

float R2 = 100.0;

float R3 = 100.0;

float R4 ;

int value = 0;



void setup() {



  Serial.begin(9600); 



  pinMode(A0, INPUT);


}


void loop() {
 
    float Vratio = analogRead(A0)/1023.0;
    float Rratio = Vratio + R2/(R1 + R2);
    R4 = (Rratio * R3)/(1 - Rratio);
    Serial.println(Vratio * vin);
    Serial.println(R4);
    delay(1000);

}

and the result is Vout=2.5, R4=22000ohm…

  1. The circuit pictured is not a Wheatstone bridge.

  2. Even if it were, the equation in the code is still wrong.

With only one voltage measurement (referenced to ground), you have a simple voltage divider, not a Wheatstone bridge.

Below is a standard schematic diagram showing what the “Fritzing for the brain dead” diagram actually represents: (Edit: worse than I thought!)
schematic.png

jremington:

  1. The circuit pictured is not a Wheatstone bridge.

  2. Even if it were, the equation in the code is still wrong.

about (2)... interested to know what is the correct equation to use to evaluate R4 for a correctly wired wheatstone bridge. plz share your wisdom...

To solve a "correctly wired Wheatstone bridge" for an unknown requires one to measure a voltage difference, which on an Arduino, requires two voltage measurements.

Hi,
OPs Fritzy;
05794b6db84278e3551d989287ce293ad1793060.png
That is not your circuit, if it was you would have a short of the 5V to gnd.

PLEASE get a pen and paper out and DRAW your circuit and post a picture of it please!!!

Also post a picture of your project so we can see your layout.

What are you trying to accomplish, what is the application?

Thanks… Tom… :slight_smile:

you would have a short of the 5V to gnd.

As shown in reply #6!

jremington:
To solve a "correctly wired Wheatstone bridge" for an unknown requires one to measure a voltage difference, which on an Arduino, requires two voltage measurements.

Ah... and here I thought the equation I gave OP was wrong! I assumed that OP would have a difference opAmp circuit to output Vab.

but from he's later replies he's was not!

whether OP uses a simple voltage divider or a correctly wired wheatstone bridge, OP only needs to ONE analog read off the branch containing R4 to determine its value(unless he really need to know the voltage difference).

@OP maybe try a code like this then:

/*
Va/Vin =  R2/(R1+R2)
Vb/Vin =  R4/(R3+R4)
*/

void loop() {
float Vb_Vin = analogRead(A0)/1023.0; //ratio Vb/Vin

float Va_Vin = analogRead(A1)/1023.0; //the ratio Va/Vin (if using wheatstone bridge)

R4 = (Vb_Vin*R3) / (1-Vb_Vin);

Serial.println(Vb/Vin*vin); //Vb read
Serial.println(Va/Vin*vin); //Va read (if using wheatstone bridge)
Serial.println(R4);

delay(1000);

}

media_b16_b1670060-91ae-4c55-9d72-b13e72438fe4_phpQeosWP.png

media_b16_b1670060-91ae-4c55-9d72-b13e72438fe4_phpQeosWP.png

1.unfortunately, I have to use wheatstone bridge.

2.I don’t know why my circuit is wrong and current flow that way.

3.Is this the right circuit?

Hi,
Yes much better.

OPs circuit;
3f6ab1de0d15955019baa9f216265516ffa79f3f.png
So you want to measure a PT100 thermistor.

unfortunately, I have to use wheatstone bridge.

School/College class project?
What temperature range are you looking at measurements for?

Tom… :slight_smile:

If you want to use the Wheatstone bridge to measure a PT100 sensor, it is best to use 100 Ohm, high precision, for the other resistors.

Umm...

yes this is school project. But I belong to the Department of Geology. so There is difficulty in circuit configuration.

and I do not need to worry about whether this is PT100.

I just have to make a simple wheatstone bridge circuit(with three 100ohm).

Pleas tell me how to make arduino circuit.....

aquarius3993:
Umm...

yes this is school project. But I belong to the Department of Geology. so There is difficulty in circuit configuration.

and I do not need to worry about whether this is PT100.

I just have to make a simple wheatstone bridge circuit(with three 100ohm).

Pleas tell me how to make arduino circuit.....

any example here

just plug the ADC in into your analog input of your arduino to read

I tried this code and circuit. and the result is 1.56 2.50 45.52

Is it right?

float Vin = 5;

float R1 = 100.0;

float R2 = 100.0;

float R3 = 100.0;

float R4 ;

int value = 0;

void setup() {

  Serial.begin(9600); 

 
}

float Va =  R2/(R1+R2)*Vin;
float Vb;

void loop() {
float Vb_Vin = analogRead(A0)/1023.0; //ratio Vb/Vin

float Va_Vin = analogRead(A1)/1023.0; //the ratio Va/Vin

R4 = (Vb_Vin*R3) / (1-Vb_Vin);
Vb =  R4/(R3+R4)*Vin;


Serial.println(Vb/Vin*Vin); //Vb read
Serial.println(Va/Vin*Vin); //Va read
Serial.println(R4);


delay(1000);

}