# The Resistor

This chapter is designed to lay the groundwork for understanding the more complex topics we'll explore later, such as calculating power usage, determining logic gate resistor values and the pull-up architecture.

If you already know about resistors, feel free to skip. For others that are not that confident, the chapter will provide you with a solid foundation in understanding the basic components that make up electronic circuits that is needed for the course.

We're starting with one of the simplest yet most fundamental components in electronics: the resistor.

## What is a Resistor?

A resistor is an electrical component that resists the flow of electric current. It's a passive component, meaning it doesn't generate power or amplify signals, but rather, it consumes power. Resistors are used in virtually every electronic circuit to control current, divide voltages, and limit the flow of electric charge.

In the schematic it is represented with a jagged line or a rectangle:

Jagged line is the American symbol and the rectangle is the European, other than that they are equivalent.

In the above circuit the resistor is connected to a basic circuit. It is just connected to two leads of a voltage source. It has two "pins" to connect to. The circuit would be equivalend even if we swapped the two pins by rotating the resistor.

## Understanding Ohm's Law

To grasp how resistors work, we must first understand Ohm's Law. Ohm's Law is a fundamental principle in electronics that describes the relationship between voltage (V), current (I), and resistance (R) in an electrical circuit. It's usually expressed as:

`U = I * R`

Where:

- U is the voltage across the resistor (in volts, V),
- I is the current flowing through the resistor (in amperes, A),
- R is the resistance of the resistor (in ohms, Ω).

Ohm's Law tells us that the voltage drop across a resistor is directly proportional to the current flowing through it and the resistor's resistance.

Resistors come in various resistance values, which are usually indicated by colored bands on the resistor's body. These values are measured in ohms (Ω), and common resistors range from just a few ohms to millions of ohms (megaohms, MΩ).

## How Resistors Work

Resistors work by converting electrical energy into heat. When electric current flows through a resistor, some of the energy carried by the current is dissipated as heat, effectively reducing the current. The amount of current that a resistor can reduce depends on its resistance value: the higher the resistance, the more it limits the current.

### Calculating Power

Power P of an electrical circuit is equal to the product of current and voltage. Power is just a measure of energy used per unit time. So if we double the voltage we use double the energy every second. Same works for doubling the current.

`P = U * I`

This applies to the resistor also. U is the voltage from one end of the resistor to another, which is just the voltage drop of the resistor which we learned we can calculate with Ohm's law:

```
U = I * R
I = U / R
```

Putting it together and removing I from the equation:

```
P = U * I
P = U * (U / R)
P = U^2 / R
```

We see here that power is inversly proportional to resistance. This is important and the reason why we will be using high resistance resistors.

If we were thinking just about power we would have 1 gazillion Ohm resistors, but that is not our only concern, but more about that later.

## Practical Applications of Resistors

Resistors are used in a wide range of applications, including:

**Limiting current:**To prevent components from receiving too much current, which could damage them.**Voltage division:**To create a lower voltage from a higher voltage source.**Pull-up and pull-down resistors:**To ensure that inputs to microcontrollers or other digital circuits have a well-defined state when not actively driven.**Biasing:**To set the operating point of active devices like transistors.

In my processor resistors are mainly used for the 1st and 3rd point. Limiting current is used for LEDs and Pull-up resistors are used for logic gates to have well-defined states.

We will go through Pull-up architecture in a later post.

## Ohm's Law in Action

Let's see Ohm's Law in action with a simple circuit simulation. In this simulation, we have resistors of 4 different values to see how it affects the current flowing through the circuit.

Since the first resistor is 10 times smaller than the second one, 10 times larger current goes through it. Second is 10 times smaller than the third which means there is 100x bigger current through the first resistor compared to the third.

The last "resistor" is just a circuit break, that is, the wires are not connected. While that may seam that resistance is infinite, real world is bit more complicated. The air can also conduct electricity, tho it has really large resistance.

## Check your understanding

## Parallel and Series Resistors

We talked about simple resistors, without any other resistors in the mix, but usually that does not work like that. There are a lot of other resistors either in parallel or series which affect the current flow.

Lets examine what happens when we connect them in series, in parallel and in combination.

### Series Configuration

In a series configuration, resistors are connected end-to-end, forming a single path for the current to flow through. The total resistance in a series circuit is the sum of all individual resistances.

`R_total = R1 + R2 + ... + Rn`

**Why?** Let's consider two resistors, R1 and R2, connected in series. Since there is only one path for the current to flow, the same current must pass through both resistors. According to Ohm's Law, the voltage drop across each resistor is proportional to its resistance and the current flowing through it.

`V1 = I * R1`

`V2 = I * R2`

The total voltage drop across the series combination is the sum of the voltage drops across each resistor.

`V_total = V1 + V2 = I * R1 + I * R2 = I * (R1 + R2)`

Rearranging the equation, we find that the total resistance is indeed the sum of the individual resistances.

`R_total = (V_total / I) = R1 + R2`

This concept extends to any number of resistors connected in series.

### Parallel Configuration

In a parallel configuration, resistors are connected at both ends, providing multiple paths for the current to flow. The total resistance in a parallel circuit is less than the smallest individual resistance.

`1/R_total = 1/R1 + 1/R2 + ... + 1/Rn`

**Why?** Let's consider two resistors, R1 and R2, connected in parallel across a voltage source. In this configuration, the voltage drop across both resistors is the same (the source voltage). However, the currents through each resistor are independent and determined by their respective resistances.

`I1 = V / R1`

`I2 = V / R2`

The total current drawn from the source is the sum of the currents through each resistor.

`I_total = I1 + I2 = V / R1 + V / R2 = V * (1/R1 + 1/R2)`

Rearranging the equation, we find that the reciprocal of the total resistance is indeed the sum of the reciprocals of the individual resistances.

`1/R_total = I_total / V = 1/R1 + 1/R2`

This concept extends to any number of resistors connected in parallel.

The parallel configuration provides a lower total resistance because it offers multiple paths for the current to flow. Each resistor contributes to the overall current, effectively reducing the total resistance. In contrast, the series configuration forces the current to flow through a single path, increasing the total resistance.

### Combined Series and Parallel

In real-world circuits, resistors are often combined in both series and parallel configurations, forming more complex networks. To calculate the total resistance in such cases, we can break down the circuit into smaller sections of series and parallel resistors, and then combine their equivalent resistances.

In the above circuit, we have two resistors (100Ω and 300Ω) connected in parallel, and this parallel combination is connected in series with another resistor (200Ω).

To calculate the total resistance, we can think of this circuit as a circuit with two series resistors:

If we knew the resistance of the composite imaginary resistor the calculation would be easy as it is just a resistor series.

So to calculate the total resistance, we first find the equivalent resistance of the parallel combination:

`1/R_parallel = 1/100Ω + 1/300Ω = 1/200Ω`

`R_parallel = 200Ω`

Now, we have a series combination of 200Ω (the parallel equivalent) and 200Ω:

`R_total = R_parallel + 200Ω = 200Ω + 200Ω = 400Ω`

We can combine resistors in any configuration by breaking them down into series and parallel sections and applying the appropriate formulas. This flexibility allows us to design circuits with specific resistance values to meet our desired power and performance requirements.

## Check your understanding

## Why It Matters for the Processor

The power consumption of our processor, and its operational speed, are directly influenced by how resistors are used within the circuit. Lower resistance paths can lead to higher current draw, which increases power consumption but can also speed up certain operations. Conversely, higher resistance paths reduce power consumption but may slow down operations.