A Wheatstone bridge looks like four resistors in a diamond with a galvanometer across the middle. When the bridge is balanced the galvanometer reads zero, and that gives a way to measure an unknown resistance. Here is the circuit solved in code. (I build PractiSci, which has a free Wheatstone bridge lab.)

The balance condition

With resistors P and Q in one arm pair and R and S in the other, the bridge balances when P/Q = R/S. So an unknown S is found from S = R Q / P.

const unknown = (P, Q, R) => R * Q / P; console.log(unknown(100, 200, 50)); // 100 ohm 

Solving the full bridge

To see what the galvanometer reads away from balance, solve the two middle node voltages. Put the battery V across the top and bottom corners, and write the current balance at each middle node.

function galvanometerCurrent(V, P, Q, R, S, G) { const g = (x) => 1 / x; const a11 = g(P) + g(R) + g(G), a12 = -g(G), b1 = V * g(P); const a21 = -g(G), a22 = g(Q) + g(S) + g(G), b2 = V * g(Q); const det = a11 * a22 - a12 * a21; const VB = (b1 * a22 - a12 * b2) / det; const VD = (a11 * b2 - a21 * b1) / det; return (VB - VD) / G; } console.log(galvanometerCurrent(10, 100, 100, 200, 200, 50)); // 0 console.log((galvanometerCurrent(10, 100, 100, 200, 250, 50) * 1000).toFixed(4), 'mA'); // -2.5316 mA 

With P = Q = 100 Ω and R = S = 200 Ω the bridge is balanced and the current is exactly zero, whatever G is. Change S to 250 Ω and a current of about 2.53 mA flows through the 50 Ω galvanometer (the minus sign only says it flows from D to B).

Why use a null reading?

At balance the galvanometer current is zero, so the result does not depend on the battery voltage or the galvanometer's own resistance. That makes the bridge accurate even with a cheap meter.

FAQ

Which resistors give the best sensitivity?

Keep all four arms of similar size. If one arm is much larger, a small change in the unknown barely moves the galvanometer.

What is a metre bridge?

It is a Wheatstone bridge where P and Q are the two parts of a uniform wire, so the ratio P/Q is just the ratio of the lengths.

Where can I try it?

The free Wheatstone bridge lab lets you vary the arms and watch the galvanometer deflection. More Class 12 labs are in the physics practicals.