last updated: 2020-12-17

- If we put two resistors in series or parallel we get a new total resistor between the terminals (clamps). With the knowledge of the previous chapter about the resistance of a wire (
`R~ℓ`

,`R~1/A`

), we can find the formulas to calculate this total resistances! For this we assume that we put two wires in series with the same cross-section (`R`

), and two wires in parallel with the same length (_{1}=ℓ_{1}/(ϰ·A), R_{2}=ℓ_{2}/(ϰ·A)`R`

)). Find the two formulas for_{1}=(ℓ·ρ)/A_{1}, R_{2}=(ℓ·ρ)/A_{2}`R`

and_{total-series}=f(R_{1},R_{2})`R`

by using the respective formulas for_{total-parallel}=f(R_{1},R_{2})`R`

and_{1}`R`

from above._{2}

- Calculate the total resistance of two 560 Ω resistors in series and in parallel. Control the result with your ohmmeter. What conclusions can you make?
- Calculate the total resistance of a 10 kΩ and a 560 Ω resistor in series and in parallel. Control the result with your ohmmeter. What conclusions can you make?
- Calculate and measure the total resistance of three different resistors in series and in parallel (220 Ω, 820 Ω, 4.7 kΩ).

*In a series circuit of resistors:*

**the current is the same for all of the elements.****the total resistance is equal to the sum of the individual resistances:**

R = R_{1}+R_{2}+R_{3}+...**the total resistance is bigger than any of the individual resistances.****for two resistors with identical values the total resistance is the double of the value of one resistor.**

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

*In a parallel circuit of resistors:*

**the voltage is the same for all of the elements.****the total resistance is the reciprocal of the sum of the reciprocals of the individual resistances:**

R = 1/(1/R_{1}+1/R_{2}+1/R_{3}+...)

or, the total conductance is equal to the sum of the individual conductance's:

G = G_{1}+G_{2}+G_{3}+....**the total resistance is always less than the value of the smallest resistance.****for two resistors with identical values the total resistance is the half of the value of one resistor.**

**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).**

More about components in series or parallel in the wiki of series and parallel circuits!

- Calculate the total resistance of the circuit.

Tip: Begin always with the first basic circuit you see and calculate the equivalent resistor. Replace the basic circuit with it's equivalent resistor (in thoughts). Then you get a new basic circuit and so on. Build the circuit (photo) and control the result with an ohmmeter. - Derive a simple formula to calculate the total resistance for 2 resistors in parallel (find a common denominator).
- Derive a simple formula for
`n`

same resistors in series. - Derive a simple formula for
`n`

same resistors in parallel.

- Draw by hand a complete circuit diagram (including the source) of 3 resistors (R
_{1}= 220 Ω, R_{2}= 820 Ω, R_{3}= 4.7 kΩ) in series and including the source. The total voltage of our circuit will be 5 V. Don't forget to add all the voltage (4) and current (1) arrows to your circuit. - Calculate the current and the three voltages with Ohm's law.
- Measure all voltages and the current.
- Derive a formula to calculate the total voltage from the partial voltages in a series circuit of resistors by using the resistance formula and Ohm's law.
- Derive a formula to calculate the ratio of two voltages in a series circuit
`U`

using Ohm's law._{m}/U_{n}=f(R_{m},R_{n}) - Calculate
`U`

._{total}/U_{1}, U_{total}/U_{2}, U_{total}/U_{3}, R_{total}/R_{1}, R_{total}/R_{2}and R_{total}/R_{3}

- Draw by hand a complete circuit diagram (including the source) of 3 resistors (R
_{1}= 220 Ω, R_{2}= 820 Ω, R_{3}= 4.7 kΩ) in parallel. The total voltage of our circuit will be 5 V. Don't forget to a add all the voltage (1) and current (4) arrows to your circuit. - Calculate the four currents with Ohm's law.
- Measure all the currents.
- Derive a formula to calculate the total current from the branch currents in a parallel circuit of resistors by using the resistance formula and Ohm's law.
- Derive a formula to calculate the ratio of two currents in a parallel circuit
`I`

using Ohm's law._{m}/I_{n}=f(R_{m},R_{n}) - Calculate
`I`

._{total}/I_{1}, I_{total}/I_{2}and I_{total}/I_{3}

*In a series circuit of resistors:*

**the current is the same for all of the elements.****the total voltage is the sum of all partial voltages.****the total voltage is the highest voltage.****the ratio of two voltages equates the ratio of the corresponding resistors.**

*In a parallel circuit of resistors:*

**the voltage is the same for all of the elements.****the total current is the sum of all branch currents.****the total current is the highest current.****the ratio of two currents equates the inverse ratio of the corresponding resistors.**

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

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

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.

From wikipedia:

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

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.**

From Wikipedia:

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

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.**

or**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.**

Look at the circuit of the following example. The first step is to simplify the circuit To get less equations all resistances in series or parallel are substituted with their total resistance. This is done here with R

_{1}and R_{4}.The next step is to find the nodes and plot the current arrows (1. law). The directions of our arrows are not relevant. If a current doesn't flow in the direction of the arrow, we get a negative sign for the value of this current in our calculation. If we look at our circuit, we get 2 nodes with the following equations:

`-I`

_{1}+ I_{2}+ I_{3}= 0

`(I`

_{1}- I_{2}- I_{3}= 0)

It's not difficult to see that both equations are the same, so one of them is obsolete!

**In a network with**`m`

nodes, we get`m-1`

linearly independent equations for the currents!For the second law we define the directions of our loops and the directions of our voltage arrows. As for the currents they are arbitrary, but it is a good idea to choose the same direction for a voltage on a load as the current passing the load. All voltage directions matching the loop direction are counted e.g. positively and the other voltages negatively. For our example we get two loops, so 2 equations:

`M1: 1.5V - U`

_{14}- U_{2}+ 3V = 0

`M2: -3V + U`

_{2}+ 1.5V - U_{3}= 0

**In a network with**`m`

nodes and`n`

closed loops, we get`m+n-1`

linearly independent equations!

So in our example (m = n = 2) we get 4-1=3 linearly independent equations. This allows us to calculate all 3 unknown currents!

Click to enlarge!

- Calculate all currents and voltages of the following circuit. Simplify the circuit and then draw it by hand with all the currents and voltages.

- Control the results by simulating the circuit with multisim live https://www.multisim.com/. Document the screen.

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.

In our circuit we draw no current (load: R_{L}=∞ Ω), so we get 2 resistors in series (only one current I, U=U_{total}=U_{1}+U_{2}, U_{out}=U_{2}):

To save power voltage dividers should if possible (see voltage divider with load) use resistors in the range of 10k Ω to 100k Ω (I less than 1 mA).

- Sensors often work with 5 V. Our ESP32 is not 5 V tolerant on its pins. We need 3.3 V if we connect a sensor, and this is done by using a voltage divider. The overall current should be 0.1 mA. Calculate the needed resistors to built the voltage divider. Choose resistors from the E-12 series and recalculate the real current and output voltage.
- Build the circuit and measure the real current and the voltages.
- In reality the ESP32 draws a certain current. Find this current in the ESP32 data sheet. Calculate the input resistance of an input the ESP32 if we use an input pin.
- Considering the input resistance of the pin, draw by hand! a new voltage devider circuit with load (inclusive voltage and current arrows) and calculate the new output voltage U
_{out}'. What is your conclusion? - If we use an internal pull down resistor (next chapter), the input resistance of the ESP32 pin drops to 45 kΩ. Calculate the new output voltage U
_{out}'' and overall current I'' when using an internal pull down resistor. What conclusions can we draw from this? - Look for a way to make this voltage divider (with 45 kΩ load) work and document it. Tipp: the overall current may change!

- Red Light Emitting Diodes (LED's) need a voltage of about 1.8 V, but are powered often with 3.3V or 5V. A series resistance is used to limit the current through the diode, respectively to reduce the voltage on the diode. We have a voltage divider with one non-linear resistor (the LED). Look at the schematic of our ESP32 MH-ET-LIVE (google) and find the LED's with their corresponding resistors. Note the resistances.
- Measure the voltages on the red LED and his series resistor on your ESP board. Measure the series resistor (ohmmeter without powering the board!) and calculate the current through the LED. Be cautious to not damage the board.
- Draw by hand! the circuit for the red diode. Research the symbol (DIN norm!) of an LED in the net. Diodes are polarized! The symbol shows the direction of the current. Add all voltages and the current (values and arrows).
- Write a little Arduino program (and document it) to power the blue LED on your ESP32 MH-ET-LIVE. Measure the voltages on the blue LED and her series resistor on your ESP board. Measure the series resistor (ohmmeter without powering the board!) and calculate the current through the LED.

Ass seen in our exercise, the load has to be high impedance to allow a voltage divider to work. The current through R_{2} must nearly be the same as I if we want to keep a series circuit where the voltages are proportional to the resistances. The current drawn from the circuit must be small versus I. 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·I`

_{L}

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

- Calculate the output voltage of the following voltage divider without load:
`U=5V, R`

._{1}=2.2kΩ, R_{2}=3.3kΩ - What error (in percent) do we get for our output voltage if we add a load respecting our rule of thumb at it's limit:
`I = 10·I`

?_{L}

Tip: In a parallel circuit of resistors the ratio of two currents equates the inverse ratio of the corresponding resistors.

The potentiometer is an adjustable voltage divider! The value of the potentiometer (R_{1}+R_{2}) defines the current.

**Warning:**

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.

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:

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.

Test the following magic program :) with your Arduino Uno or Teensy 2.0. The input pin (digital 0) is floating (nothing attached) and an LED with series resistor is connected to digital pin 1. Describe in detail your observations. What could be the cause of this behaviour?

`// iot_jdi_K9_floating_pin.ino // weigu.lu // Input pin is floating; LED with series resistor on output pin const byte PIN_INPUT = 0; // digital pin 0 as input const byte PIN_LED = 1; // digital pin 1 as output (LED) bool pb_state = 0; void setup() { pinMode(PIN_INPUT, INPUT); pinMode(PIN_LED, OUTPUT); } void loop() { pb_state = digitalRead(PIN_INPUT); digitalWrite(PIN_LED,pb_state); }`

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.

**Positive logic with external 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 fulfil our rule of thumb (10 kΩ - 100 kΩ).

Draw by hand a circuit with 2 push buttons (1x external pull-up, 1x external pull down) connected to two input pins of a µC and two LED's to two output pins (don't forget the series resistors and note your calculations). The pull-up/down resistors should have 10 kΩ.

Build the circuit (breadboard) and write an Arduino program to light the LEDs individually using the push-buttons. Test the program and note your findings.

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.

Connect two push-buttons to pin 16 and 17 (without external resistors) of your ESP32 and an LED with the correct series resistor to pin 21. The second LED is the blue on board LED on pin 2. Test the following program. Change and document the program, so that the positive logic is used for both push-buttons without changing the setup() function.

`// iot_jdi_K11_pu_pd.ino // weigu.lu // 2 input pins; 2 LED with series resistor on output pins (on board) const byte PIN_INPUT_1 = 16; // digital pin 16 as input const byte PIN_INPUT_2 = 17; // digital pin 17 as input const byte PIN_LED_1 = LED_BUILTIN; // pin 2 as output (onboard LED blue) const byte PIN_LED_2 = 21; // pin 21 out (ext. LED w. resist. 3.3V!) bool pb1_state = 0; bool pb2_state = 0; void setup() { pinMode(PIN_INPUT_1, INPUT_PULLUP); pinMode(PIN_INPUT_2, INPUT_PULLDOWN); pinMode(PIN_LED_1, OUTPUT); pinMode(PIN_LED_2, OUTPUT); } void loop() { pb1_state = digitalRead(PIN_INPUT_1); digitalWrite(PIN_LED_1,pb1_state); pb2_state = digitalRead(PIN_INPUT_2); digitalWrite(PIN_LED_2,pb2_state); }`

**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.**