last updated: 12/01/19

- 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 two formulas to calculate this total resistance! 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`

._{total}=f(R_{1},R_{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 Ω resistors 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 (220 Ω, 820 Ω, 4.7 kΩ).
- Calculate and measure the total resistance of the same three resistors in parallel.

*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 here!

- 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 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).
- Find a simple formula for
`n`

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

same resistors in parallel.

- Draw a circuit diagram of 3 resistors (R
_{1}= 220 Ω, R_{2}= 820 Ω, R_{3}= 4.7 kΩ) in series. The total voltage of our circuit will be 5 V. - 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.
- Find 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 a circuit diagram 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. - 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.
- Find 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. 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 (Tip: don't forget to simplify first!):

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

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}):

- 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. Calculate the needed resistors to connect the sensors. The current should be 0.1 mA. Choose resistors from the E-12 series and recalculate the real current and output voltage.
- Build the circuit and measure the real current and voltages.
- In reality the ESP32 draws a certain current. Find this current in the ESP32 data sheet. Calculate the input resistance of the ESP32.
- Considering the input resistance, draw the new 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 drops to 45 kΩ. Calculate the output voltage U
_{out}'' and the current I''. What conclusions can we draw from this? - Look for a way to make this voltage divider work (the current may change) and document it.

- 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 resistors.
- 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 the circuit for the red diode. Research the symbol of an LED in the net. Add all voltages and the current (values and arrows).
- Write a little Arduino program (and document it) to power the blue LED. Measure the voltages on the blue 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.

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·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 load respecting our rule of thumb
`I=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.

```
// 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() {
digitalWrite(LED,digitalRead(Input_pin));
}
```

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 fulfill our rule of thumb (10 kΩ - 100 kΩ).

- Add some lines to your program, to test 2 pins with two LED's. Add an external pull-up of 10 kΩ with push-button to one input pin and an external pull-down (10 kΩ) with push-button to the other pin. Document and test your program.

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. Document and test your program.

```
// 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() {
digitalWrite(LED1,digitalRead(Input_pin1));
digitalWrite(LED2,digitalRead(Input_pin2));
}
```

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