Electronics

No public posts in this group. You must register or login and become a subscriber in order to post messages, and view any private posts.

Electronics are part of everyday life and being able to build, modify and repair them is fun and powerful.

Electronics are what make the modern world turn. They are quite literally everywhere now. You own anywhere from several hundred million to several billion transistors between your computers, cell phones, PDAs, TV sets, stereos, car, game consoles, and appliances. Even your dog probably has an electronic microchip implanted in it. If your grandpa has a pacemaker, than he has electronics keeping him alive.

Unfortunately, despite being so ubiquitous relatively few people know how to build an electronic device from scratch. Even fewer work for the massive industries that quite literally manufacture our modern world. Most people seem content to push a button and watch millions of dollars of R&D do their bidding, with no concept of how it works beyond what they can physically see. The complex patterns seen on circuit boards inside computers are but a piece of abstract art that happens to be functional. But not anymore!

This article is here to teach you the basics of electronics and provide a few basic projects for you to practice at.  Create your own unhuman minions and devices and sit back in a satisfied state basking in the glow of your new LED lighting system.

Helpful Resources


  • Falstad Circuit Simulator - It's written in terrible, icky Java, but it's an awesome program. Newbies absolutely MUST go here. Build simple-ish circuits and see what they can do. It's not as powerful as commercial simulators or really all that accurate, but it's quick and drat fun to play with.
  • Dutchforce Electronics Forum - The best electronics forum on the internet probaby. Lots of discussion on projects from the simple to the complex. The community really knows their stuff too!
  • Lessons in Electric Circuits - Free online textbook on the matter. Excellent resource for people just starting out. Explanations are not super-dry and he gives understandable examples. Oh yeah, and the book isn't complete either.
  • Analog Dialogue - Articles from Analog Devices on slightly more advanced topics. Lots of articles on uses for Analog's parts, and some great information.
  • Introduction to DC Circuits - Simple introduction to DC circuits. Pretty quick and dirty explanations.


Projects


For Guitar Hero Wannabes

A good place for kits is Build Your Own Clone (http://www.buildyourownclone.com/) which sells a few overpriced kits which are clones of commercial effects. http://runoffgroove.com is a great site for more original schematics, but they do not sell kits. http://www.tonepad.com is another great site like this. The absolute best resource is http://www.diystompboxes.com/ which has the most active and productive effects building forum available.

http://www.commonsound.com/ mostly guitar/bass related but alot of the projects are able self oscillate and can be used with out either and the Tri-Wave Picogenerator is a great noisemaker.

http://www.generalguitargadgets.com/ kits, layouts, schematics

http://olcircuits.com/ sells kits of RunOffGrooves projects

http://www.home-wrecker.com/ a sister site to RunOffGroove focusing on clones

http://www.geofex.com/ One of the best sites that explain the theory behind what makes effects "tick" schematics, and project ideas too.

http://www.smallbearelec.com/StoreFront.bok electronics supplier dedicated to the parts needed to build effects pedals with carrys some specialized parts that are hard to track down via other sites.

I probably have more I need to sort through my bookmarks.

Where to Buy Components

  • Digikey - Mostly sells massive amounts of components to industry, but they're used to dealing with hobbyists and confused college students too. Excellent service, and they have an amazing catalog of components.
  • Jameco - Hobbyist-geared store. This is what Radio Shack should be! They offer grab bags as well, which is a great way to increase your stock of components quickly for all sorts of little projects.
  • Allied Electronics - Industry-geared site, but with all sorts of goodies.
  • Mouser Electronics - Yet another industry-geared site. They've been around for a long time though, and are pretty well liked by lots of hobbyists.
  • All Electronics - Tons of surplus components at dirt cheap prices. They have all sorts of fantastic sales, well worth watching.
  • Newark - Another industry-geared site, for when you absolutely positively have to spend your hard earned money. Good selection of components.
  • Analog Devices - Very well-respected IC manufacturer. You can order some of their stuff in small quantities from them. Mostly they make sensors, Digital to Analog Converters, Analog to Digital Converters, DSP chips, and power ICs.
  • Microchip - Maker of the famous PIC chips. They make other ICs too. You can order small quantities from them directly as well.
  • Maxim - Makes good power converters and tons of other ICs. Again, you can order small quantities from them directly.
  • SparkFun Electronics - Tons of fun little gizmos, some quite useful. Generally good prices too.
  • Super-Bright LEDs - High Power LEDs in just about every color.


Types of Parts

General terms

  • Schematic - A basic design of a circuit. Think of it as the electronics equivalent of a blueprint. Components are represented symbolically, and wires are represented as straight lines. For reading schematics, I recommend the following readings:
    How To Read A Schematic - Not very good, I might try to write my own guide later. This will do as a primer for now though.
    Lessons in Electric Circuits: Chapter 9 Reference - Pretty much every symbol you'll encounter in electronics and then some.
  • Printed Circuit Board - Commonly used for housing circuits in a highly organized fashion. Used mostly by large companies when mass producing devices, but can now be sensibly made by hobbyists (not recommended for beginners). Often referred to as PCBs. Most electronic devices you buy at a store are made with these, and indeed your computer motherboard is made using a very large PCB. Many 'kit' projects you buy online will come with one of these you solder the components to.
  • Soldering - Basically a form of light welding, using a mix of tin, silver and lead. Often used to make and repair jewelry, it's been adopted by electrical engineers and is used to hold components together and to printed circuit boards. It is possible to desolder components and salvage them as well. Learning to solder is often a first step for budding hobbyists. If you need to learn or just brush up, may we recommend the following guides:
    How to Solder Directly: A Video Guide - Good guide if you can tolerate the narrator.
  • Integrated Circuit - Collection of components (mostly diodes and transistors) that make up a complete electronic circuit in a very small area, usually on a single silicon die. There are ICs out there that do nearly everything you can do to an electronic signal too.
  • DC/Direct Current - Basically, a circuit that is 'DC' has constant or mostly constant characteristics as it runs (ie Voltages and Currents do not change over time relative to ground). Usually used in simple circuits. Batteries provide DC voltage, which remains pretty constant over time, as do most power supplies.
  • AC/Alternating Current - Useful circuits often have voltages and currents that change dramatically over time. The changing currents and voltages are often refered to as 'AC'. This varying voltage (relative to ground) can follow a sine wave pattern, square wave, or various other mathematically-defined waveforms. AC even describes 'random' signals containing informations (ie sound, video, data, etc)! Basically, if the voltage/current changes, it's AC. Digital signals and square waves are generally not defined as AC signals, but it's a nice gray area to argue and lose friends over.


    NOTE: There's often a good overlap between AC and DC in circuits of any complexity. Transistor radios, for instance, have DC characteristics but obviously the circuit must be AC in nature. Therefore, it's imperative to know the ins and outs of both DC and AC. Thankfully, that's not quite as hard as it sounds most of the time.



Passive Components

  • Resistor - The easiest passive component to understand and probably the most common. Rated in resistance, and a tolerance (usually around 5%). Does nothing more than dissipate power as heat, which means any heating element is technically a resistor. Also used for current limiting, dropping voltage, acting as a load, and tons of other useful things. Very, very useful for hobbyists, but tends to be avoided by paid circuit designers (especially for IC design)
  • Capacitor - Second most common passive component. Stores energy through electrostatic means (which means it stores a voltage). When used, it resists changes in voltages. Used primarily for voltage storage and filtering. Rated in terms of Farads and maximum voltage. Also might be polarized so that it will only work in one direction. If that's the case, connecting it the wrong way can destroy the capacitor. Comes in several types, including but not limited to: Electrolytic (polarized), Tantalum (polarized), ceramic, polyester, and micra.
  • Inductor - Less common than capacitors, stores energy magnetically. Whereas capacitors try to resist changes in voltages, inductors try to resist changes in current. Usually found in switching power supplies. Many circuit components have inductive properties as well. Rated in terms of Henries and maximum current in Amperes. Usually a length of wire wrapped around a solid core, can also be a length of wire in a coil (air core).
  • Transformer - Basically two inductors placed in a way so that they share a magnetic field. This means that for AC signals you can increase the voltage or current of the signal at the expense of the other. Commonly used for impedance matching and voltage conversion. Rated in turns ratio (such as 5:1), frequency response, max. voltage, and max. current.
  • Diode - Device which lets current flow in one direction but not in the other. Also conveniently has a fixed voltage drop. Used in power circuits and such. As a rule, silicon diodes have a drop of 0.7V.
  • Zener Diodes - When diodes hit their breakdown region in reverse mode (aka hooking it up backwards), they act as a super stable voltage source. Unfortunately they also tend to, well, break down and die very quickly. Zener diodes are designed to take the strain, and act as super stable voltage sources for power regulators. Rated in breakdown voltage (the voltage drop basically), and max. current before they really die.
  • Light Emitting Diode - Same as a diode, but emits light when it's conudcting current. Has a much higher voltage drop than normal diodes, usually around 2V (depending on the color).


Active Components

NOTE: Active Components typically have many ratings, so they have datasheets that describe them in detail. In most cases, you need the datasheet to know how to best use the component (at least at first).


  • BJT Transistor - The first transistor to really come of it's own. It 'basically' works like a diode-controlled gate. The Base and Emitter sides form a diode, and the Collector and Emitter sides form a current source. As the base and emitter 'diode' current increases, the collector to emitter current increases as a multiple of that current. Perfect for amplifiers and other assorted circuitry, and found in every electronic device of the 80s. Now mostly replaced by MOSFETs today, except in specialized applications.
  • MOSFET - The 'modern' transistor. Similar to a BJT, but instead of a diode it has what amounts to a capacitor. As the voltage across the capacitor (formed between gate and source) increases, the current from the drain to the source increases. Has the advantage of needing effectively zero current on the input, and is much more stable than it's BJT cousins. Found in nearly every electronic device manufactured today.
  • IGBT - Relatively new and specialized transistor, meant for handling high power loads. Used as a switch for very large voltages and currents, usually in a power application. I haven't personally messed with them much.
  • Op-Amp - Family of ICs. Useful in that they can do nearly every type of mathematical function in analog. Used in old analog computers, but today are mostly used for amplification. Found on tons of A/V gear.



Tools

  • Wire Stripper - Strips the insulation off wires. It's simple, you don't need much, but it's super useful if you don't have one already.
  • Solder and Iron - For permanently connecting wires and components together and (more importantly) to printed circuit boards. Weller is a good make of iron, and leaded solder is the best kind to work with (although it's not the healthiest, but whatever). Spend money on a good iron if you haven't. Also helps to have a spare iron. A small iron with small tips works well for this, especially if you want to work with tiny surface mount components.

  • Breadboard - Absolute must-buy for beginners and hobbyists. Basically a prototyping board that lets you connect components temporarily. Spend $10 on one from Radioshack. Larger boards can run up to $50, and some even come with plug-in power supplies. Larger boards let you build more complex circuits.
  • Multimeter - This little gadget lets you read current, voltage, and resistance. Good meters also have continuity testers that beep at you when the leads are shorted, perfect for making sure things are wired up like you think they are. Invaluable testing tool for everything electric. Comes in a bench-sized and handheld varieties (both shown below). Bench meters are much more expensive, but much nicer and better suited for electronics projects. Handheld meters are cheap as dirt and can be carried anywhere. Both work fine for a beginner, but make sure you get a meter with a digital readout (both the examples below have them.

  • Power Supply - Not everything in the world is certain. With a bench-top power supply, you can be sure of having the desired voltage you need to work with. Beats the hell out of using batteries for everything, although batteries are indeed much cheaper.
  • Oscilloscope - Powerful tool that measures voltage over time. Most useful electronics don't have a constant voltage, and debugging those devices with a normal multimeter can prove to be an exercise in frustration, since the meter changes over time and makes accurate measurement impossible. Enter the oscilloscope, which plots out exactly what the voltage is doing over almost any time interval you desire. Comes in analog (cheap) and digital (not-so-cheap) varieties, with the digital being superior in most cases (it lets you freeze frame!). It's a very sophisticated tool, and hard to use at first. Takes about two hours in my experience to learn, less if you know what you are doing. Well worth the money if you do electronics seriously though.
  • Frequency Generator - Most useful signals aren't constant over time, so most circuits have to be calibrated to work with non-constant signals. Enter the frequency generator, which basically makes signals that match certain math functions (sine wave, square wave, sawtooth wave, etc). Useful for lots of circuits, especially some digital circuits.
  • SPICE circuit modeler - Family of computer programs that lets you build circuits and test them. Unfortunately, very few of them are free and of those none of them are very good. The best circuit sims are pretty expensive. If you can obtain them, pSpice is the industry standard, albiet a bit hard to use. I've heard good things about Circuit Maker too, but I don't know if they're still around.


Current

Electricity at it's most basic level is the manipulation of electrons. Those of you who took chemistry in high school probably remember those things, the little yellow balls orbiting the big circular thingie in the middle. Err, I mean the particles orbiting the nucleus of the atom. Electrons are one of the two basic particles that actually carries a charge (proton is the other), and despite being the smallest charge was the first to be discovered. The exact charge of the electron has been quantified accurately enough for practical use, and actually getting the drat things to do something useful is easier than you think.

In dealing with electrons, you're also dealing with electromagnetic fields. You already have plenty of experience with those. Light, for one, is an electromagnetic field. So are radio waves, X-rays, and microwaves you cook your Ramen with. You may know you can use things like fiber optic cables to carry light across long distances. Well, light is just an electromagnetic signal at a very, very high frequency. So you can do the same thing with lower frequencies, aka 'normal' electricity. I'll talk more on frequency later. For now, remember that for lower frequencies (up to Gigahertz ranges, just now getting into Terahertz) you can send an electromagnetic field through a wire. If all that frequency talk doesn't make sense, don't worry. It's only important later.

When you send a signal through a wire, there are two components to it, the electric component and the magnetic component. The magnetic component is easier to understand, so I'll start there. Basically, imagine a giant tube in a loop. Or be lazy and let me draw it for you:





Ok, now inside this loop are little balls. These represent electrons.





In reality, those 'balls' would be extremely small. Think of it more as an 'electron sea' inside that tube. It's actually good at this point to talk about liquid as an analogy for electrons, as it holds up pretty well for basic electronics. Everyone has some familiarity with basic plumbing, but not everyone knows what's going on inside their cell phone. So for now, think of a lot of water molecules in a tube, or something.

Now we want to make these balls move. Alright Einstein, how would you make a bunch of liquid move? That's right, a pump.





Your little electron sea is now moving through the loop. This is exactly what happens in a wire when it's attached to a current source. We represent this in electronics as a little circle with an arrow through it. The wire we represent simply with a line.





This is your first taste of a schematic diagram. I promise you'll see a ton more later. This is also the first time you've seen current.

Current is easy. Think of it as a 'density' measurement. It's the number of electrons passing through a point in a given period of time. Current is measured in units of 'Amperes', or amps for short. An amp is the same as 6.24*10^18 electrons passing through a point in a second. That's a lot of electrons too, so you can get a feeling for how crazy some of the measurements in electronics can get. But anyways, you can now tell your current source to pass an amp of current through the wire.





What does this mean for us now? Well, believe it or not, pushing all that current through that little wire makes a magnetic field. Yes, you have now created an electromagnet, at least in theory. I can go into a whole ton of formulas describing this magnetic field around the wire, but that's beyond what we're trying to do. Just remember, amps means magnetics, which is important when we talk about some later components.

It's also possible to do the reverse. You can take a magnetic field and induce a current. This is exactly how generators work. So generators, from the little Honda you have in your toolshed to giants of industry powering entire cities, are basically current sources. You may have heard of alternating current. This is what generators make (or at least good ones). You deal with current in other ways in your life, but we'll talk about those later.

 

Simple Project #1 - LED Light

This is about as simple as it gets, in terms of projects. It's super useful though, and I'll give you some nice equations for when you want to 'hack' stuff and add LEDs. I'm also holding your hand all the way though it, to expose you to some of the math you'd be dealing with.

Let's say we have a 5 volt source, say from a computer power supply. We want to use it to power a bright LED. So first thing's first, we obtain an LED to add to the circuit. Let's go to, say, Jameco, to do this. A little poking around and we get this:

The LED

Lots of power for a little thing. Note that since this is an LED, it comes with a data sheet, here:

LED Data Sheet

The data sheet is very important for us. Because it's an LED, the voltage drop across it is listed in this data sheet. In this case, it's given as a graph instead of a number. Look at figure 3, and see that the diode 'turns on' at around 1.7V (the point where the graph changes is also when the LED starts shining). The higher the current through the diode, the higher the voltage drop. Also, I'll tell you that the more current you can push through the LED, the brighter the LED. Also, we see that this LED 'peaks out' at 50mA of current. You can run the LED beyond 50mA, but there are no guarantees that it will work right (for the computer literate of you its like overclocking a computer, you're running it out of spec). So for us, we're trying to figure out how to put 50ma through this diode with 5 volts.

Look at Fig. 3 again in the datasheet. From the graph we can see that at 50ma the voltage drop is around 2.1 volts. If you were to hook the diode up to the 5V source directly it would shine very brightly for a short period of time, get very hot, and probably burn out, release blue smoke, or even rupture. This is because there's nothing blocking the diode from drawing all the current it can. So, what resists the diode's insatiable appetite for current? A resistor of course!

So now we have our basic circuit. It will look something like this as a schematic:



The three parallel lines, for the uninitiated, are 'ground' or 0 volts. Both should be connected together to ensure that all grounds are 0 volts. This should look familiar to anyone who's worked on the electric system in a car. In that case, the metal body of the car acts as a 0 volt reference for the car.

Resistors unfortunately come in many resistances. Pick one too low, and the LED fizzles. Pick one too high and the LED is either too dim or will fail to light altogether. We know we need 50mA. We have an LED dropping 2.1V at that current, and a 5V voltage source.

The key to solving this equation is a little ditty called Ohm's Law. It goes like this:

				code:
	
V=I*R
That is, the current through a resistor times it's resistance equals it's voltage drop. In this case, we know the LED drops 2.1 volts, but not what the resistor should drop. Since our voltage source is 5V, our LED drops 2.1V, and the resistor is the only other element in the circuit, we can safely subtract the LED's drop from the voltage source to get the resistor's drop.

So:

				code:
	
5V - 2.1V = 2.9V
The 'V' part of our ohm's law equation we now know to be 2.9V. The I part we want to be 50ma (since the current through the resistor is the same as the current through the LED in that configuration). All we need is the 'R'. So apply some algebra and divide the voltage by the current.

				code:
	
V / I = R
Now add in our numbers:

				code:
	
2.9V / 50mA = R
Just as a note, mA means milliamperes. A milliampere is 1/1000th of an ampere. So 50mA = 0.05A.

				code:
	
2.9V / 0.05A = R = 58 ohms
Ok, so we need a 58 ohm resistor. Unfortunately you can't buy a 58 ohm resistor, they simply just don't make them. 56 ohms is however a pretty standard value. So is 68 ohms. Both work in our case. We can prove this with ohms law. Since we know the voltage isn't going to change *much*, we can keep it constant at 2.9V. Then we can see how it affects our current. So:

				code:
	
V / R = I 2.9V / 56 ohms = 51.8mA2.9V / 68 ohms = 42.7 mA
Note that while the 56 ohm resistor gives us a pretty close value, it's still over the rated value for the LED. That's probably okay in our case, but you can play the safe side and use the 68ohm resistor too. It won't be as bright, but it will work! Note that the resistor should probably be at least a 1/4 watt resistor or greater.

But what if we want to change the voltage to something more practical. We can get 5V off a power rail from a computer power supply, but what about in a car? The battery in a car puts out roughly 13.8V, while the alternator puts out about 14.4V at worst. Let's call it even at 14V.

In this case, what happens if we drop in our little LED? Well, let's keep the voltage drop across the LED the same for simplicity's sake. Now we have a voltage source of 14V, so:

Drop across the resistor:
				code:
	
14V - 2.1V = 11.9V
Current through resistor:
				code:
	
11.9V / 56 ohms = 212.5mA
Obviously that's not going to cut it. Note that the LED's real voltage drop would increase off the charts, but not enough to bring the current through it down to 50mA. It'll still fry. So let's rework our math. We know the voltage drop across the resistor should be 11.9V. So:

				code:
	
11.9V / 50mA = 238 ohms
238 ohms is not a common value, but 220 ohms is. So:

				code:
	
11.9V / 220 ohms = 54mA
Still a little over, but not too bad. (edit: As scholzie points out that's not going to kill it, but this gives me an excuse to introduce resistors in series!) 220 is pushing it, but not too badly.

You can also add resistors together in series to get a little closer. A 220 ohm resistor plus a 15 ohm resistor makes 235 ohms, which is much closer to 238 ohms.

				code:
	
11.9V / 235 ohms = 50.6mA
Much better. Now our circuit looks like this:



Using this you've seen that you can use resistors to regulate current going into a diode. This is useful for LEDs, but also useful for other circuits as well. For example, I ran into a problem with one of my projects to where a power IC pulled way too much power. The circuit needed about 100mA at 5V at the most, but it was pulling upwards of an amp and frying itself. Hours of debugging later and I had not made any progress. To be rid of the problem, I placed a 10 ohm resistor between the 5V source and the IC. That not only limited the current to 100mA before the IC shut off (at around 4V), but after I did that the IC started pulling the correct current (~70mA). I suspect thermal runaway, for those curious, but the point is my quick fix worked.

Up next, building your LED light.

 

Schematic and PCB design

Kicad is an EXCELLENT open source schematic and pcb design program. I've used it for a few designs. It also produces industry standard files for when you want to get a PCB made by one of the many cut rate PCB manufacturers. Hell, even the autorouter works fairly well.

http://kicad.sourceforge.net/

Digital Simulation

Digital Works is a freeware digital simulator which is extremely easy to use and from what I've gathered, quite powerful. It won't give you netlists or generate HDL source code, but it does give you a place to experiment with logic gates, flip flops, and whatnot. If you want to design a state machine and see how it works without having to buy a breadboard, this tool will do it for you.

http://www.spsu.edu/cs/faculty/bbro...uits/howto.html