# Electronics Notes...

## Charge, Current, Voltage, Power

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

From Wikipedia: Conventional current flows from the positive pole (terminal) to the negative pole. Electrons flow from negative to positive. In a direct current (DC) circuit, current flows in one direction only, and one pole is always negative and the other pole is always positive. In an alternating current (AC) circuit the two poles alternate between negative and positive and the direction of the current (electron flow) reverses periodically..

Informally, current is a flow of electric charge.

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

We can integrate the above to get $I=\frac{Q}{t}$ and therefore $Q=It$.

### Electric Fields, Energy, Work & Voltage

Let's revisit the terms energy, work and power.

Energy is the ability to do work.
Work is the force that must be exerted to move a mass a certain distance.
Power is the rate at which energy is generator/consumed.

#### Energy & Work

Energy is defined as the ability to do work. Work is what transfers energy from one form to another (energy is never destroyed). For example, work can turn potential energy into kinetic energy.

Energy is measured in Joules. 1 Joule is the energy transferred when a force of 1 Newton is applied to an object and moves it through a distance on 1 meter.

Work is defined as... $W=F\cdot \mathrm{\Delta }\text{distance}$

#### Power

Power gives that rate at which energy is used/produced. Power measures how fast the work gets done. Put another way, working faster == more power.

#### Electric Fields

Electric fields are created by charges. The field itself produces an electric force per unit charge, the direction of which is defined as being the force it would exert on a positive test charge [LINK]. $\stackrel{\to }{E}=\frac{\stackrel{\to }{F}}{q}$ The electric field, $\stackrel{\to }{E}$, as defined above, is force per unit charge and is measured in Newtons/Coulomb or Volts/Meter, where $\stackrel{\to }{F}$ is electric force in Newtons and $q$ is charge in Coulombs.

But what is force? It is measured in Newtons, where 1 Newton is the force required to give a 1 kg mass an acceleration of 1 meter per second per second. I.e. $1\text{Newton}=1\text{kg}\cdot /fracm{s}^{2}$. Remember it is the electric field that generates this action-at-a-distance force.

#### Voltage

Voltage, $V$, is the amount of work (in Joules) that must be done per unit charge to move between two points in a, electric field. ${V}_{ab}=\frac{\mathrm{d}w}{\mathrm{d}q}$ I.e. 1 volt is 1 Joule per Coulomb.

If we integrate both sides of the abote w.r.t to charge we get:

Note that voltages are relative, which is why the negative terminal of the battery can be negative - it depends what the reference voltage you are measuring against is - e.g. if ground is midway between the two terminals then they will have voltages -A and +A respectively.

### Energy & Power In Terms Of Current & Voltage

Give these definitions we can see how they are defined for electronics. Using some crude (read incorrect as we're using multiplication not integration to make it seem simpler) we see: $\begin{array}{rl}E& =IVt\\ & =\frac{\mathrm{d}q}{\mathrm{d}t}\cdot \frac{\mathrm{d}w}{\mathrm{d}q}\cdot t\\ & =\frac{\mathrm{d}W}{\mathrm{d}t}\cdot t\\ & =W\end{array}$ So energy is indeed the total work required to move a charge between two points in an electric field. And because $P=IV=\frac{E}{t}$ We can see that electrical power (measured in Watts) is the rate of consumption/generation of electrical energy.

When current flows through a resistor it dissipates power in the form of heat. When it flows through an LED it dissipates power in the form of both heat and light.

Power, measured in watts, is also defined as: $P=IV={I}^{2}R=\frac{{V}^{2}}{R}$

Resistors usually have a power rating (the power they can dissipate) associated with them. This means that if you know the resistor's power rating you can calculate the maximum voltage or current you can put across/through them without breaking the resistor.

Note that electric potential energy is measured with respect to a reference point. In the image below one can see that the voltage either side of the resistor is measured w.r.t ground. Ground is the normal reference point, but any point in a circuit can be used as long as it is used consistently.

Note then, that potential difference, is the difference between to points, each of which has a potential energy w.r.t to a reference. The potential difference is the difference between these two points, but only make sense if the potential of each point is measured w.r.t to the same reference.

### Ohm's Law

Ohm's law gives the relationship between voltage, current and resistance:

$V=IR$

### Passive Sign Convention

See the following references:

1. Sign convention for passive components, Khan Academy.
2. Labeling Voltages, Currents, and Nodes, Ultimate Electronics eBook.

"Passive" describes components that do not create power and do not amplify signals. For example, resistors, capacitors and inductors are passive components because they do not create power and do not amplify signals.

Sometimes a voltage source, like a battery, can be said to be passive because although it creates power it does not amplify signals.

The sign convention for passive components is that the current goes into the positive terminal (terminal with higher V).

When analysing a circuit, as we'll see below when using Kirchhoff's laws, we have to label each component with a voltage and current. The passive sign convention makes sure that when we use Ohm's law, it comes out with the correct sign.

Take the following resistor. If we label the voltage across it as so:

We then know that, using the passive sign convention, that the current must be labelled so that it flows into the positive terminal, like so:

We're clearly talking about conventional current here, by the way.

What it means is that if we labelled either the voltage or the current incorrectly, Ohm's law will give a negative answer, because if we label the current going into the negative terminal, we must consider it to be negative current as it is going in the wrong direction. Why would we label a circuit wrong? Because sometimes in circuit analysis we do not know the polarity of an element, so we just guess, and then if the sign comes out negative we know we labeled the polarity wrong and change the labelling.

The convention to label current as positive when flowing into the + terminal is arbitrary, but it makes a few things work out simply and consistently:

1. First, V-I relationships like the definition of Ohm's Law don't need a minus sign.
2. Second, power consumption is defined correctly with $P=vi$, where $P>0$ for ordinary components which are consuming power like a resistor, and $P<0$ for components which are supplying power like a battery.

Why would incorrectly labelling a branch (i.e., we labelled the terminal that current was going into as negative (-)) require a sign change? Simply because of this convention! If current moving in one direction is positive then moving in the other direction must be negative!

### Kirchhoff's Laws

#### Nodes, Branches and Loops

Branch: A branch represents a single element such as a resistor. I.e., any two terminal element.

Node: A node is the point of connection between 2 or more branches. Every point going into the node, at the node, is at the same potential.

Loop: A loops is any closed path in a circuit. Starts and ends at the same node and does not pass through a node more than once.

#### The Laws...

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

##### KCL

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 and leaving 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.

This can be written most compactly as: $\sum _{j=0}^{n}{I}_{j}=0$

Lets look at the following example [Ref]:

##### KVL

Kirchoff's voltage law says that the sum of voltages around a closed circuit must be zero, where the sign on each voltage is the polarity of the terminal encountered first as the loops is traveled around. Another way of saying it is that one way to assign the +'s and -'s is [Ref]:

1. if the positive (+) side of the voltage is encountered first, assign a positive "+" sign to the voltage across the element.
2. If the negative (-) side of the voltage is encountered first, assign a negative "-" sign to the voltage across the element.

However, for passive components, one might not know apriori how to label the terminals. The choice can be arbitrary, so long as the passive sign convention is used, such that in a loop, because we know current can only flow in one direction, whatever arbitrary direction we decided to think of it as going, if it enters the positive terminal then the result is a positive current, otherwise it is a negative current. We will see an example below.

This can be written most compactly as: $\sum _{j=0}^{n}{V}_{j}=0$

Say, for example, that ${V}_{1}$ is 12V, R2 is $4\mathrm{\Omega }$, R3 is $6\mathrm{\Omega }$, ${V}_{2}$ is 3V and R5 is $1\mathrm{\Omega }$. Then we know $-12+4i+6i-4+i=0$. We can then work out the current in the circuit using KVL by re-arranging the formula.

In this example it was trivial to know, apriori, what direction the current would flow. Sometimes we may not.

Example #1

The following is a simple example from the book "Fundamentals of Electric Circuits", fourth edition. This demonstrates the way that passive components can have their terminals labelled in an "arbitrary" fashion of our choosing (as long as we consistently apply the passive sign convention to know whether current is + or - whilst considering each branch). It stumped me for a while, so I asked, and got some very helpful answers on good old StackOverflow.

Conventional current flow is used, as indicated by the circular arrow. Going around the loop, because the current enters the negative terminal of R2, the current current and voltage must be negative!. See the section "Passive Sign Convention" above.

By Ohms, law $V=iR$, we therefore know that ${v}_{2}=-3i$. Note it is negative!

So, going around the loop we get ${v}_{1}=2i$ and ${v}_{2}=-3i$. Applying KVL gives us, $\begin{array}{rl}-20-{v}_{1}-{v}_{2}& =0\\ \therefore -20-2i+3i& =0\end{array}$ And thus, $i=4\text{A}$, ${v}_{1}=8\text{V}$ and ${v}_{2}=-12\text{V}$.

We know that the voltage drop across ${v}_{2}$ isn't really negative. This means we just labelled the terminals incorrectly, so to fix it, just flip the labels around and we get the correct positive voltage for ${v}_{2}$ :)

Example #2

Another example. In this example we are required to find the voltage supplied by the voltage controlled voltage supply, which provides $2{v}_{0}$ volts. Hence we need to find out what ${v}_{0}$ is.

The power supplies can use the polarities already indicated on them. The resistors we can assign polarities arbitrarily to, but the ones shown are the ones shown in the book's example, so lets use them!

Using KVL: $-12+{v}_{r}+2{v}_{0}-4-{v}_{0}=0$ Where, due to the passive sign convention: Substituting these values in: $-12+4i-12i-4+6i=0\phantom{\rule{0ex}{0ex}}\therefore 2i=16\phantom{\rule{0ex}{0ex}}\therefore i=-8A$ This means that we labelled the current flow in the wrong direction. So, the current is $8A$ is the anti-clockwise direction and the polarity labels on the $6\mathrm{\Omega }$ resistor are switched. ${v}_{o}=6i=6\ast 8=48V$ This means that the voltage controlled power supply is supplying $96$ volts!

## Resistance

Resistors control the current that flows through a part of a circuit, as described by Ohm's Law ($V=IR$). Using the formula one can see that as either resistance increases, current falls, and vice versa.

### 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 Young 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). $i{R}_{1}+i{R}_{2}+iR3-{V}_{s}=0$ $\therefore {V}_{s}=i{R}_{1}+i{R}_{2}+iR3$ Now, ${V}_{s}$ can also be re-written using $V=iR$ as ${V}_{s}=i{R}_{t}$, where ${R}_{t}$ is the equivalent, total, resistance of the resistors in series... $\therefore i{R}_{t}=i{R}_{1}+i{R}_{2}+iR3$ $\therefore {\mathbf{R}}_{\mathbf{t}}\mathbf{=}{\mathbf{R}}_{\mathbf{1}}\mathbf{+}{\mathbf{R}}_{\mathbf{2}}\mathbf{+}{\mathbf{R}}_{\mathbf{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}_{1}{R}_{1}& V={i}_{2}{R}_{2}& V={i}_{3}{R}_{3}\\ \therefore {i}_{1}=\frac{V}{{R}_{1}}& \therefore {i}_{2}=\frac{V}{{R}_{2}}& \therefore {i}_{3}=\frac{V}{{R}_{3}}\end{array}$ Substituting 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}}$ $\therefore \frac{\mathbf{1}}{{\mathbf{R}}_{\mathbf{t}}}\mathbf{=}\frac{\mathbf{1}}{{\mathbf{R}}_{\mathbf{1}}}\mathbf{+}\frac{\mathbf{1}}{{\mathbf{R}}_{\mathbf{2}}}\mathbf{+}\frac{\mathbf{1}}{{\mathbf{R}}_{\mathbf{3}}}$

### Voltage Divider

Using Ohm's law we know the following. ${V}_{1}=i{R}_{1}\phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}i=\frac{{V}_{1}}{{R}_{1}}$ ${V}_{2}=i{R}_{2}\phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}i=\frac{{V}_{2}}{{R}_{2}}$ Using Kirchoff's voltage law, and substituting in the above, we know that, $\begin{array}{rl}{V}_{t}& ={V}_{1}+{V}_{2}\\ & =i{R}_{1}+i{R}_{2}\\ & =i\left({R}_{1}+{R}_{2}\right)\end{array}$ 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\left({R}_{1}+{R}_{2}\right)$ gives... ${V}_{t}=\frac{{V}_{1}}{{R}_{1}}\left({R}_{1}+{R}_{2}\right)$ $\therefore {\mathbf{V}}_{\mathbf{1}}\mathbf{=}{\mathbf{V}}_{\mathbf{t}}×\frac{{\mathbf{R}}_{\mathbf{1}}}{{\mathbf{R}}_{\mathbf{1}}\mathbf{+}{\mathbf{R}}_{\mathbf{2}}}$ Substituting $i=\frac{{V}_{2}}{{R}_{2}}$ into ${V}_{t}=i\left({R}_{1}+{R}_{2}\right)$ gives... ${V}_{t}=\frac{{V}_{2}}{{R}_{2}}\left({R}_{1}+{R}_{2}\right)$ $\therefore {\mathbf{V}}_{\mathbf{2}}\mathbf{=}{\mathbf{V}}_{\mathbf{t}}×\frac{{\mathbf{R}}_{\mathbf{2}}}{{\mathbf{R}}_{\mathbf{1}}\mathbf{+}{\mathbf{R}}_{\mathbf{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}_{t}{R}_{t}={i}_{1}{R}_{1}$ $\begin{array}{rl}{i}_{1}& =\frac{{i}_{t}{R}_{1}}{{R}_{1}}\\ & =\frac{\frac{{R}_{1}{R}_{2}}{{R}_{1}+{R}_{2}}}{{R}_{1}}×{i}_{t}\\ & =\frac{{R}_{2}}{{R}_{1}+{R}_{2}}×{i}_{t}\end{array}$

### 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}}×{V}_{t},\phantom{\rule{2em}{0ex}}{V}_{4}=\frac{{R}_{4}}{{R}_{3}+{R}_{4}}×{V}_{t}$ Here ${V}_{t}$ is the supply voltage. Substituting these into the first formula we get... $\begin{array}{rl}{V}_{out}& =\left(\frac{{R}_{2}}{{R}_{1}+{R}_{2}}×{V}_{t}\right)-\left(\frac{{R}_{4}}{{R}_{3}+{R}_{4}}×{V}_{t}\right)\\ & =\left(\frac{{R}_{2}}{{R}_{1}+{R}_{2}}-\frac{{R}_{4}}{{R}_{3}+{R}_{4}}\right)×{V}_{t}\end{array}$ 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)×{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}×{V}_{t}-\frac{{R}_{k}}{{R}_{u}+{R}_{k}}×{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 a-priori. With more simple re-arrangement we get... $0.5{V}_{t}-{V}_{out}=\frac{{R}_{k}}{{R}_{u}+{R}_{k}}×{V}_{t}$ $\therefore \frac{0.5{V}_{t}-{V}_{out}}{{V}_{t}}=\frac{{R}_{k}}{{R}_{u}+{R}_{k}}$ $\therefore \frac{{V}_{t}}{0.5{V}_{t}-{V}_{out}}=\frac{{R}_{u}+{R}_{k}}{{R}_{k}}$ $\therefore \frac{{V}_{t}\cdot {R}_{k}}{0.5{V}_{t}-{V}_{out}}={R}_{u}+{R}_{k}$ $\therefore {\mathbf{R}}_{\mathbf{u}}\mathbf{=}\frac{{\mathbf{V}}_{\mathbf{t}}\cdot {\mathbf{R}}_{\mathbf{k}}}{\mathbf{0.5}{\mathbf{V}}_{\mathbf{t}}\mathbf{-}{\mathbf{V}}_{\mathbf{out}}}\mathbf{-}{\mathbf{R}}_{\mathbf{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.

## Voltage Sources & Current Sources, Ideal v.s. Real World

### Voltage Sources

An ideal voltage source is one that supplies constant potential, no matter what load is connected to it. I.e., it produces whatever current is necessary to maintain the voltage across it [Ref]:

But, batteries, even power supplies etc etc are not ideal. In the real world they have a small internal resistance, anywhere between approx 0.1 Ω to 2.0 Ω depending on the battery [Ref], which means they are modelled more like this:

It can be seen that because the internal resistance of the battery, is in series with the circuit it is powering, i.e., the load (simulated by the resistor), the combination acts like a voltage divider, and so the voltage across the load varies with its resistance. I.e.,the battery is not ideal (but its pretty close!)

This is why it is always best to measure the voltage across a power supply when it is under load.

We can now also understand that an ideal voltage source is one that has zero internal resistance.

### Current Sources

An ideal current source is one that always produces the same current, no matter how the voltage across it or the resistance of the load it is "feeding" varies, [Ref].

This is why, incidently, in a circuit you cannot have two current sources in series!

### Source Transformations

It is possible to switch out a voltage source in a circuit for a current source and vice-versa using source transformation using Thevenin and Norton equivalent ciruits [Ref].

### Superposition

Circuits can have multiple sources. In this case, to determine voltage levels at nodes, the principle of superposition can be used:

1. Set all sources to zero except one,
2. Solve the necessary currents and voltages using only that source,
3. Repeat the above step for each source
4. Add the circuit values together - "superimpose" them onto one another.

Take the following example [Ref]:

In the above diagram we get: $\begin{array}{rl}{I}_{1}& ={I}_{1}^{\prime }+{I}_{1}^{″}\\ {I}_{2}={I}_{2}^{\prime }+{I}_{2}^{″}\end{array}$

## Switches

Switches are defined by the number of poles and throws they have...

Poles: A switch pole refers to the number of separate circuits that the switch controls.

Throw: The number of throws indicates how many different output connections each switch pole can connect its input to. Think of it as how many places a single source can be "thown to".

## Capacitance

A capacitor consists of two conducting plates separated by an insulator (a.k.a. a dielectric).

When connected to a voltage source, the source creates a positive charge on one plate and a negative one on the other plate:

Charge stored is proportional to applied voltage: $Q=CV\phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}C=\frac{Q}{V}$ Where $C$ is called the capacitance of the capacitor and is measured in Farads (F). Note that $C$ is the constant of proportionality here!

Although, for equations etc., Farads are the expected units, in electronics capacitors in the range of nano-Farads to milli-Farads are used. Even milli-Farads are less common. More common are nano and micro-Farads.

By re-arranging the above we can see that capacitance is the charge per volt that the capacitor can store. Thus, the more charge that the capacitor stores per volt, the higher its capacitance is. This quantity is dependent on the type of dielectric used, the surface area of each plate and the distance between the plates.

Recall that current is the amount of charge that moves past a point per unit time. Thus, by differentiating w.r.t time, the above, we get the current-voltage relationship of a cap: $I=C\frac{\mathrm{d}V}{\mathrm{d}t}$ This gives us in important property of caps. Because for DC current the voltage does not change, $\frac{\mathrm{d}V}{\mathrm{d}t}$ is zero, so a capacitor is an open circuit to DC! (But it does charge). Because of the definition of a derivative, we also know that the voltage across a cap must be smooth - i.e., it cannot change abruptly.

Note that real capacitors dissipate their energy over time - they "leak"

Capacitors resist abrupt changes in voltage, which is why the function as low pass filters.

Example graphs showing voltage across a capacitor whilst charging and current over time:

### Energy And Work

We had previously defined work as $W=QV$, but this assumes a constant voltage and current flow. But, as a capacitor charges the voltage and current change with time. At time $t=0$, the charge stored by the capacitor is zero, and as the capacitor charges, the voltage across it increases too.

Thus, the work required to charge a capacitor, i.e., the work done by the power source, is: $W=\frac{1}{2}QV$ We have also said that $Q=CV$, therefore we can re-write the above as, $W=\frac{1}{2}C{V}^{2}$ And because $V=\frac{Q}{C}$, we can re-write it again as, $W=\frac{1}{2}\frac{{Q}^{2}}{C}$

### Charging Without A Resistor Means Trouble

If a capacitor is charged without a resistor to limit current the circuit will, at the beginning of the charge, be a short circuit. In the diagrams above, a spark will be seen at the switch which will dissipate some of the energy. As we will see below, exactly half of the energy is dissipated in the spark and that the maths kinda fails for this scenario...

Take the following example...

We know the work done by the capacitor when it discharges is defined as follows, giving the following result. $\begin{array}{rl}W& =\frac{1}{2}C{V}^{2}\\ & =\frac{1}{2}\cdot 5\cdot {10}^{-6}\cdot {10}^{2}\\ & =2.5\cdot {10}^{-4}\text{Joules}\end{array}$ We should now be able to plug the value for $W$, and $V$ back into the equation for the work done by the battery, $W=\frac{1}{2}QV$: $2.5\cdot {10}^{-4}=\frac{1}{2}Q\cdot 10\phantom{\rule{0ex}{0ex}}\therefore Q=5\cdot {10}^{-5}\text{Coulombs}$ The two do not agree and the reason is that half of the energy is dissipated at the start by the spark at the switch.

### Charging Through A Resistor

When a capacitor, with a capacitance $C$, charges in series through a resistor of resistance $R$ ohms, in $RC$ seconds it will charge to 63% of the supply voltage and in $5×RC$ seconds it charges to over 99% [Ref]. You get an exponentially decreasing current flow as the resistor draws current from the battery and the capacitor stores the current's flowing charge [Ref].

Recall KVL: the sum of voltages around a closed circuit must be zero. The dotted arrow in the diagram above shows a direction around a closed ciruit, which by KVL means that [Ref]: I.e., the current at time $t$ is proportional to the difference in voltages across the supply and the capacitor, the constant of proportionality being the resistance.

Now a quick aside to derive something we're going to need:

Recall: If we differentiate ${Q}_{c}\left(t\right)=C{V}_{c}\left(t\right)$ w.r.t time, we get: $\frac{\mathrm{d}{Q}_{c}\left(t\right)}{\mathrm{d}t}=C\frac{\mathrm{d}{V}_{c}\left(t\right)}{\mathrm{d}t}$ And we know that $I=\frac{\mathrm{d}Q\left(t\right)}{\mathrm{d}t}$, so we can write: I.e., the current at time $t$ is also proportional to change in voltage across the capacitor, the constant of proportionality being the capacitance.

Now we can continue by substituting $\mathbf{\left(}\mathbf{2}\mathbf{\right)}$ into $\mathbf{\left(}\mathbf{1}\mathbf{\right)}$ to get: ${V}_{s}\left(t\right)-{V}_{c}\left(t\right)=R\cdot C\frac{\mathrm{d}{V}_{c}\left(t\right)}{\mathrm{d}t}$ TODO - FILL REST IN

We end up with: ${V}_{c}\left(t\right)={V}_{s}\left(1-{e}^{\frac{-t}{RC}}\right)$ We can see that as the value of RC increases, the exponential value will decrease, which means that the time it takes to charge the capacitor increases with either, or both of, $R$ and $C$.

When selecting the resistance through which to charge a capacitor consider:

1. Charging time - how quickly do you need it to charge?
2. Capacictor specs - maximum rated currents etc.
3. Power source limitations - maximum current supply can provide.
4. Steady state current - don't want too large a voltage drop over in-series resistor so that charging is efficient but not so small that current is excessive.

In-series resistor could be anywhere between a hundred ohms to a couple of kilohms...

### Reactance

The reactance of a capacitor, ${X}_{C}$, depends on both its capacitance, $C$, and the frequency of the signal applied to it, $f$: ${X}_{C}=\frac{1}{2\pi fC}$

For capacitors thing "ICE": current (I) leads voltage, or E.M.F (E):

### Capacitors In Series

$\frac{1}{{C}_{eq}}=\frac{1}{{C}_{1}}+\frac{1}{{C}_{2}}+\cdots +\frac{1}{{C}_{n}}$

### Capacitors In Parallel

${C}_{eq}={C}_{1}+{C}_{2}+\cdots +{C}_{n}$

### Reactance

The opposition to the flow of alternating current due to capacitance is called "capacitive reactance.". In capacitors, the current leads voltage by 90 degrees. Resistance is measure using real numbers but reactance is measured in the complex plane.

When a capacitor is uncharged, the voltage across it is zero. The increasing voltage from the AC supply will therefore, at the start, deliver the maximum amount of current. As the voltage across the capacitor grows in opposition to the supply, the current flow will decrease. Therefore at the start there must be minimum voltage across the capacitor, bu maximum current flow from the battery. Because the AC voltage is sinusoidal, this means that the current and voltage must be 90 degrees out of phase and the current leads the voltage.

We know $V=iR$, so, of course, $R=\frac{V}{i}$ Given the above reasoning we know that voltage across the capacitor must be a sine wave and therefore current must be a cosine. We also saw the equation for current in a section above: $i=C\frac{\mathrm{d}V}{\mathrm{d}t}$ Therefore we can say that, if the input voltage is is $\mathrm{sin}\left(\omega t\right)$, then: $i=C\omega \mathrm{cos}\left(\omega t\right)$ Therefore, using Ohm's law. $R=\frac{\mathrm{sin}\left(\omega t\right)}{C\omega \mathrm{cos}\left(\omega t\right)}$ So, what's a sine divided a cosine? We can avoid some maths by recalling that multiplying by $j$ rotates a complex number by 90 degrees anticlockwise and how the sine and cosine can be seen as the values of a phasor on the imaginary and real axes respectively:

So, to eliminate the sinusoids, we could express sine as a rot

### Decoupling Capacitors

A lot of the capacitors you see in circuits, especially those featuring an integrated circuit, are decoupling. A decoupling capacitor's job is to supress high-frequency noise in power supply signals. They take tiny voltage ripples, which could otherwise be harmful to delicate ICs, out of the voltage supply.

In a way, decoupling capacitors act as a very small, local power supply for ICs ... If the power supply very temporarily drops its voltage (which is actually pretty common, especially when the circuit it's powering is constantly switching its load requirements), a decoupling capacitor can briefly supply power at the correct voltage. ...

The performance of many circuits is impaired by the presence of HF noise on their supplies, so any HF noise which might be present on an IC's supply must be shorted to ground. We cannot use a conductor for this as it will short circuit dc and blow fuses, but a capacitor (usually in the 1-nF to 100-nF range) blocks dc while acting as a short circuit for HF.

1 cm of wire or PC track has ~8 nH inductance (5 Ohms at 100 MHz), which is scarcely a short circuit. A capacitor acting as an HF short circuit must have low lead and PC track inductance, so each supply capacitor must be located very close to the two terminals of the IC it is decoupling. It is also important to choose capacitors with low internal inductance - usually ceramic ones.

## Inductors

An inductor is a coil of wire, sometimes round a feris core, that stores energy in its magnetic field. Its strength depends on the number of turns in the coil and the type of core material and its cross-sectional area.

Inductors oppose the change of current flowing though them. They are measured in "Henrys". The formula below defines inductance, L. Inductance is the voltage generated per unit change in current. $v=L\frac{\mathrm{d}i}{\mathrm{d}t}$ Integrating both sides and re-arranging we can get:

Whilst capacitors are low pass filters, inductors are high pass filters.

An indictor's reactance ${X}_{L}$ at frequency $f$ is given by the following formula: ${X}_{L}=2\pi fL$ Where ${X}_{L}$ is the ractance of the inductor in Ohms, f is the frequency of the signal in Hz and L is the inductance in Henrys.

For inductors think ELI - Voltage leads current, or put another way current lags voltage:

### Inductors In Series

${L}_{\text{eq}}={L}_{1}+{L}_{2}+\cdots +{L}_{n}$

### Inductors In Parallel

$\frac{1}{{L}_{\text{eq}}}=\frac{1}{{L}_{1}}+\frac{1}{{L}_{2}}+\cdots +\frac{1}{{L}_{n}}$ So, for 2 inductors in parallel: ${L}_{\text{eq}}=\frac{{L}_{1}{L}_{2}}{{L}_{1}+{L}_{2}}$

## Inductors & Capacitors Together

See #55: Back to Basics: Tutorial on LC Resonant Circuits. Really good video!

### Current And Voltage Lead And Lag

Inducance, EMF (V) leads current (I). Or current (I) lays EMF (V).
Capacitance, current (I) leads EMF (V).

### Series Resonance

At resonance a series circuit looks like a short circuit.

Resonance occurs when the inductive reactance equals the capacitive reactance: $2\pi fL=\frac{1}{2\pi fC}$ This also means that the phase between the voltage and current will be zero. At resonant frequency the resulting impedance of the LC circuit is ideally zero and it looks like a short circuit.

### Parallel Resonance

At resonance a parallel circuit looks like an open circuit.

## Reistance, Reactance and Impedance

### Reactance

Reactance: Property of opposing current change and is therefore specific to AC power and depends on rate of change, i.e., frequency, of current. Creates 90 degree phase shift between voltage and current. This is unlike resistance that constantly opposes current flow, regardless of change - i.e., is not frequency dependent.

Two types:

1. Inductive reactance: ${X}_{L}=2\pi fL$ Where ${X}_{L}$ is the inductive reactance in ohms, $f$ is frequency in hertz abd $L$ is inductance in Henrys.

So the reactance, or opposition to change in current, increases with signal frequency and/or inductance-value for an inductor.

2. Capacitative reactance: ${X}_{C}=\frac{1}{2\pi fC}$ Where ${X}_{C}$ is the capacitive reactance in ohms, $f$ is frequency in hertz abd $C$ is capactiance in Farads.

So the reactance, or opposition to change in current, decreases with signal frequency and/or capacitance-value for a capacitor.

### Impedance

Impedance is resistance plus reactance (both inductive and capacitative). Imaginary number, where real part is resistance and imaginary part is reactance: $Z=\sqrt{{R}^{2}+{X}_{T}^{2}}=\sqrt{{R}^{2}+\left({X}_{L}-{X}_{C}{\right)}^{2}}$ Where $Z$ is the magnitude of impeadance (ohms) in a series circuit, $R$ is resistance, ${X}_{C}$ is capacitative reactance and ${X}_{L}$ inductive capacitance, ${R}_{T}$ being the sum of both of these. $\theta =\text{arctan}\left(\frac{{X}_{T}}{R}\right)$

## Diodes

Diodes let current flow in one direction, but not the other, and always drop the same voltage across them no matter the src voltage.

Diodes drop the same voltage across them no matter the voltage source rating. So, for example, silicon diode needs about 0.7V to fwd bias, but won't let the voltage drop across it exceed this. So if you don't protect it with a resistor it will allow too much current to flow and potentially overheat!

### Forward and Reverse Voltages - Some Terminology

The forward voltage is the voltage drop across the diode if the voltage at the anode is more positive than the voltage at the cathode (if you connect + to the anode). [I.e., voltage drop when forward biased.] You will be using this value to calculate the power dissipation of the diode and the voltage after the diode. The reverse voltage is the voltage drop across the diode if the voltage at the cathode is more positive than the voltage at the anode (if you connect + to the cathode). [I.e., voltage drop when reverse biased.] This is usually much higher than the forward voltage. As with forward voltage, a current will flow if the connected voltage exceeds this value. This is called a "breakdown". Common diodes are usually destroyed but with Z and Zener diodes this effect is used deliberately.

### Light Emitting Diode (LED)

Lets look at a standard red LED datasheet:

The data sheet shows that we should be putting about 20mA through the LED, with about 2V across it.

That data sheet also shows us that if we reverse bias the LED and put more than 100 micro-amps through it it will break down.

Let's try figuring out some values for a really simple circuit:

### Zener Diode

The circuit symbol is:

Designed to work in reverse bias in order to maintain a certain voltage. Unlike a normal diode, which will not conduct when reverse biased, the Zener diode does, at a very specific breakdown voltage called the Zener voltage, ${V}_{Z}$:

Zener diodes must always be used with a resistor in seriers to limit the current.

A common use is as a voltage regulator:

As the load increases (i.e., the load resistance increases), more of ${V}_{cc}$ will be dropped across it (voltage divider effect). This means that without the Zener, ${T}_{p}$ would rise as less voltage would be dropped across the resister. But, the Zener will "clamp" ${T}_{p}$ to ${V}_{Z}$ volts.

To do this, the zener must sink more current because ${V}_{load}={I}_{load}\cdot {R}_{load}$ and to counteract the increase in ${R}_{load}$ the only thing that can be done is to decrese ${I}_{load}$, which can only be done by sinking more current through the Zener. As seen from the graph above, between its minimum and maximum ratings it can do exactly that!

That that when used this way, if the input voltage is lower than ${V}_{Z}$ then the Zener remains off and so works like an open circuit!!

Be careful with Zener power rating. You must pick a Zener diode to match the voltage/current it is coping with!

When forward biased the Zener just works like a normal diode, but is not really used like this.

For super gorey details on Zeners and TVS devices see TVS/Zener Theory and Design Considerations Handbook.

### Schottky Diode

Much lower "on" voltage required so dissipates less power but has higher leakage current if reverse biased.

## Bipolar Junction Transistors (BJT)

BJT transitors typically come in a TO-92 package, where "TO" stands for "Transitor Outline". The are many TO package types available.

### NPN Transistor in Common Emitter Configuration

NPN transistors consist of two N-type (negatively doped - excess electroncs) silicon "chunks" sandwiching a P-type (positively doped - exess holes or lacking electrons) as shown below. They are current controlled.

By forward biasing the emitter to base junction with even a small current, the transistor's resistance between the emitter and collector quickly decreses, allowing a relatively large current to flow from the emitter to collector. I.e., base current controls current at emitter and collector.

The circuit in its most basic form looks like:

• The base is responsible for initiating transistor action. When a voltage is applied at the base, it gets biased and draws small current which is then used to control large current at the collector and emitter side.
• The base action is considered as an ON-OFF valve which generates current when a proper bias voltage is applied at this terminal.
• The small change at the voltage applied at the base terminal shows a large impact at the output terminals. Actually, base acts as an input and collector acts as an output in NPN transistor.
• In case of silicon transistor emitter-base junction draws voltage around 0.7V when there is no voltage at the base terminal, in order to initiate the electron action and put the transistor in running condition, the base voltage must be greater than 0.7 voltage in case of silicon transistor and 0.3 in case of germanium transistor.

I like this explanation by "Papabravo" on All About Circuits (emphasis mine):

Like a conventional diode the Base-Emitter junction becomes saturated when the voltage difference between the base and the emitter is greater than about 0.7V. It is very difficult to further increase the voltage across the junction because the current increases exponentially for small increases in Vbe. That's the how. The why is related to the behavior of a p-n junction according to the diode equation. If you try to force more than Vbe(sat) across the junction then the device will conduct enough current to destroy itself. That is the principal reason for the base resistor in switching circuits: to limit the base current.

Thus the emitter voltage is effectively fixed by the base voltage as .

The input characteristics:

The output characteristics:

This idealised transistor has horizontal linear regions, which are an approximation of a real transistor (see below). In the linear region, the transitor is acting like a constant current source controlled by the base current ${I}_{B}$!

The above is for an idealised transistor. Below is a scrape of the semtech 2N2222 datasheet, which shows what it is like for a real transistor:

One can see that the amplification isn't linear across the entire range of IB currents. Eye-balling the graph, it looks most linear between 10mA and 16mA...

As another example here is the same curve for the BC54x transitor family:

One might wonder, if the input characteristic shows an expenential increase in ${I}_{B}$ with ${V}_{BE}$, how can amplification with a transistor be even remotely linear. The answer is that the amplification is done in the portion of the intput characteristic curve that is so expenential it can be approximated as linear, and the corresponding region in the output charateristic curve is also approimately linear:

Looking at output is terms of a voltage divider:

The above configuration is called the common emitter configuration and is probably the most widely used [Ref].

The configuration in which the emitter is connected between the collector and base is known as a common emitter configuration. The input circuit is connected between emitter and base, and the output circuit is taken from the collector and emitter. Thus, the emitter is common to both the input and the output circuit, and hence the name is the common emitter configuration.

NPN transistors can typically handle up to about 0.8 A. They will also have a maximum power rating - the average small transistor can only handle about 250mW of heat dissipation. Thus, they are low currentdevices. For large currents MOSFETs are used (later section).

Saturation region is where the maximum collector current flows and the transistor is basically a closed switch from collector to emitter. The collector-emitter voltage (VCE) is relatively low, and the collector current (IC) becomes nearly constant regardless of further increases in base current (IB). Saturation is often desired in switching applications to ensure the transistor is operating in its fully conducting state.

Active mode / region is where there is an almost linear relationship between the terminal currents at the base, collector and emitter. The transistor has some resistance, that is determined by the emitter/base current.

Cut-off region is where the transistor acts like an open switch.

The Khan Achademy has a really really good explanation of saturation, and the following scribble is just a rip of that example:

A common NPN transistor is the 2N2222. Looking at the data sheet [Ref] we can find the following properties:

 Parameter Max Collector-base voltage VCBO 60 V Collector-emitter voltage VCEO 30 V Emitter-base voltage VEBO 5 V Peak collector current 800 mA Peak base current 200mA Total power disipation 500 mW

We can see that this device can handle a maximum of 0.8A though its emitter-collector and only 0.2A at the base. It is however, able to tolerate relatively high voltages, just not high currents, which as we said above, you'd need MOSFETs, or even relays for.

Other useful numbers from the datasheet include:

 Parameter Max VCEsatVoltage from collector-emitter when saturated (i.e fully on) 400mV VBEsatVoltage from base-emitter when saturated (i.e fully on) 1.3V HFE DC current gain @ IC = 0.1 mA; VCE = 10 V @ IC = 1 mA; VCE = 10 V @ IC = 10 mA; VCE = 10 V @ IC = 150 mA; VCE = 1 V @ IC = 150 mA; VCE = 10 V 35 50 75 50 100-300

#### Current Amplification Factor: $\alpha$ & Base Current Amplification Factor: $\beta$

The current gain from Collector (C) to Emitter (E): i.e., the ratio of change in collector current to the change in emitter current when emitter voltage is kept constant: Note that $\alpha$ is always less than 1!. This is because the collector current cannot be greater than the emitter current: KCL: ${i}_{e}={i}_{b}+{i}_{c}$, so therefore, ${i}_{c}={i}_{e}-{i}_{b}$, which means that, because ${i}_{b}\ne 0$, ${i}_{e}>{i}_{c}$.

Ah, it seems $\alpha$ is more relevant to the common base configuration?! Although still useful here because ${I}_{c}=\alpha {I}_{e}$

Ratio of output and input current in CE config: $\beta =\frac{\mathrm{\Delta }{I}_{C}}{\mathrm{\Delta }{I}_{B}}$

The two are related as follows:

And, ${I}_{c}=\beta {I}_{b}$ The current gain can also be referred to as ${h}_{\text{FE}}$, where the $\text{FE}$ subscript stands for "forward-biased emitter".

Some examples, taken verbatim, from electronics-tutorials.ws on the NPN Transitor will help understand why these are useful.

A bipolar NPN transistor has a DC current gain, $\beta$, value of 200. Calculate the base current ${I}_{b}$ required to switch a resistive load of 4mA. ${I}_{B}=\frac{{I}_{C}}{\beta }=\frac{4×{10}^{-3}}{200}=20\mu A$

#### Calculating Resistor Values

##### Example 1

All based on an answer from StackOverflow [Ref].

##### Example 2

In the following example a transistor is being used to drive a load rated at 6V, 500mW.

If the load should dissipate 500mW at 6V, this means that the current through it, and thus the collector current, ${I}_{c}$ can be calculated using $P=VI$, rerranged to $I=\frac{P}{V}$: ${I}_{c}=\frac{P}{V}=\frac{0.5}{6}=83\text{mA}$ If the transistor has a current gain of $\beta =75$ then using the relationship $\beta =\frac{{I}_{c}}{{I}_{b}}$, the base current can be calculated using a rearrangement to ${I}_{b}=\frac{{I}_{c}}{\beta }$: ${I}_{b}=\frac{0.083}{75}=1.1\text{mA}$ Thus, we know that the base current needs to be 1.1mA, so the resistor in series with the base has to limit the current from the 5V supply to this amount.

Because the base must be 0.7V above the emitter (standard for a transistor but look at the datasheet), we know the resistor must frop 4.3V. Thus we can calculate the resistance: $R=\frac{V}{I}=\frac{4.3}{0.0011}=3.9\text{k}\mathrm{\Omega }$ The power dissipation through the transistor can be calculated using the collector-emitter current, as the base-emitter current should be negligable. In this case it is: $P={V}_{ce}{I}_{c}=8mW$ Which should be well within the range that a small transistor can handle.

#### Common Emitter Amplifer

The common emitter amplifier provides voltage gain and moderate current gain [Ref]. It inverts the signal at the input, i.e., it has 180 degree phase change from input to output.

In the above, C1, known as an AC coupling capacitor, removes any DC component from the input signal, so that the voltage divider at Q can set a DC offset to the signal. This is so that the transistor can be biased to the Q-point, which is a point in the middle of its linear region.

C2, known as an AC coupling capacitor, removes the DC component on the output.

C1 and C2 must be configured to provide negligable reactance (AC resistance) at the frequencies of operation.

C3 is a bypass capacitor that helps enable greater levels of AC gain to be achieved because R4 reduces the current gain.

R4 is rather special. This SO post explains it:

If you didn't have an emitter resistor ... then you'll find that temperature effects will be surprisingly high and the desired 6 volts at the collector may drift with temperature a few volts this way and that way.

This is why the originally referenced article describes R4 as providing ... a measure of DC feedback to ensure that the DC conditions within the circuit are maintained ...

Characteristics:

• Voltage gain == Medium
• Current gain == Medium
• Power gain == High
• Input / output phase relationship == 180 degrees
• Input resistance == Medium
• Output resistance == Medium

## Some Examples Bringing Together What We've Seen So Far...

To turn on the PNP transistor, unlike the NPN, where real, i.e not conventional, current flows from the emitter to the base, with the PNP the real current must flow from the base to the emitter.

## Metal Oxide Semiconductor Field Effect Transistor (MOSFET)

N-channel mosfets are also referred to as "nMOS" and P-channel mosefets as "pMOS".

Sometimes you may see a little diode connecting the source to the drain. The diode isn't really there, it is just indicating the polarity of the FET, the idea being you do not connect it so that the imaginary diode is forward biased!

MOSFETs come in the following types:

• N-channel, enhancement mode.
• N-channel, depletion mode.
• P-channel, enhancement mode.
• P-channel, depletion mode.

"Enhancement;" means that a voltage needs to be applied to the gate to "turn it on", whereas "Depletion;" means that a voltage needs to be applied to the gate to "turn it off". N and P type defer to the dopings of the source/drain and body.

The enhancement mode MOSFET symbols use dotted lines to indicate that the channel is "broken" before gate voltage is applied.

• If it is an N-type enhancement mode MOSFET then gate voltage is required to turn it on.
• If it is a P-type enhancement mode MOSFET then gate voltage is required to turn it off.

Depletion mode MOSFET symbols use solid lines to indicate that the channel exists before a voltage is applied to the gate. They are rare in use apparently? For example, LT-spice has no built in deletion mode MOSFET models.

A summary of the various symbols:

An N-type enhacement mode FET's construction is represented in the diagram below:

When a voltage is applied to the gate it acts as a capacitor: no current flows through the gate. But, the accumulation of positive charge at the gate attracks negative charges causes a channel or "wedge" to be "opened" between the source and drain through which current can flow. The current flow starts when the gate voltage exceeds the threshold voltage, ie when ${V}_{\text{gs}}>{V}_{\text{th}}$. Note that this is the voltage from the gate to the source, not just the voltage at the gate ... Therefore, the voltage at the transistor's source can't rise above ${V}_{\text{dd}}-{V}_{\text{th}}$. [Ref].

The input/output characteristics are very similar to the BJTs discussed in the previous section:

The FET has three modes of operation and annoyingly the terminilogy does not match that used for the BJTs so it can be a little confusing:

1. Saturation: In this mode the FET acts as an amplifier. Note this is not the same meaning as saturation in a BJT!!!
2. Ohmic: The FET acts like a (voltage controlled) resistor.
3. Cut-off: The FET acts like an open circuit.

The simples model of a FET is: ${I}_{\text{d}}=k\left({V}_{\text{gs}}-{V}_{\text{th}}{\right)}^{2}$ Where $k$ is a constant representing the particular MOSFETs characteristics, which should be found in the datasheet.

MOSFETs require pull up/pull down resistors because the gate acts as a capacitor, and when the MOSFET is turned off, the current needs somewhere to dissipate, otherwise the gate would just float!

Enhancement mode, N-type needs a pull down:

Generated from electronics_nmos.asc

Generated from electronics_nmos.asc

P types will need a pull up resistor, not showing an example here.

Sometimes a current limiting resistor for the gate is required. Because the gate acts as a a capacitor the current at time $t=0$ can be quite large, so sometimes a current limiting resistor needs to be fitted in front of the gate.

If whatever is driving the gate can supply currents large enough to damage the FET then a gate resistor should be used. it should be positioned to the "right" of the pull up/down resistor so that no voltage divider is created and the gate still receives (most of) the full voltage.

### NMOS and PMOS Pairs In Logic Gates

I stubled across the following whilst reading up on logic gates using MOSFETS:

A further distinction between NFETs and PFETs is that NFETs are good at discharging capacitive loads to Gnd but not too good at charging capacitive loads to Vdd, whereas PFETs are good at charging capacitive loads to Vdd but not too good at discharging capacitive loads to Gnd. [REF].

Put another way, an NMOS gives a strong 0 but a weak 1 and a PMOS gives a strong 1 but a week 0.

Interesting! Thats why there are often complementary P and N types in logic gates that are implemented using MOSFETs. But why are NFETs good at discarghing capacitive loads and PFETs good at charging them? The answer is here.

### MOSFET Drivers

A MOSFET driver IC (like the ICL7667 you mentioned) translates TTL or CMOS logical signals to a higher voltage and higher current, with the goal of rapidly and completely switching the gate of a MOSFET.

An output pin of a microcontroller is usually adequate to drive a small-signal logic level MOSFET, like a 2N7000. However, three issues occur when driving larger MOSFETs:

1. Higher gate capacitance - Digital signals are meant to drive small loads (on the order of 10–100 pF). This is much less than the gate capacitance of many MOSFETs, which can be in the thousands of pF.
2. Higher gate voltage - A 3.3 V or 5 V signal is often not enough. Usually 8–12 V is required to fully turn on the MOSFET.
3. A switching MOSFET can cause a back-current from the gate back to the driving cicruit. MOSFET drivers are designed to handle this back current. (Ref: [Laszlo Balogh Design And Application Guide For High Speed MOSFET Gate Drive Circuits](https://kidbots.com/WEBADD/HYDROGEN_FUEL/slup169.pdf).)

Finally, many MOSFET drivers are designed explicitly for the purpose of controlling a motor with an H-bridge.

## MOSFETs vs BJTs

 Characteristic BJT MOSFET Type of input signal needed to operate Current.Whatever provides the input signal must be able to deliver enough current. Voltage.The voltage neededd to turn on a MOSFET is about 2V, so the input signal needs to be able to provide a voltage greater than this. No current is drawn by the MOSFET - it is said to have a high input impedance. Peculiarities None. Static sensitive and can behave irratically if the gate is left floating. Efficiency High.The BJT does not waste a lot of power (i.e. get hot). Lower. Although rarely a problem, the MOSFET can waste power if it gets hot.

## 555 Timer

### Introduction

The 555 timer can generate single pulses (monostable) or a train of pulses (astable), acting as an oscillator.

The TI LM555 datasheet gives a a good summary of the internals:

With the following pin descriptions.

 Pin No Pin Desc I/O Description 5 Ctrl Voltage I Controls the threshold and trigger levels. It determines the pulse width of the output waveform. An external voltage applied to this pin can also be used to modulate the output waveform 7 Discharge I Open collector output which discharges a capacitor between intervals (in phase with output). It toggles the output from high to low when voltage reaches 2/3 of the supply voltage. 1 GND O 3 Output O 4 Reset I Negative pulse applied to this pin to disable or reset the timer. When not used for reset purposes, it should be connected to VCC to avoid false triggering. 6 Threshold I Compares the voltage applied to the terminal with a reference voltage of 2/3 Vcc. The amplitude of voltage applied to this terminal is responsible for the set state of the flip-flop. 2 Trigger I Responsible for transition of the flip-flop from set to reset. The output of the timer depends on the amplitude of the external trigger pulse applied to this pin. 8 Vcc I

### Monostable

In the monostable mode, the 444 operates as a "one shot" pulse generator...

God bless LT-Spice... below is a sumulation of a 555 in monostable mode. Note, I could have gotten rid of S1 and just used a pluse from V2... I was copying an example with a manual switch and needlessly tried to keep a physical switch in there.

Generated from electronics_555_monostable_1.asc

Generated from electronics_555_monostable_1.plt

• The trigger starts the process: it is pulsed low (falling edge triggered) for a short amount of time to kick things off and turn the output on.
• Capactitor C1 begins to charge.
• The threshold pin compares the voltage applied to the terminal with a reference voltage of 2/3 Vcc.
• When the voltage across C1, i.e., the voltage at the threshold pin, is 2/3 Vcc the output is turned off and the capacitor discharges through the discharge pin.

Going into slightly more detail, looking at the LM555 excerpt above, the trigger resets the flipflop, which turns on the output stage.

At this point the discharge transistor will be an open circuit, so the capacitor connected between ground and the joined threshold and discharge pins can charge through the resistor.

As the capacitor charges to above 2/3 Vcc, the comparitor on the threshold pin signals the flipflop, which turns the output off and turns the transitor at the discharge pin on. Pin 7 goes from high impedance to an open circuit so the capacitor is now connected to ground and discarges immediately.

By the way, the only reason the pulse from the 555 is delayed is because the switch closing, i,e the trigger, is delayed by 0.2ms.

Capactitor C2 is used to suppress noise on the control voltage pin. Resistor R2 is a pullup resistor so that the trigger does not float.

The LTSpice 555 symbol makes for a slightly cumbersome circuit diagram. It is more commonly, and more cleanly, layed out like this:

#### Calculate Output Period

Recall from the capacitance section that When a capacitor, with a capacitance $C$, charges in series through a resistor of resistance $R$ ohms, in $RC$ seconds it will charge to 63% of the supply voltage.

The 555 waits for the capacitor to charge to two thirds, or 66% of the supply voltage. So $RC$ seconds isn't quite accurate. Add 10% to get us approximately from 63% to 66% means the pulse period can be calculated as: ${T}_{\text{pulse}}=1.1\cdot R\cdot C$ So given our resistor and capacitor values from the above example we get: ${T}_{\text{pulse}}=1.1\cdot 5600\cdot 0.0001=616\text{milliseconds}$ From the LTSpice plot the period is 614 milliseconds, so we're pretty darn close! Phew.

### Astable

Generated from electronics_555_astable_circuit.asc

Generated from electronics_555_astable_graph.plt

Above one can see that the system oscillates "by itself". The trigger is "automatic".

• The output stage is initially off because the trigger is high. The discharge transitor on the discharge pin is a closed circuit.
• This means that capacitor C1 can discharge through the resistors R2 into the discharge pin, which is providing a path to ground.
• The trigger and threshold pins "sees" the voltage across C1 and as it falls as the capacitor is discharged. The threshold pin, at this point, won't do anything because it only sets the flipflop, which it already is. It is the trigger pin that, upon hitting 1/3 Vcc, will reset the flipflop. At this point the output does high and the discharge pin becomes high impedance, like an open circuit.
• The capacitor C1 now begins to charge through resistors R1 and R2.
• As the capacitor charges, when it reaches 2/3 Vcc, the threshold pin will set the flipflop, which will turn the output off and open the discharge pin again.
• The process repeats ad infinitum...

The LTSpice 555 symbol makes for a slightly cumbersome circuit diagram. It is more commonly, and more cleanly, layed out like this:

The total resistance R1 + R2 will determine the time it takes for the capacitor to charge. However, when the capacitor discharges, it only discharges through R2.

Recall charge time for a cap to charge to 63% of the voltage across is is $\tau =RC$. So by varying either the resistors or the capacitor the period of the pulse train output on pin 3 can be varied.

The following is a silly little animation of the capacitor discharging through R2. Imagine that the 3 red dots represent the flow of electrons from the negatively charged plate to the positive plate of the capacitor as it discharges. I think normally it would be shown using conventional current flow, but this animation uses actual electron flow. meh.

Wikipedia has a really nice illustration of the components in the 555, which I've copied below and inserted the components outside the chip that we used above to create an astable vibrator. Here, we can see that the switch shown above is really an RS flip flop combined with a transitor.

Each of the components, like the RS flip flop, comparitors and other gates can be further broken down into their transitor/resitor combinations, so the above is just another, slightly more detailed abstraction. The real circuit is far, far more complex when broken down into its "atomic" building blocks!

## Logic Gates

### NAND

#### Using BJTs

Generated from electronics_bjt_nand_gate.asc

Generated from electronics_bjt_nand_gate.plt

For the voltage at the output to be low there must be a path to ground such that all the voltage gets dropped across R3. This can only happen when both transistors are on, which occurs when both bases, inputs A and B, are high. Hence the NAND gate...

#### Using MOSFETs

A little more complicated in the MOSFET world!

## SR Latch

The SR latch has the following symbol:

It has the following states:

## Decibels

Decibels:
• Are a consistent way to compare signal strengths.
• Are a ratio of two power values.
• Uses logarithmic values so large and small ratios alike can be worked with.
• 1 Bel == x10 power gain or loss. Too big for most measurements, hence the decibel (dB) which is x0.1 power gain or loss.

$\text{Power Gain (dB)}=10\mathrm{log}\left(\frac{\text{power}}{\text{reference power}}\right)$ The number of dB is 10 times the number of bels (hence the multiplication by 10 of the log of the power ratio).

If the reference power is 1, then,

 Measured power Gain in dB ... ... 0.001 -30 0.01 -20 0.1 -10 1 0 10 10 100 20 1000 30 ... ...

If the measured signal is 10 time stronger than the reference then the gain is 10 dB. If the measured signal is 100 times stronger than the reference then the gain is 20 dB and so on... I.e., +10dB means x10 power gain.

+10dB means x10 power gain.

Note that the decibels difference between two voltage or currents is: $\text{V Power Gain (dB)}=\mathbf{\text{20}}\mathrm{log}\left(\frac{{\text{V}}_{\text{out}}}{{\text{V}}_{\text{in}}}\right)$ Note the multiply-by-20 as opposed to the multiply-by-10. This is so that a x10 increased in power would be equivalent to adding 10dB and becase power is proportional to the square of the voltage.

### Specific Reference Values

If the value is x dB?, where ? is a letter, ? says *what* the decibel value is relative to. If, for example, the value is x dBm, then because "m" stands for milliwatt (mW), the value is relative to a reference power of 1 mW. Thus, 10 dBm would be q 10 mW gain and so on...

## EMI

See Common Mode Chokes Basics and Applications, by Ahmed Alamin, Associate Product Engineer, Abracon, LLC.

Electromagnetic interference (EMI) corresponds to the unwanted electromagnetic disturbance or noise signal that is introduced in electronic systems by external or internal sources. These sources can be other systems in the vicinity, such as radio transmitters, power grid systems, cell phones, switching power supplies, electrical motors, or even natural sources such as lighting and solar flares -- [Ref].

### Common Mode Chokes

A common mode choke is a passive electromagnetic device that permits the passage of the desired electrical signals through data or power lines while filtering out the unwanted high-frequency noise signal from external sources or other circuits of the system. -- [Ref].