Basic Wireless Communication for Microcontrollers

Chapter 2 - Design Project 1: Crystal Radio Receiver

AC Circuit Theory

     It is very important to know the difference between how AC and DC interact with circuit elements. In every case here, by AC we mean sinusoidal or very nearly sinusoidal, which holds true for almost all signals in RF work. If we are dealing with a more complex waveform, Fourier analysis would be needed to split it up into sinusoidal components, see how each one behaves, and then add up the results to get the total result (see Appendix 1 for more information).

Resistance

     Resistance behaves exactly the same way for AC as for DC. The current through a resistor is directly proportional to the voltage across it.

Inductance

     Inductance is a property of any piece of conducting material. The origin of inductance is that the current flowing through a wire builds up a magnetic field around it. Energy is stored in this field and when the current changes, some energy must be transfered to or from the field. This happens by the field causing a voltage drop across the conductor while the current is changing. The voltage drop (or back EMF) will be proportional to the derivative of the current change over time, and the sign of the voltage will be such as to try to resist the change in current. In other words, inductance has the effect of resisting changes in current, just as a resistor resists even a steady current.
     The constant of proportionality between voltage and the derivative of current is called the inductance of the component, symbolized by L: V=L*-dV/dt, with the minus sign indicating the fact that the voltage is opposing the change in current. Even just a straigt piece of wire has an inductance, but inductance can be greatly increased by coiling the wire up so that the B field generated by it is more concentrated. In addition, the use of a core material to fill the space around which the wire is wound can increase the B field even more if it has a relative permeability greater than one.
     Air-core inductors have an inductance given by L=(d^2*n^2)/(18*d+40*l) where L is in microHenries, d is coil diameter in inches, l is coil length in inches, and n is the number of turns. Core materials shaped as rods or plates are often specified by their Al value (or inductance per 100 turns). Using this standard, the inductance would be L=(Al*n^2)/10000 with L in microHenries, Al in microHenries per 100 turns, and n being the number of turns. Toroidal cores are doughnut-shaped and allow an even further increased B field due to the fact that they are shaped so that the rings of magnetic field lines remain inside the doughnut and do not "leak" out the ends as in a straight coil. Toroidal cores are also usually specified by their Al value, so the formula given above for straight (or solenoidal) cores can also be used for Toroidal ones. Note that in all cases, inductance is proportional to the square of the number of turns, because more turns produces more B field AND it also allows the changing B field to induce more voltage in the coil.
     When working with sinusoidally-varying current flow, energy is alternately added and subtracted from the B field around a coil each cycle. The net power transfer (or net power loss) is zero for a perfect inductor. Mathematically, this can be expressed as the current being 90 degrees out of phase with the voltage, with the voltage leading the current (voltage peak comes 90 degrees earlier in the cycle). This allows inductors to limit AC current flow without dissipating power as a resistor would. This effect is known as reactance, symbolized by X. The reactance is still the ratio of the peak voltage to the peak current, so its units are ohms and for an inductor, it can be calculated as X=2*pi*f*L. The units of L are Henries.
     This property allows inductors to pass DC and block high frequency AC. When used in this way, they are referred to as chokes or AC blocking inductors.

Capacitance

     Capacitance is a property that any pair of conductors has. Once again, it is due to a field building up, but this time it is an E field building up between the two conductors. Capacitance is defined by Q=CV, in terms of the amount of charge which gets deposited on each of the two conductors for a given voltage. Placing a dielectric between the capacitor's conductors reduces the E field, but increases capacitance because of the way it is defined (less E field means less voltage for the same charge). Capacitors operate in a way analogous but opposite to the way inductors work.
     Capacitive reactance is X=1/(2*pi*f*C) where the units of C are Farads. For a perfect capacitor, V and I are still 90 deg out of phase and no power is dissipated, but now the current leads the voltage.
     It is less important to know how to calculate the capacitance of some structure because we rarely make our own capacitors while it is common to make our own inductors. However, it is still useful to know so you can estimate the stray capacitance which something may have. For two flat parallel plates, C=0.2248*K*A/d, where C is in picoFarads (pF), K is the dielectric constant of the material between the plates (1 for air or a vacuum), A is the area of one plate in square inches, and d is the distance between the plates in inches. For two parallel wires in air (or a vacuum), the capacitance per inch of wire length (picoFarads per inch) is (0.7065)/ln((D/(2*a))+sqrt((D/(2*a))^2-1)), where D is the distance between the wires and a is the radius of the wires.
     Just as inductors block can AC, capacitors block DC. Since the frequency of DC is truly zero, though, capacitors are more perfect blocks to DC than inductors are to AC. Such capacitors are called "DC blocking capacitors".

Phasor Notation

     The amplitude and phase of an sinusoidal voltage or current can be described by one complex number, called a phasor (yes, pronounced like the Star Trek weapon!) The magnitude of a phasor represents the amplitude and the angle, the phase. Because we are always concerned with the relative phase between two or more quantities and not absolute phase with respect to the phase at some starting time, it doesn't matter whether we take "sinusoidal" to mean a sine or a cosine function, since one is just the other shifted in time.

Impedance

     Using phasor notation, we can combine resistance and reactance into one number called impedance. Impedance is the ratio of the voltage phasor to the current phasor, using standard complex number division (see Appendix 1). Impedance is symbolized by Z, and Z=R+j*X, where X is the total reactance, inductive minus capacitive. The minus sign is due to the fact that the voltage leads for inductance but the current leads for capacitance.

Generalization of DC Formulas and Concepts to AC

     The reason why the concept of impedance and phasors is so valuable is that it allows us to analyze AC circuits using the same rules we use for DC circuits, provided we just substitute Z in for R, use phasors for V and I, and change a couple of constants. Ohm's law stays the same: V=I*Z. Kirchoff's laws (the sum of the currents flowing into and out of a node must be zero and the sum of voltage drops and gains around a loop is zero) stay exactly the same. The only major change is in the equation for power. Instead of being P=I*V as for DC, it changes to P=(1/2)*real(V*conj(I)) in general, and P=(1/2)*|V|*|I| for circuits where V and I are known to be in phase. The (1/2) comes because of the fact that the average value of the product of two sinusoids is (1/2) the product of their magnitudes. The instantaneous power at any moment in time is still P=I*V (where I and V are real numbers, not phasors), but what we are usually concerned with is the average power. The reason for the real() and the conjugation of I is that V and I do not have to be in phase and the power will vary with the cosine of the phase angle between them (at zero degrees, in phase, we get maximum power, and at 90 degrees we get zero, as for a perfect inductor or capacitor which cannot dissipate power). Note that in all these cases, V and I are phasors and their magnitudes represent peak values.
     The DC formulas V^2/R and I^2*R become (1/2)*|V|^2/R and (1/2)*|I|^2*R for phasors. If we are talking about some non-sinusoidal voltage across a resistor or non-sinusoidal current flowing through a resistor, we can still calculate average power by taking the integral of the instantaneous power (P=I*V) over a long period of time. This is equivalent to setting Irms=sqrt(average(I^2)) and Vrms=sqrt(average(V^2)), that is, Irms is the square root of the average of the square of I, and Vrms is defined similarly. RMS stands for root mean square, or the root of the mean of the squared quantity. While RMS works in general for non-sinusoidal signals, it can also work for sinusoidal signals. In that case, Vrms=(sqrt(2)/2)*Vpeak and Irms=(sqrt(2)/2)*Ipeak. Sqrt(2)/2=0.707. We cannot use phasors and impedance for non-sinusoidal signals (without Fourier analysis), but we can use RMS with phasors as long as we have sinsoidal signals. Using RMS, the power formula for sinusoidal signals becomes P=real(VrmsIrms*). This is the same as absorbing the (1/2) factor into V and I since sqrt(2)/2 * sqrt(2)/2 = 2/4 = 1/2. This is not much of a shortcut but rms voltage and current are often mentioned because they allow you to drop the 1/2 factor. In addition, for purely resistive circuits using Vrms and Irms, the power formulas become the same as for DC, so Vrms and Irms are often called DC equivalent values.

Figure 1 - A series resonant circuit

Series Resonant Circuits

     Consider the cirucit in figure 1. The total impedance of the three components is Z=R+j*(Xl-Xc). Because Xl and Xc vary with frequency, the impedance of the circuit varies with frequency. There is one point where Xl=Xc and Z becomes only resistive and equal to R. This condition is known as "series resonance" and the magnitude of Z is lowest at this point. At series resonance, the current flowing through the circuit produces voltage drops across all three components. The voltage drop across the inductor, however, exactly cancels that across the capacitor, so the only remaining voltage is that across the resistor. This can result in very high voltages being generated across L and C while the signal generator is providing a much smaller input voltage. The term resonance is used because during one half the cycle, the inductor is absorbing power and the capacitor is giving back power. The opposite happens during the other half. The exchange of power between the inductor and capacitor creates the voltage cancelation. If the capacitor were not there, for example, the inductor would still not dissipate power, it would alternate between abosorbing power and giving it back. However, when it absorbed or gave up stored power that would be transferred to or from the power source, rather than being exchanged with the capacitor, resulting in large voltage swings at the input terminals.
     The resonant frequency for a series resonant circuit can be computed by f=1/(2*pi*sqrt(L*C)), which is just setting 2*pi*f*L=1/(2*pi*f*C) and solving for f.

Figure 2 - A parallel resonant circuit

Parallel Resonant Circuits

     The circuit of figure 2 shows three components (a resistor, capacitor, and an inductor) in parallel. Using the standard formula for three impedances in parallel (which we can just "lift" from DC theory as long as we use impedances and phasors), the total circuit impedance from end to end is Z=1/( 1/R + 1/(j*Xl) + 1/(-j*Xc)). We can see from this that Z becomes purely resistive and equal to R when Xl=Xc, just as for the series resonant circuit. The difference, however, is that at this resonant point (called parallel resonance), the magnitude of Z is the largest it can be, rather than the smallest. At parallel resonance, L and C exchange energy just as in series resonance. This time, however, this circuit will continue to resonate for some time after you disconnect the signal source, since there is a complete circuit path even when nothing is attached to it. The oscillation will eventually die out due to the losses in the resistor, which continuously robs energy from L and C. Because of this "flywheel" action, this is often called a flywheel or tank circuit (tank because it stores up energy in the form of an oscillating voltage and current). The formula for the resonant frequency of series resonant circuits can also be used to find the resonant frequency of this circuit.
     In real circuits, Rp is often not an intended part of the circuit but really represents losses in both L and C. Inductor losses usually dominate over capacitor losses, so Rp is usually associated with L alone. The losses in an inductor really come from series resistance, which we can call Rs. To represent most real parallel resonant circuits, there should be no Rp and instead be a resistor (Rs) in series with the inductor. If you work out the math for such a circuit, you will find that the resonant frequency actually depends on Rs if Rs is greater than 1/10th of the series resonant value of Xl or Xc (which are the same). The dependence is not that strong unless Rs becomes comparable to Xl or Xc and usually we neglect it and assume that the resonant frequency is when Xl=Xc and compute it as given above.
     At any particular frequency, an inductor with a series resistor Rs has an equivalent circuit as an inductor with a parallel resistor (Rp). Rp depends on frequency and Rp=Xl^2/Rs+Rs, which is essentially just Xl^2/Rs if Rs is much less than Xl. The inductive reactance changes, too, and is given by Xl'=Xl+Rs^2/Xl. For cases where Rs is much less than Xl, this is essentially just Xl'=Xl. This allows us to convert the real circuit (with Rs in series with L) into the one we originally analized, with Rp and no Rs. As long as we are only concerned with a small frequency range around the resonant point(or around any point where we calculate Rp and Xl'), this conversion is valid and is useful because such a circuit is much easier to analyze that the series/parallel combination with L,C,and Rs. Also, we can see at a glance what Z is at resonance, it is just equal to Rp.
     The relevance of resonant circuits in general will become apparent in the next two sections where we talk about impedance matching and basic filtering.

Q (Quality Factor)

     If you made any graphs of the magnitude of Z versus frequency for the two types of resonant circuits (series and parallel) described above, you would see that the sharpness of the peak (for parallel) or dip (for series) in |Z| versus frequency depends on how much resistance there is in the circuit. Let's normalize |Z| so that the maximum (parallel) or minimum (series) value is 1. Now, we can mark off the points on either side of the resonant point where |Z| has changed by a factor of sqrt(2) (1.414, 1.414 times greater in the case of series resonance, 1.414 times less in the case of parallel resonance). The distance between these points, in frequency, is called the "-3dB resonant bandwidth". The reason for this will become clearer when we talk about basic filtering, but for now just know that it is the point where the filter power response drops off by 1/2 when these circuits are used as filtering devices.
     This gives us a way to describe the sharpness and pick component values which cause a particular bandwidth. First, we define a quantity Q=f_o/delta_f, where f_o is the resonant frequency and delta_f is the resonant bandwidth. Q stands for quality factor, which is a bit of a misnomer because it is a design parameter which we sometimes want to be high, sometimes low. Q=X_o/Rs and Q=Rp/X_o, where X_o is the reactance of either C or L (they are the same as long as the losses are not extremely high) at resonance and Rs is the R in the series resonant circuit or the series resistor in the parallel resonant circuit. Rp is Rp from the parallel resonant circuit. You can now pick the sharpness of the response according to delta_f=f_o/Q. Because there are several types of quality factors (Q), we will call this one circuit Q.

Real Resistors, Inductors, and Capacitors

     We have already hinted at the fact that real components are not perfect. They are imperfect not only in the sense that they are lossy, but also because they are not always what they say they are. Any component exhibits some resistance, capacitance, and inductance. So, a capacitor or an inductor, for example, is really a full RLC combination. If we are talking about an inductor, then R and C will of course be very smal and the inductive behavior will dominate over a wide frequency range, but for a complete model, or even a reasonably faithful model, they must not be neglected.

Resistors

     Typical resistors look like a resistor with some inductance in series and a capacitor in parallel. This means that at very high frequencies the resistor will exhibit some kind of resonance where it may appear capacitive or inductive instead of a pure resistance. Probably a good general guideline would be that through-hole resistors are good up to around 100 or 200MHz, standard surface-mount resistors can be used to about 1 or 2 GHz, and special resistors would be required above that.

Inductors

     Inductors exhibit parasitic capacitance between each turn as well as wire resistance. The wire resistance increases with frequency because of the skin effect. The increase is insignificant below a certain cutoff frequency and then increases with the square root of f. The net effect is that inductors act like a parallel resonant circuit with a small resistor in series with the perfect inductor inside the model. This means that they have a self-resonant frequency (SRF) above which they look like a capacitor and their reactance begins to decrease with frequency. For inductors, we can also define another type of Q factor, called the component Q factor. This Q=Xl/R, where Xl is the inductive reactance of the component at any frequency below its SRF and R is the real part of the component impedance at that frequency. This Q is a true quality factor because it tells you how lossy the inductor is, which limits its use in circuits which require a high circuit Q.
     Because inductive reactance increases with frequency below the SRF, the Q of an inductor rises with frequency until a certain point near self resonance where the combined skin effect and self resonance raise R much more quickly than Xl. Inductors, therefore, have a frequency range of optimum component Q and are poor above and below that. Inductor Q can be increased by using larger diameter wire and spacing the turns approximately one wire diameter apart, while keeping the ratio of coil length to diameter approximately 1. The SRF of typical inexpensive inductors is about 250 MHz divided by the inductance in microhenries, which tells us that some care is needed to achieve an inductive reactance higher than about 1600 ohms. These same cheap inductors usually have a guaranteed minimum Q of about 50 (this is the lowest Q it can have at some particular specified test frequency). Unlike most components, you can typically hand-wind a much better inductor than you can buy from most electronics distributors because their emphasis is on small size and low cost.
     Air core inductors have the highest Q (they can achieve about 400), although the Q factor of well designed ferrite core inductors can be as high as 250 or so, as ferrite has the lowest loss of the high permeability materials. The losses in iron, powdered iron, or ferrite (a type of ceramic-like iron compound) core inductors are usually dominated by the losses in the core material. When choosing a core material, one should not only keep in mind typical losses, but it is also important to make sure that it will still have reasonably high permeability and low losses at the frequency of interest (the manufacturer will specify the optimum frequency range for a particular material). You must also check, for power inductors and power transformers, that the DC current and AC current will not saturate the core material. There is a maximum B field which a particular core material can handle before it will behave in a highly nonlinear fashon, exhibit increased losses, and possibly even be damaged by cracking or overheating in extreme cases.

Capacitors

     Capacitors also have effective inductance and resistance, and these are all in series. This means that capacitors look inductive above their SRF. Just like inductors, we can define a component Q, Q=Xc/R. This R is sometimes called the effective series resistance (ESR) and can be vitally important well below the SRF when capacitors are used for bypassing (acting as a AC low-impedance to ground). The inductance of through-hole capacitors is usually dominated by the inductance of their leads, so keeping them short is vital to keeping SRF high. This also means that for high frequency circuits, you should use as low a capacitor value as possible while still achieving the desired effect, since lowering the capacitance increases the SRF.
     Capacitor Q decreases with frequency because ESR goes up slightly and Xc goes down. Their internal resistance is typically small enough to allow Q's as high as 1000 at moderate frequencies, so inductive losses are almost always higher. Ceramic and silver-mica capacitors have considerably better Q and higher SRF than types such as aluminum electrolytics, which are not suitable for RF work.

BACK   Table of Contents    NEXT