Tutorialsher piece of hardware that performs a similar function.

Electronic Fundamentals: Kirchhoff's circuit laws

last updated: 13/11/18

Tea for two (and more)

"Just do it" Kirchhoff1:

circuit kirchhoff 1


In a series circuit of resistors:

In a parallel circuit of resistors:

In a series circuit of resistors the total resistance is equal to the sum of the individual resistances.
formula R Sum

In a parallel circuit of resistors the total resistance is the reciprocal of the sum of the reciprocals of the individual resistances (the total conductance is equal to the sum of the individual conductances).
formula G Sum

More here!

"Just do it" Kirchhoff2:

circuit kirchhoff 2

Voltage and current in a series or parallel circuit

Just do it Kirchhoff 3
Just do it Kirchhoff 4


In a series circuit of resistors:

In a parallel circuit of resistors:

In a series circuit of resistors the total voltage is the sum of all partial voltages.

formula U Sum

formula I Sum

In a parallel circuit of resistors the total current is the sum of all branch currents.

formula I Sum

formula I Sum

Kirchhoff's circuit laws (wiki)

Kirchhoff's laws (Kirchhoff's rules) are two laws that generalize the work of Ohm. They deal with DC or AC currents and voltages in electrical circuits. They are only accurate for circuits at lower frequencies where the wavelengths (λ = c/f) of electromagnetic radiation are very large compared to the circuits. For higher frequencies we use Maxwell's equations.

Kirchhoff's first law: The current law

From wikipedia:

The algebraic sum of currents in a network of conductors meeting at a point is zero.
formula Kirchhoff1

or in other words:

At any node (junction) in an electrical circuit, the sum of currents flowing into that node is equal to the sum of currents flowing out of that node.

circuit Kirchhoff law1

Kirchhoff's second law: The voltage law

From wikipedia:

The directed sum of the electrical voltages around any closed network is zero.
formula Kirchoff2

or in other words:

the sum of the emfs in any closed loop is equivalent to the sum of the potential drops in that loop.
The algebraic sum of the products of the resistances of the conductors and the currents in them in a closed loop is equal to the total electromotive force available in that loop.

circuit Kirchhoff law2


Kirchoff laws example

Click to enlarge!

kirchhoff example

Just do it Kirchhoff 5

Kirchoff just do it 5

Voltage divider (wiki)

As observed before (resistors in series), the voltage drop across each resistor is a fixed proportion of the supply voltage by the ratio of our resistors. A series circuit is often called a voltage divider for its ability to divide the total voltage into fractional portions of constant ratio.

Voltage divider without load

formula I Sum

In our circuit we draw no current (load: RL=∞ Ω), so we get 2 resistors in series (only one current I, U=Utotal=U1+U2, Uout=U2):

formula Pot1_1

formula Pot1_2

Just do it Kirchhoff 6
Just do it Kirchhoff 7

Voltage divider with load

Ass seen in our exercise, the load has to be high impedance to allow a voltage divider to work. As a rule of thumb, the current in our voltage divider has to be minimum 10 times higher than the current through the load.

Rule of thumb: I ≥ 10·IL

formula I Sum

For a voltage divider with load we get the following formulas:

formula Pot2_1

formula Pot2_2

formula Pot2_3

Just do it Kirchhoff 8

The potentiometer, a voltage divider (wiki)

The potentiometer is an adjustable voltage divider! The value of the potentiometer (R1+R2) defines the current.

formula I Sum

Not all potentiometer are linear. A logarithmic potentiometer is a potentiometer where the resistive element follows a logarithmic taper. Logarithmic potentiometers are often used in audio amplifiers, as human perception of audio volume is logarithmic.

Special voltage dividers: circuits with pull-up or pull-down resistors (wiki)

When using integrated circuits (like micro-controller) we often have to provide a digital signal to an input pin. In binary logic the levels are logical high and logical low (binary numbers 1 and 0).
We have now the possibility to use the higher voltage level (e.g. 5 V or 3.3 V) or the lower voltage level (GND=0 V) to represent the logic level high. These two options are named active high and active low.

For human interaction we use push-buttons or switches. If we use a simple closer or opener without supplementary components, we get the following problem:

circuit no pull up

If the switch is closed, we have a defined voltage of 0V. If it is open we get no voltage at all. Our pin is floating, and acts as an antenna.

Just do it Kirchhoff 9
    // iot_jdik_floating pin.ino    
    // weigu.lu
    // Input pin is floating; LED with series resistor on output pin

    const byte Input_pin = 0; // digital pin 0 as input
    const byte LED = 1;      // digital pin 1 as output (LED)

    void setup() {
      pinMode(Input_pin, INPUT);
      pinMode(LED, OUTPUT);

    void loop() {

As we don't want magic circuits, we have to assure there's always a defined potential on our input pin. We can use therefore external or internal pull-up resistors or pull-down resistors. Pull-up resistors give us a negative logic: 0 V is active high. The logic can easily be changed in Arduino software.

Negative logic with external pull-up:
For human interaction we use push-buttons or switches.

circuit pull up

Positive logic with external pull-down:

circuit pull down

Normally the input current of IC's is very low (remember the 50 nA of our ESP32) and so the pull-up or pull-down resistors may have a high resistance to fulfill our rule of thumb (10 kΩ - 100 kΩ).

Just do it Kirchhoff 10

External resistors make our circuits bigger and more expensive. So the micro-controllers have integrated resistors that can be added by setting the right bit in a register. The Atmel AVR chips used on Arduino Uno or Teensy 2.0 have only the possibility to use internal Pull-Ups (negative logic). The ESP32 however has pull-ups and pull-downs. In Arduino you have simply to add the right parameter to your pinMode-method.

Just do it Kirchhoff 11
    // iot_jdik_pu_pd.ino
    // weigu.lu
    // 2 input pins; 2 LED with series resistor on output pins (on board)

    const byte Input_pin1 = 16;     // digital pin 16 as input
    const byte Input_pin2 = 17;     // digital pin 17 as input
    const byte LED1 = LED_BUILTIN;  // digital pin 2 as output (on board LED blue)
    const byte LED2 = 21;           // digital pin 21 as output (external LED series res. 3.3V!)

    void setup() {
      pinMode(Input_pin1, INPUT_PULLUP);
      pinMode(Input_pin2, INPUT_PULLDOWN);
      pinMode(LED1, OUTPUT);
      pinMode(LED2, OUTPUT);

    void loop() {

Pull-ups and pull-downs are only needed with push-buttons and switches! Don't use them when you connect a data line with defined levels.