last updated: 2021-10-25
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 (R1=ℓ1/(ϰ·A), R2=ℓ2/(ϰ·A)
), and two wires in parallel with the same length (R1=(ℓ·ρ)/A1, R2=(ℓ·ρ)/A2
)). Find the two formulas for Rtotal-series=f(R1,R2)
and Rtotal-parallel=f(R1,R2)
by using the respective formulas for R1
and R2
from above.In a series circuit of resistors:
In a series circuit of resistors the total resistance is equal to the sum of the individual resistances.
In a parallel circuit of resistors:
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!
n
same resistors in series.n
same resistors in parallel.Um/Un=f(Rm,Rn)
using Ohm's law.Utotal/U1, Utotal/U2 , Utotal/U3, Rtotal/R1, Rtotal/R2 and Rtotal/R3
and comment the result.Im/In=f(Rm,Rn)
using Ohm's law.Itotal/I1, Itotal/I2 and Itotal/I3
, R1/Rtotal, R2/Rtotal and R3/Rtotal and comment the result.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.
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 R1 and R4.
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:
-I1 + I2 + I3 = 0
(I1 - I2 - I3 = 0)
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 - U14 - U2 + 3V = 0
M2: -3V + U2 + 1.5V - U3 = 0
m
nodes and n
closed loops, we get m+n-1
linearly independent equations!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: RL=∞ Ω), so we get 2 resistors in series (only one current I, U=Utotal=U1+U2, Uout=U2):
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).
Ass seen in our exercise, the load has to be high impedance to allow a voltage divider to work. The current through R2 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.
For a voltage divider with load we get the following formulas:
U=5V, R1=2.2kΩ, R2=3.3kΩ
.I = 10·IL
?The potentiometer is an adjustable voltage divider! The value of the potentiometer (R1+R2) 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.
A resistor connected to the positive potential of a source pulls the potential up to this positive potential (VCC) and is called a pull-up resistor.
A resistor connected to GND
or the negative potential of a source pulls the potential down to this negative potential (e.g. GND
) and is called a pull-down resistor.
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 (document the sketch) 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!