3.1.1 Switches
The main function of switches whether they are large or small is to interrupt or connect a signal current flow.
Poles – The number of switch contact sets that conduct current.
Throw/Way – The number of conducting positions: for single or double, “throw” is used; for three or more, “way” is used.
Momentary – Switch returns to its normal position when released. A spring is usually employed internally to accomplish this.
Open – The switch is in the off position, contacts not conducting.
Closed – The switch is in the on position, contacts conducting; there may be several on positions.
3.1.1.1 Momentary Switches
The simplest switch is the momentary switch.
3.1.1.2 Slide Switches
The point of a slide switch is that it’s not momentary, but stays in the position when you leave it.
3.1.1.3 DIP Switches
The word DIP switch stands for dual in-line parallel in the context of a switch; however, people will say “dual in-line package” as well.
You might be tempted to save the resistors and make the circuit work more intuitively by connecting each switch to +5. When the switch is on, there is a +5 or “1”; when the switch is off there is no signal, so a “0”-WRONG! When the switch is off, you have no idea what is going to happen; this is like an uninitialized variable in C/C++. You must set the voltage yourself, otherwise the system will “float” to whatever. In fact, it might even work until someone waves their hand over the circuit and creates a capacitive coupling to ground! So always complete the design and make sure all digital signals are set by you.
3.1.1.4 Rotary Switches
Rotary switches are used when you want to gate or send a signal from one (or more) sources to one of N possible destinations (old TV sets used to have these rotary switches, for example).
3.1.1.5 A Plethora of Switches
Hall Effect switches that switch or detect magnetic fields.
Mercury switches that turn on/off based on orientation and a floating glob of conductive mercury.
Reed switches that turn on/off based on the application of a magnetic field that effects an internal permanent magnet inside the switch.
Pressure switches that turn on/off based on air pressure or vacuum.
3.1.2 Potentiometers
Potentiometers (POT) are nothing more than variable resistors. Basically, there is a knob or slide on the potentiometer that allows you to adjust the resistance from 0 to the maximum value.
So if a potentiometer is rated at 10K ohms then the resistance between contacts 1 and 3 is always 10K ohms; however, the resistance between contacts 1,2 and 2,3 changes as the potentiometer is adjusted.
As a final note, potentiometers are mechanical and thus have a lifetime; you can’t turn them back and forth an infinite number of times. They are fine for adjustments, but if you used them to constantly change something they would wear out and break. Also they are nothing more than resistors internally, and thus have maximum power dissipation specifications in watt range usually.
3.2 Capacitor Circuits
Governing equation for capacitance is: I = C*dv/dt
This formula states that the current I, measured in amps, flowing in a capacitor is equal to the capacitance C measured in farads times the rate change of voltage measured in volts per second.
Electrolytic-Usually very bulky, very large values for capacitance. Cheap, high leakage, poor temperature stability. Used mostly for power supply filtering and decoupling. Low frequency applications.
Tantalums-High values, more stable, low impedance, reasonable stability. Used for decoupling and low to medium frequency applications. Very expensive.
You must place polarized capacitors in your circuit the correct way or else they will be damaged or may explode.
Surface mount or SMT (surface mount technology) are hard to build with. SMT parts use more advanced technology and thus you can have a 10μf ceramic capacitor in a grain of salt
Capacitors are used a number of ways. In digital circuits they have uses as well, in power de-coupling and interfacing to the real world, for example. But, at the end of the day a capacitor is an energy storage device. You charge the capacitor by applying a voltage, and it stores the charge and then later can generate a voltage.
3.2.1 Capacitor Models
The voltage on a capacitor is the integral or sum of the current over the time divided by the capacitance.
3.2.1.1 Charging
Once the capacitor is charged then it is free to discharge. There is an interesting side effect of this charging process, and that is that capacitors only pass AC, not DC currents. That is, the DC current must be charging for there to be current flow.
So using a capacitor we can strip away the DC component of a signal and simply obtain the change or AC component. For example, say you had an audio signal that was 5-6V, but your amplifier likes signals that vary from 0-1V. You could use an AC coupling capacitor to strip the DC component and only pass that AC; this would result in a signal from 0-1V only.
3.2.2 Capacitors in Series and Parallel
3.2.2.1 Capacitors in Parallel
The equivalent capacitance of a number of capacitors in series is the sum of their individual capacitance.
When placing capacitors in parallel, make sure that they are all placed with the correct polarity if polarized; also make sure they can handle the maximum voltage being applied. One of the specs for a capacitor is the maximum voltage that can be applied, usually anywhere from a few volts to a few hundred, with your typical design capacitors in the 25-50V range. As a rule, always overdesign by a factor of 100%, so if the design needs a capacitor to charge to 25V, be sure to use a 50V capacitor. Even if the capacitor will never see that voltage, running it at a max of 50% its tolerated voltage will increase its lifespan.
3.2.2.2 Capacitors in Series
Capacitance in series is a little more complex to derive, but the results are the same as resistors in parallel (two capacitors):
Ceq = (C1*C2)/(C1+C2)
3.2.3 RC Circuits
RC circuits simply refer to any circuit that has resistive and capacitive elements. To analyze that circuit:
1. How does the RC circuit charge?
2. How does the RC circuit discharge?
3. how do RC circuits respond to different frequencies?
The current Ic must be the same through the resistor as well as the capacitor, os we can write
Ic = C*dv/dt
Ic = (Vi – V)/R
Therefore the modeling equation
C*dv/dt = (vi – V)/R
The equation for V is simply a solution for the above differential equation; if you plug V into the modeling equation along with the derivative of V with respect to t, dv/dt = (-t/r*c)*A*e^(-t/r*c), then you will see that it’s a solution.
As you can see at t=R*C the circuit charges to 63% of the voltage Vi; if you follow this math a little further you come to the result that mathematically at infinity, the circuit charges to 100%, but in practical terms “infinity” is 5 RC time constants, so if you want to know how long an RC circuit will charge, basically t=5*RC is the answer.
5*RC is the generally accepted time that it takes for an RC circuit to charge to 100% in the practical sense.
3.2.4 Low Pass Filters
The previous RC circuit we analyzed was actually a low pass filter. This means that the circuit tends to pass low frequency signals and send to ground high frequency signals.
Forget about charging/discharging math of the RC circuit and simply think of the RC circuit as a frequency filter. As it filters out the higher harmonic sine components of our input signal it destroys the original square wave, and the square wave starts to look like a distorted sine wave.
Decibels are a measure of the RATIO of signals or power. Ratios are used since electronics usually deals with orders of magnitude; for example, you might say the gain or amplification of a signal is 10,000 time the input.
There are two main formulas: One is for power, one is for general signals, but both define decibels in terms of ratios of signals.
All the frequency domain means is that we discuss signals in terms of their frequency rather than their time varying descriptions; in filter analysis this is much more productive.
3.2.5 High Pass Filters
High pass filters are nearly identical to low pass filters except they pass high frequencies rather than low. And amazingly all you do is swap the R and C in a low pass filter and now you have a high pass filter.
3.2.6 POR-Power On Reset Circuits
When you power on your embedded system, most microprocessors and micro controllers have a reset line that must be pulled low or high for a good amount of time. These reset circuits are traditionally called power-on-reset or POR circuits.
3.2.7 Bypass and Power Feed Capacitors
When you have a digital system, it’s potentially switching millions to billions of times a second. The switching action causes “noise” and glitches on the data lines as well as the power lines.
Some rules of thumb: if your circuit is running from 1-10MHz then use .01μF-.1μF caps to bypass each IC with; if your circuit is running from 10-100MHZ then 100pF to .01μF capacitors will do. The bypass capacitors should be monolithic (non-polarized), 50V tolerant, and ceramic. Keep them as close as possible to the power contacts of each IC.
Use .01μF-.1μF for each IC and you will be fine. Additionally, for large ICs that have busses, add a 1.0-10.0μF tantalum cap for power feeding.
3.3 Inductor Circuits
Inductors simply store energy in a magnetic field. They are more commonly found in audio and video circuits or when designing complex filters.
3.3.1 Inductors Model
The inductor works simply by passing a current through the inductor: As the current flows, a magnetic field is generated.
3.4 Diodes
Diodes are semiconductor devices that allow current to flow in one direction, but not the other.
A diode is in either of one of two states: conducting or not conducting. If the diode is conducting then there is a current Id flowing through the diode from anode to cathode and a very small voltage drop over the diode of 0.5-0.7V. No matter how much current you drive through the diode, the forward voltage drop will remain 0.5-0.7V for the most part, so the diode can control the direction of current flow.
3.4.1 Rectifiers
Diodes are used to switch circuit elements on or off, so the first class applications are rectification.
3.4.1.1 Half-Wave Rectification
The half-wave rectifier, during the negative cycle the diode is not forward biased; therefore, the load resistor R1 has 0V across it. However, during the positive half-cycle, the diode conducts (once the forward voltage reaches 0.7 approximately) and a voltage is developed across R1 of V1.
3.4.1.2 Full Wave Rectification
During the positive half cycle of the AC input we get the output, and during the negative half cycle we invert and send the input to the load as well.
The diodes still need their forward conduction voltage of 0.5-0.7V met before they will conduct. The final output voltage will never be as high as the peak values of the input AC voltage; it will always be Vpeak – 0.7V roughly.
3.5 Voltage Regulation Applications
Diodes have the property that their voltage stays nearly constant while their current changes, we can take advantage of this to construct low voltage regulators.
3.5.1 Zener Diodes
Zener Diodes look like normal diodes (maybe a little smaller), but have a slightly different schematic symbol. Zener diodes are actually used in reverse direction rather than forward direction. The resistance of a zener is inversely proportional roughly to the current driven through it. The voltage across it for a small range of currents stays constant.
3.6 Transformers
We have assumed thus far that we have AC input to many of our circuits, but we surely can’t use 120V AC in our circuits, so we must find a way to step this voltage down.
3.6.1 The Step Up/Down Action
Transformer equation
Vout = Vin*N2/N1
If N@/N1 is equal to 1.0 then there is no change to the voltage; if N2/N1>1 then there is a step up; if N2/N1<1 then there is a step down.
If a transformer steps up the voltage then it must step down the current output; you don’t get something for nothing. Many people who are new to transformers think they are perpetual motion devices—they are not; they simply transform power. The amount of power stays the same; just the voltage and current drive change relatively speaking.
3.7 Power Supplies
1. Battery power.
2. Buy a power supply.
3. Use a wall transformer and a voltage regulator circuit to derive the voltage you need.
3.7.1.1 Stage 1: Rectification and Filtering
If you have a AC transformer then the first step is to rectify and filter it.
3.7.1.2 Stage 2: Regulation
Linear Regulators – These are the standard 3-terminal regulators that are used most commonly; they regulate a higher voltage down to a smaller voltage.
Switching Regulators – Switching regulators are more exotic and can either step down a voltage or step it up (and even invert it). These regulators usually come in surface mount packages and are highly efficient.
Charge Pumps – Charge pumps are usually used to generate high voltages from small voltages and are usually DC-DC converters. They have very little current drive and thus are used in applications where very large voltages are needed, but very little current, such as LCD applications.
3.9 Transistor Basics
In general transistors are used for two things; switching and amplification. Switching is more pertinent application in our case; amplification is a secondary concern.
There are two types of transistors NPN and PNP. They look identical physically, but internally they are different inasmuch as the doping of the semiconductor material.
3.9.1 Transistor Properties and Rules
1. The collector voltage must always be greater than the emitter by approximately 0.2V.
2. The base-emitter and base-collector circuits in a transistor act like diodes. The base-emitter diode is forward biased and conducting when the transistor is operating. The base-collector diode is reverse-biased and not conducting.
3. Transistors all have maximum current and voltage ratings. Some of the values of importance are IB (base current), IC (collector current), IE (emitter current). Also there are the voltage VBE (base-emitter), VCE (collector-emitter), and so forth.
4. So long as the collector voltage is greater than the emitter voltage and we don’t exceed any of the voltage maximums, the transistor “action” will occur.
3.11 Clock Generators
Nearly all digital computer systems are synchronous machines; they use a base clock signal and step through logic, programs, and states based on this clock. Computer clocks are from KHz to GHz these days.
We are simply going to use pre-made oscillator systems:
1. Use a crystal with additional caps and inverters to build a clock circuit.
2. Use a single oscillator IC that you apply power to and it outputs a clock signal.
3. Use a programmable timer IC that uses a few passives to set the frequency.
3.11.1 The 555 Timer
The 555 is a standard 8-Pin DIP. It’s not the most accurate thing in the world, but it has a lot of different modes of operation: astable, monoastable, time delay, etc.