Online mesh current calculator using Kirchhoff’s Voltage Law (Two loops)

Virtual Lab · DC Circuits

KVL Two-Loop Mesh Calculator

Find the two mesh currents and the common branch current of any two-loop DC circuit using Kirchhoff’s Voltage Law. A worked circuit inside the calculator shows exactly how to enter resistors and battery signs. Easy theory, guided experiments and a fully solved example are given below the calculator.

✍️ By Sanket Barde ⏱️ 9 min read 🧪 Interactive calculator 🎯 BEE · GATE EE

🎯 Aim

To apply Kirchhoff’s Voltage Law to a two-loop circuit and find the mesh and branch currents.

🧰 Apparatus (virtual)

Two meshes with up to four resistors and four batteries each, one common branch, and a Cramer’s-rule solver.

✅ Outcome

Use the battery sign rule correctly, write the two KVL equations and find which batteries supply or absorb power.

EEGATE Virtual Lab · KVL Two-Loop CalculatorLIVE
∑
Two Mesh Current Calculator
Kirchhoff’s Voltage Law (KVL) • Mesh Current Method
Solve a two-loop electrical circuit using Kirchhoff’s Voltage Law. Enter the resistances and voltage sources for each mesh. Currents are assumed to be clockwise.
📘 How to Use This Calculator (tap to hide / show)
  1. 1Mark the mesh currents. Take I1 in the left loop and I2 in the right loop, both clockwise.
  2. 2Loop resistances: enter every resistor in that loop, including the common resistor, one value per box.
  3. 3Loop voltages: move clockwise around the loop. For each battery, look at the second plate you reach: long plate (+) → enter +V; short plate (−) → enter −V.
  4. 4The common resistor and any battery in the common branch belong to both loops: enter them in Loop 1 and Loop 2 (each battery with its own sign from step 3). Also type the common resistor in the Common Resistance box.
  5. 5Leave unused boxes blank and click ⚡ Solve Mesh Currents. A negative answer means that current actually flows anticlockwise.
Battery sign rule (moving clockwise): − → + (short plate, then long plate) = +V  |  + → − (long plate, then short plate) = −V
Worked example
4 Ω 2 Ω 4 Ω 1 Ω 16 V 12 V 20 V + + + I₁ I₂
BoxLoop 1 (I1)Loop 2 (I2)
Resistances4, 4
top 4 Ω + common 4 Ω
2, 1, 4
2 Ω + 1 Ω + common 4 Ω
Voltage sources16, −12
16 V: − → +  •  12 V: + → −
−20, 12
20 V: + → −  •  12 V: − → +
Common resistance4 (the 4 Ω in the middle branch)
1
Loop 1 Resistance & Voltage Sources
Ω
Ω
Ω
Ω
V
V
V
V
2
Loop 2 Resistance & Voltage Sources
Ω
Ω
Ω
Ω
V
V
V
V
3
Common Branch
Ω
✓ Mesh Current Solution
Mesh Current I₁ —
Mesh Current I₂ —
Common Branch Current —
Currents are calculated using the mesh-current equations and the common branch current is taken as \( |I_1-I_2| \).
Note: Enter only the components present in each loop. Leave unused resistance or voltage fields blank. Voltage sources are entered according to the assumed clockwise direction.

Theory

Kirchhoff’s Voltage Law in simple words

Imagine walking around a hill on a closed path and coming back to where you started. However many times you climb up or come down, your total change in height is zero, because you are back at the same point. Voltage behaves the same way. As you go around any closed loop of a circuit, a battery may lift you up in voltage and a resistor brings you down, but when you return to the starting point the total change must be zero.

Key result: KVL

\[ \sum_{\text{closed loop}} V = 0 \qquad\text{(sum of voltage rises} = \text{sum of voltage drops)} \]

This law, given by Gustav Kirchhoff in 1845, comes from the conservation of energy. Together with Ohm’s law (V = IR), it is enough to solve any DC circuit.

Reading a battery symbol

In a circuit diagram a battery is drawn as two parallel plates. The long plate is the + terminal and the short plate is the − terminal. While moving around a loop, look at the second plate you reach:

You cross the battery fromSecond plate reachedVoltage changeEnter in the calculator
− to + (short, then long)Long (+)Rise+V
+ to − (long, then short)Short (−)Drop−V

For resistors, walking in the same direction as the assumed current means walking “downhill”: the voltage drops by I × R.

The two mesh equations

Take mesh current I₁ in the left loop and I₂ in the right loop, both clockwise. The resistor in the middle, Rc, belongs to both loops, so the current through it is I₁ − I₂. Writing KVL for each loop and tidying up always gives the same pair of equations:

Two-mesh equations

\[ R_{11}\,I_1 - R_c\,I_2 = V_1 \qquad\qquad -R_c\,I_1 + R_{22}\,I_2 = V_2 \]

Here R11 is the total resistance of loop 1 (including Rc), R22 is the total resistance of loop 2 (also including Rc), and V₁, V₂ are the sums of the battery voltages in each loop with their signs. This is why the calculator asks you to enter the common resistor in both loops.

Solving with Cramer’s rule

Formula

\[ \Delta = R_{11}R_{22} - R_c^{2}, \qquad I_1 = \frac{V_1 R_{22} + V_2 R_c}{\Delta}, \qquad I_2 = \frac{R_{11} V_2 + R_c V_1}{\Delta} \]

The current in the common branch is I₁ − I₂. If it is positive, it flows in the direction of I₁ through the middle resistor; if negative, in the direction of I₂. A negative mesh current only means that the real current flows anticlockwise.

💡 Exam tip

Always finish with a check. KCL at a node: the current entering must equal the current leaving. Power balance: the power given by the supplying batteries must equal the power taken by the resistors plus any battery being charged.

⚠️ Common mistakes

(1) Forgetting to include the common resistor in one of the loops. The calculator now warns you if it notices this. (2) Using the first plate instead of the second plate for the battery sign. (3) Giving a battery in the common branch the same sign in both loops: each loop crosses it in the opposite direction, so its sign is opposite in the two loops.

Try it yourself

Guided experiments

Press Reset before each experiment. Open How to Use inside the calculator to see the worked circuit used in Experiments 1, 3 and 4.

Experiment 1

Solve the worked circuit

  1. Loop 1: R = 4, 4 and V = 16, −12. Loop 2: R = 2, 1, 4 and V = −20, 12.
  2. Common resistance = 4 Ω. Solve.
Observe: I₁ = −0.100 A and I₂ = −1.200 A. Both currents actually flow anticlockwise. The common branch carries 1.100 A in the direction of I₁.
Open the calculator ↑

Experiment 2

One battery only

  1. Loop 1: R = 2, 4 and V = 10. Loop 2: R = 6, 4 and no battery.
  2. Common resistance = 4 Ω. Solve.
Observe: I₁ = 2.273 A, I₂ = 0.909 A and the common branch 1.364 A. With a single battery, both mesh currents follow its push, so both are positive.
Open the calculator ↑

Experiment 3

One wrong sign

  1. Enter Experiment 1 again, but type +12 instead of −12 in Loop 1.
  2. Solve and compare.
Observe: the answers jump to I₁ = 4.100 A and I₂ = +1.200 A. A single sign error changes every current, so always use the second-plate rule carefully.
Open the calculator ↑

Experiment 4

Forgetting the common resistor

  1. Enter Experiment 1, but in Loop 2 type only 2 and 1 (leave out the common 4 Ω).
  2. Solve.
Observe: the calculator stops and reminds you that the common resistance must also be entered in the boxes of both loops. This is the most common mistake in two-mesh problems.
Open the calculator ↑

Solved example

The worked circuit, solved fully

Solve the circuit shown in the calculator’s How to Use box: a 16 V battery and 4 Ω resistor on the left, a 4 Ω resistor and 12 V battery in the middle branch, and a 2 Ω resistor, 1 Ω resistor and 20 V battery on the right. All batteries have their + plate at the top. Find all currents and check the power balance.

  • R11 = 4 + 4 = 8 Ω
  • R22 = 2 + 1 + 4 = 7 Ω
  • Rc = 4 Ω
  • V₁ = 16 − 12 = 4 V
  • V₂ = −20 + 12 = −8 V
1

Write the two equations

\[ 8I_1 - 4I_2 = 4 \qquad\qquad -4I_1 + 7I_2 = -8 \]
2

Cramer’s rule

\[ \Delta = 8\times7 - 4^{2} = 40, \qquad I_1 = \frac{4\times7 + (-8)\times4}{40} = \frac{-4}{40} = -0.1\ \text{A} \]\[ I_2 = \frac{8\times(-8) + 4\times4}{40} = \frac{-48}{40} = -1.2\ \text{A} \]
3

Actual branch currents

Right branch: 1.2 A flows up through the 20 V battery (from − to +), so it supplies power. Middle branch: I₁ − I₂ = 1.1 A flows down through the 12 V battery (into its + terminal), so it is being charged. Left branch: 0.1 A flows down into the + terminal of the 16 V battery, so it is also being charged. KCL at the top middle node: 1.2 in = 1.1 + 0.1 out ✓

4

Power balance check

\[ P_{\text{supplied}} = 20\times1.2 = 24\ \text{W} \]\[ P_{\text{batteries charged}} = 12(1.1) + 16(0.1) = 14.8\ \text{W} \]\[ P_{\text{resistors}} = 4(0.1)^2 + 4(1.1)^2 + 2(1.2)^2 + 1(1.2)^2 = 9.2\ \text{W} \]

Total absorbed = 14.8 + 9.2 = 24 W = power supplied ✓

I₁−0.1 A
I₂−1.2 A
Common branch1.1 A
Power balance24 W = 24 W

💡 Check it

This is exactly Experiment 1. The calculator shows I₁ = −0.100 A, I₂ = −1.200 A and a common branch current of 1.100 A in the direction of I₁.

Where it is used

Applications of two-loop analysis

🚗

Car electrical system
The alternator and battery work in parallel; KVL tells whether the battery is charging or supplying.

☀️

Solar panel with battery
A two-source circuit decides how load current is shared between the panel and the battery.

🔋

Parallel battery packs
Unequal battery voltages cause circulating currents that this method can calculate.

🔌

UPS and backup supplies
Mains-derived DC and a backup battery feed one load through separate paths.

Viva voce

Viva questions

Q1State Kirchhoff’s Voltage Law.

In any closed loop of a circuit, the algebraic sum of all the voltages (rises taken positive and drops negative, or the other way round) is zero.

Q2How do you decide the sign of a battery while writing KVL?

Move around the loop in the chosen direction and look at the second plate you reach. If it is the long plate (+), the voltage rises: take +V. If it is the short plate (−), it drops: take −V.

Q3Why is the common resistor included in both loop equations?

It is physically part of both loops. Its current is the difference of the two mesh currents, so it appears in both equations: with the loop’s own current in the total resistance, and with the other mesh current as the shared term.

Q4How can you tell whether a battery is charging or discharging?

If the actual current leaves from its + terminal, it supplies power (discharging). If the current enters its + terminal, it absorbs power (charging).

Q5Can the determinant Δ ever be zero in a real two-mesh resistor circuit?

No. Each loop’s total resistance is larger than the shared resistance, so R11R22 > Rc² and Δ is positive. A zero determinant means a data-entry mistake.

📌 More virtual labs & notes

SB
Sanket Barde Assistant Professor, Electrical Engineering · 13+ years of teaching

Writes clear, exam-focused notes and builds free virtual labs on EEGATE to help GATE EE and JEE students learn by doing.

Comments