# Electronics Notes...

## Charge, Current, Voltage

### Conventional Current And Charge

Historically positive charge moves through the circuit from the positive to negative terminals. This is called conventional current. We now know that it is, in fact, the flow of electrons from the negative to positive terminals that is current. Due to the historical precedent, current is still often shown as conventional current.

Current, $i$, is the amount of charge, $q$, that moves through a point in the circuit at any time. $$i = \frac{\mathrm dq}{\mathrm dt}$$ Charge, $q$, is measured in Coulombs. One electron has a charge of $-1.6 \times 10^{-19}$ Coulombs. This is the smallest unit of charge possible.

### Voltage

Voltage, $V$, is the amount of work (in Joules) that must be done per unit charge to move between two points in a field. $$V_{ab} = \frac{\mathrm dw}{\mathrm dq}$$

### Ohm's Law

$$V = iR$$

### Kirchoff's Laws

Two important laws: Kirchoff's voltage law and Kirchoff's current law.

Kirchoff's current law says that the sum of currents flowing into a node must equal the sum of currents leaving a node. This is often expressed in another way: the sum of currents entering a node must always be zero. This works because we label, by convention, all currents entering the node as positive and all currents leaving the node as negative.

Kirchoff's voltage law says that the sum of voltages around a closed circuit must be zero

## Resistance

### Resistor Colour Codes

In the drawing to the left you can click on the value-boxes to change the colour bands on the resistor to find out the resistance represented by the colour encoding. Note it only shows a 4-band resistor. 5 and 6 colour bands are possible but not shown here.

Note: Sometimes the click event on the canvas doesn't fire... not quite sure why that is. If first click doesn't work, persevere :)

Some popular ways of remembering the resistor colour codes include "Bad Boys Ravish Our Young Girls But Violet Gives Willingly" and my fav, "Bad Booze Rots Our Youg Guts, But Vodka Goes Well".

### Resistor's In Series

Resistors in series can be "collapsed" into an equivalent single resistor with a resistance that is the sum of all the resistances of the individual resistors.

Using Kirchoff's voltage law: $$V_1 + V_2 + V3 - V_s = 0$$ Using $V = iR$ we can substitute in for the individual voltages across each resistor. Note that because this is a closed loop the current though each resistor will be the same (as there is no path in which the current can "split" up). $$iR_1 + iR_2 + iR3 - V_s = 0$$ $$\therefore V_s = iR_1 + iR_2 + iR3$$ Now, $V_s$ can also be re-written using $V = iR$ as $V_s = iR_t$, where $R_t$ is the equivalent, total, resistance of the resistors in series... $$\therefore iR_t = iR_1 + iR_2 + iR3$$ $$\mathbf{\therefore R_t = R_1 + R_2 + R_3}$$

### Resistor's In Parallel

Resistors in parallel can also be "collapsed" into an equivalent single resistor...

Using Kirchoff's current law we can say that $i_t = i_1 + i_2 + i_3$. Using $V = iR$, we can say the following: $$\begin{array}{ccc} V = i_1R_1 & V = i_2R_2 & V = i_3R_3 \\ \therefore i_1 = \frac{V}{R_1} & \therefore i_2 = \frac{V}{R_2} & \therefore i_3 = \frac{V}{R_3} \end{array}$$ Subsituting the above back into $i_t = i_1 + i_2 + i_3$, gives us the following. $$i_t = \frac{V}{R_1} + \frac{V}{R_2} + \frac{V}{R_3}$$ And, of course, $i_t$ can also be re-written, giving the solution: $$\frac{V}{R_t} = \frac{V}{R_1} + \frac{V}{R_2} + \frac{V}{R_3}$$ $$\mathbf{\therefore \frac{1}{R_t} = \frac{1}{R_1} + \frac{1}{R_2} + \frac{1}{R_3}}$$

### Voltage Divider

Using Ohm's law we know the following. $$V_1 = iR_1 \implies i = \frac{V_1}{R_1}$$ $$V_2 = iR_2 \implies i = \frac{V_2}{R_2}$$ Using Kirchoff's voltage law, and substituting in the above, we know that, \begin{align} V_t & = V_1 + V_2 \\ & = iR_1 + iR_2 \\ & = i(R_1 + R_2) \end{align} This means that we can say, $$i = \frac{V_t}{R_t} = \frac{V_1}{R_1} = \frac{V_2}{R_2}$$ Substituting $i = \frac{V_1}{R_1}$ into $V_t = i(R_1 + R_2)$ gives... $$V_t = \frac{V_1}{R_1}(R_1+R_2)$$ $$\mathbf{\therefore V_1 = V_t \times \frac{R_1}{R_1+R_2}}$$ Substituting $i = \frac{V_2}{R_2}$ into $V_t = i(R_1 + R_2)$ gives... $$V_t = \frac{V_2}{R_2}(R_1+R_2)$$ $$\mathbf{\therefore V_2 = V_t \times \frac{R_2}{R_1+R_2}}$$ In words, we can say that the voltage across the second resistor is proportional to the ratio of the second resistance to the total resistance.

One issue to be aware of is that any load placed across $R_2$, i.e., in parallel with $R_2$, will change the effective resistance of that node (remember resistors in parallel can be "collapsed" into an equivalent single resistor). Therefore, be aware that the load across $R_2$ will also influence the ratio of voltage division.

### Current Divider

$$i_tR_t = i_1R_1$$ \begin{align} i_1 & = \frac{i_tR_1}{R_1} \\ & = \frac{\frac{R_1R_2}{R_1+R_2}}{R_1} \times i_t \\ & = \frac{R_2}{R_1+R_2} \times i_t \end{align}

### The Wheatstone Bridge

The Wheatstone Bridge is a circuit for measuring resistance very accurately. This material is based on the link to the Texas Instrument tutorial...

Using Kirchoff's voltage law around the loop consisting of $R_2$, $V_{out}$ and $R_4$ we get the following. $$-V_2 + V_{out} + V_4 = 0$$ $$\therefore V_{out} = V_2 - V_4$$ We can find the voltage across $R_2$ and $R_4$ by using the formula for voltage dividers: $R_1$ and $R_2$ are one voltage divider and $R_3$ and $R_4$ are the other voltage divider. Using the voltage divider formula we get the following two results: $$V_2 = \frac{R_2}{R_1+R_2} \times V_t, \qquad V_4 = \frac{R_4}{R_3+R_4} \times V_t$$ Here $V_t$ is the supply voltage. Substituting these into the first formula we get... \begin{align} V_{out} & = \left(\frac{R_2}{R_1+R_2} \times V_t\right) - \left(\frac{R_4}{R_3+R_4} \times V_t\right) \\ & = \left(\frac{R_2}{R_1+R_2} - \frac{R_4}{R_3+R_4}\right) \times V_t \end{align} If three out of the four resistances are known and the current across the $V_{out}$ branch is zero, the third resistance can be calculated.

Let's say that we don't know the resistance of $R_3$. If we set all the other resistors to be equal so that $R_1 = R_2 = R_4$, then the above formula simplified to the following.... $$V_{out} = \left(\frac{1}{2} - \frac{R_k}{R_u+R_k}\right) \times V_t$$ Where $R_k$ is the known resistance and $R_u$ is the unknown resistance. This assumes that $R_u$ is roughly equal to $R_1$ and that all $R_k$ resistors are very closely matched.

A simple re-arrangement gives us... $$V_{out} = \frac{1}{2} \times V_t - \frac{R_k}{R_u+R_k} \times V_t$$

In the above, $V_{out}$, $V_t$, and $R_k$ are all known. We know $V_{out}$ because we can measure it and the other known parameters are already set apriori. With more simple re-arrangement we get... $$0.5V_t - V_{out} = \frac{R_k}{R_u+R_k} \times V_t$$ $$\therefore \frac{0.5V_t - V_{out}}{V_t} = \frac{R_k}{R_u+R_k}$$ $$\therefore \frac{V_t}{0.5V_t - V_{out}} = \frac{R_u + R_k}{R_k}$$ $$\therefore \frac{V_t \cdot R_k}{0.5V_t - V_{out}} = R_u + R_k$$ $$\therefore \mathbf{R_u = \frac{V_t \cdot R_k}{0.5V_t - V_{out}} - R_k}$$

And now we can calculate the unknown resistance... why is this useful? Because this unknown resistance is our sensor. It could be a thermistor, LDR, or whatever... something that changes resistance due to the thing we're trying to measure.

One thing to note is that the $V_{out}$ of the Wheatstone Bridge is non-linear as the figure to the left shows: $V_{out}$ does not change linearly with changes in the unknown resistance $R_u$! In the figure I just picked pretty arbitrary values for the various knowns.

So... why use this rather complex arrangement to measure an unknown resistance when we could do the same using a simple voltage divider? The answer lies in the sensitivity of the measurement system. This is covered in the next section.