Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
clredwolf
Aug 12, 2006
NOTE: This thread has been around a while now, and I've basically given up trying to maintain it due to a busy personal life and the pretty fast rate new information is added. PM me if you feel anything should be added or changed here.

Also, disregard the tutorials, I must have been really bored when I wrote those...

Introduction

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 thread will be about getting started with hobbyist electronics. I'll try and explain some electronics theory and get beginners up to speed on how to put stuff together. Then I can go into more advanced topics as time progresses.

As for my credentials I'm a 3rd year student studying Electrical Engineering. I'm bound to make a few mistakes somewhere along the line, so please correct me when I need correcting. If you have experience with electronics and would like to contribute, please do! I'll post pretty much anything relevant here in the OP. This is learning electronics though, so keep the projects relatively simple.

I've built a collection of guides so far, but they're far from complete and they're kind of drafts right now. I'll clean them up and post them as I finish them. I'm also a terrible graphic artist, so please someone help pick that up.

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 I've found. 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. Some things he's not so good at explaining though, and I'll try to fill in those gaps. 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.
  • Opamps - Primer on Op-amps, the swiss army knife of ICs.

Projects

For Guitar Hero Wannabes

franc0ph0bic posted:

Yes, but only for guitar/bass related stuff. 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.

Thumposaurus posted:

I would like to add these sites too:
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.
  • Octopart - Electronics part search engine, kinda like Google Product for electronics. Pretty spiffy. Thanks to BBQ for the link!
  • 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 I 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.

Grey Area (usually considered active)
  • 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.


Useful Stuff In This Thread

NOTE: This is my first big thread like this, so bear with me. PM me if you see something that needs to be added or changed, or just post it!

clredwolf fucked around with this message at 15:51 on Feb 16, 2009

Adbot
ADBOT LOVES YOU

clredwolf
Aug 12, 2006
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.

-More to come later-

clredwolf fucked around with this message at 06:58 on Jan 8, 2008

clredwolf
Aug 12, 2006
That's kind of the problem. That 'Lessons in Electric Circuits' book is great and all, but it's kind of dry. I definitely tend to have a hobbyist slant to this, but basics are basics.

clredwolf
Aug 12, 2006

dhrusis posted:

What tools do I need to be a badass like yourself?

Tools of the trade:

Solder



Stiff Hot Pointy Thing



Breadboard



Pocket Protector



Multimeter



Jairbrekr posted:

If the OP wishes, I can try to put down some of what I learned in College (Electronics control at BCIT) into a more obscene format. Its been awhile, but some things you nver forget, like ohms law.

Yes, electronics needs way more sex.

ejstheman posted:

Doesn't logical current flow in the opposite direction from the actual electrons? It seems like the arrow should flip directions when you change scale from "look electrons" to the abstract, line=wire level.

This is what the industry likes to call a 'gently caress up'. Thanks to that little error some NASA drone just crashed into the side of Pluto unexpectedly. Should be fixed now.

clredwolf fucked around with this message at 07:04 on Jan 8, 2008

clredwolf
Aug 12, 2006

Phlegmbot posted:

I would say that diodes, including LEDs, are passive semiconductor devices, and not active.

Also, an IC is neither active or passive by definition.

It's kind of a fuzzy point for diodes and LEDs, but I've always seen them listed as active devices. Wikipedia sort of tells me the same, if you want to trust it. If not, I've got several electronics textbooks that tell me the exact same thing in slightly more readable paragraphs. Also, ICs almost by definition have to consist of transistors, which are active devices. I think there might be one or two out there that are not active (but I have no idea what those would be, I just know it's possible), but 99% of them are active devices.


Caffeine Wolf posted:

PRO TIP: There are two main sources of power: Battery (DC) and Power outlet (AC). Most scenarios or tutorials you will read about are involving DC. AC and DC work quite differently and if you try use AC without knowing exactly what you're doing you will probably break your circuit, set it on fire, short-out the entire street and kill everyone (in that order).

Oh we'll be getting there. AC by itself is not that scary, but 120/240V AC can get scary. 10,000V AC is ridiculously scary unless you're a goon photographer apparently.

XFDRaven posted:

Links

theparag0n posted:

Links

Added to the OP. If it's not up there yet, give it a few.

clredwolf fucked around with this message at 13:57 on Jan 8, 2008

clredwolf
Aug 12, 2006

H0TSauce posted:

How could this thread have come so far without any mention of the fun-loving Arduino?

edit: for links, i've got a few decent ones for beginners.
there's Electornics Projects which has some nice little projects for start-ups and also explains the different components in nice layman terms.
and also the page on play-hookey.com this one

Ooh and what electronics megathread could be complete without a link to MAKE Magazine?

Links will be added (when I get some more free time). Also, if you like the Arduino, try out an FPGA-based board sometime. You'll have to use Verilog (for the FPGA) and C (for the included ARM processor), but they're stupidly powerful for something hobbyist.

FPGAs are basically a reprogrammable digital chip. If you've used a PLA before, same idea except you can reprogram it as many times as you want. They're amazingly powerful, and pretty cheap for what they do.

clredwolf
Aug 12, 2006
Ugh, I made a big update and the power went out before I could submit it. I'll try to redo it now.

edit: Alright, well it seems like the thread is slightly more serious now. I'll try to tone the 'humor' down and get some projects together for everyone. I can do some more of the '101' stuff later. Jailbrekr can still make sex jokes about holes and poo poo though.

scopes posted:

I just found this a few minutes ago and it seems a pretty handy free program bundle, both a schematic designer and a PCB layout designer. Looks to be free because you can order PCBs through the program I believe.

http://www.expresspcb.com/index.htm

It's a great little program actually, but it does no simulation and it does not automatically lay traces (which is half the reason to use a PCB making program). The free version of Eagle is a bit harder to use, but can automatically figure out the best way to connect everything together and lay traces for you.

Just remembered to add this cool Java Circuit Simulator to the OP. It's a fun program to use, and an absolute must for newbies to play with. Basically it's a nice quick-and-dirty circuit simulator. Get a good feel for messing with schematics here.

clredwolf fucked around with this message at 02:11 on Jan 9, 2008

clredwolf
Aug 12, 2006

mirx999 posted:

I would clarify that in order to be classified as AC, current has to change in both amplitude and direction relative to ground. The square waves typically used in microelectronics and digital signal processing are actually modulated Direct Current. The rest of your post is pretty much spot-on, I just thought it would be good to clarify that one point.

It's kind of a weird gray area really. I agree that it's not AC per se, but if it changes fast enough (and it usually does) you can manipulate it like an AC signal. Often times you have to, in order to repair signals going through transmission lines/communications channels and other funky poo poo. I'll put a disclaimer in the OP though.

And now it's time for:

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.8mA
2.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.

clredwolf fucked around with this message at 05:38 on Jan 9, 2008

clredwolf
Aug 12, 2006

scholzie posted:

Edit: Just wanted to make a point.

No problem, both are good point. I wasn't aware that non-active ICs were even manufactured, let alone used. I called diodes active because they are non-ohmic, but you're right. Textbooks like to put them right next to other semiconductor devices, so it's probably a pretty common mistake. I'll change the OP to reflect both of those points.


scholzie posted:

Benjamin Franklin is the one who caused all the problems. It wasn't a "gently caress up" though. It made perfect sense to believe that current flowed from high potential to low potential. It was just wrong, unfortunately for us. We've made lots of mistakes like that, and quantum particles always seem to slap us in the face just when we though we had the right answer.

Nah, I've head enough physics to know better hence me calling it a "gently caress up". It's certainly an interesting history though, and Franklin has certainly earned the ire of many physics students.

Sir Lucius posted:

drat, this thread got too complicated too fast. I'm a simpleton mystified by the power of electricity. I was hoping the OP would continue posting pretty pictures of balls in tubes, and maybe one day I could learn what the hell a ground does and why one wire is hot and one is not.

Oh I still plan on doing it, but it's pretty time consuming and I've run into a ton of crap to do lately. Moving to a new city in a week is apparently not all that easy, go figure.

I'll continue the '101' stuff though, hopefully fill in the blanks, but I figured I'd start you all off with a nice project. I can also continue the project and show how to build large LED arrays and whatnot, but if I explain the theory then everyone will know how to do that and I don't have to. I'd rather do the theory at this point honestly.

clredwolf fucked around with this message at 05:41 on Jan 9, 2008

clredwolf
Aug 12, 2006
Ok, tomorrow's moving day and unfortunately Time Warner is playing games with me and I might be without internet for a bit. Oh joy. I'll do updates when I return.

clredwolf
Aug 12, 2006
*phew* finally back. I'll be working on the OP and cleaning up the drat LED project for ya.

Also the reason I said to check the spec sheet in the LED project is that not every LED has the same voltage drop and current draw, esp. not high power LEDs. I could make a current-driven LED next using a BJT...would you enjoy that?

clredwolf
Aug 12, 2006

Cuw posted:

It is amazing how diverse the field of EE is. It gets even more diverse when you throw the C in there and do ECE. It really surprises me it hasn't broken down further at this point at most major colleges since there really is no way for anyone to be proficient in all of this stuff by the time they graduate.

I think that's the purpose of having CE and EE separate, but it's not a great seperation if you ask me. Digital stuff is absolutely everywhere and everyone in EE needs at least a little exposure to digital technology at this point. From what I count though, here are the EE 'disciplines':

-Power Systems
-Computer Systems
-RF/Analog Systems
-Signal Processing
-Semiconductor Design
-Optoelectronics and Photonics
-Control Systems
-Robotics
-Bioelectronics

And I'm sure I'm missing a few. There's alot of cross-breeding between those fields though, so maybe it's best that EEs not be split up? Cuw is right though, there's no way anyone can master 'Electrical Engineering' as a whole in 4 or even 6 years.

clredwolf
Aug 12, 2006

900ftjesus posted:


If you're at all serious about getting started in electronics, you need this book:
http://books.google.com/books?id=bk...-with-thumbnail

That book is indeed amazing. Too bad google doesn't have the whole thing.

Jairbrekr posted:

You are most correct. It was the "Science with Swears!" thread, which had some awesome lessons in it. There is a special place in my heart for the "human being refraction" lesson I did, which is t otally off topic and not being posted here.

So if anyone wants to follow suit, by all means please do so. This thread needs more sex and foul language, and my time is sadly limited right now. My job is keeping me quite busy (for a fabless chip company no less).

Same story with me, I've been busy getting settled into a new town and job. It'll be some time before I can really resume a tutorial. I had a project ready for you guys the other day, but I had to take cell phone pictures and it turned out ugly as hell. So either I need a digital camera (which I'll get soon) or a lot of time to sit down and draw out what should be happening. Ah well.

clredwolf
Aug 12, 2006

Squier posted:

I am working on my senior year physics project which is a small cyclotron and need some electronics help. I need to create an RF amplifier that is capable of producing around 50-100 watts in the 1-15 MHz range. I haven't had much practical electronics and am hitting brick wall after brick wall trying to design this. So far it seems a push pull tube amplifier would be my best bet but am really lost beyond that. Any help at all would be awesome.

First place I'd look is at APEX's page. They specialize in high voltage amplifier blocks:

http://eportal.apexmicrotech.com/mainsite/index.asp

From them, I can see the following that might interest you:

  • PA98A Op-Amp - 100MHz Gain-Bandwidth (so enough gain for what you need, esp. if you string a few together), with +/-150V inputs. Probably good for a gain stage, but low power dissipation, so you wouldn't make 100W. Low current output.
  • PA09A Op-Amp - 150MHz GBP, +/- 35V supply. Probably good for a gain stage.
  • PA93 Op-Amp - 12MHz GBP, 125W output. Good for an output stage. Terrible input levels though (+/- 20V)

For the amps at 14MHz, you get gains of:

PA09A - 10.7
PA93 - 0.86
PA98A - 7

Not sure what your target output voltage/driven impedance is, but with those gain values you should be able to figure out how best to place the input/output stages. You'll need some beefy capacitors and I'd probably invest in some high-precision resistors (1% and the like). Beats the hell out of making discrete stuff though. Just make sure you have some good quality HV power supplies.

Do be careful with FCC stuff with these, you will be generating some pretty crazy RF interference with it. Try to keep everything you can in a Faraday cage, although since this is for a cyclotron I'm sure you already know that. Also electrical safety, etc.

Note also that I've seen a PA97 (1MHz GBP, +/-300V inputs) used, and they were only able to really use it at 300kHz. Granted they didn't use any output stages or whatnot, but just be aware that you may not hit a full 14MHz with that. In that case, look into Class C,D, or E amplifiers for RF applications. Class A and AB work too, but those are gonna be some beastly amps! Tubes can work with that kind of configuration, but I can forsee that being a bit of a pain to create from scratch. Lots of radio systems work with these kind of power levels, there's bound to be plenty of info out there for you.

edit: Removed stupid ideas.

clredwolf fucked around with this message at 03:09 on Jan 26, 2008

clredwolf
Aug 12, 2006
Ok, I was able to clean up these cell phone pics a bit, so onto:

Project #2 - BJTs and Kirchoff's Current Law

This time, I'm doing this with a breadboard. Feel free to follow along!

Today, we're going to use a BJT to light an LED. A BJT is a Bipolar Junction Transistor. It's the first mass-produced type of transistor, created in the late 1940s by Bell Labs. This little device revolutionized the electronics industry, and are only just now being phased out of use (by a similar device, the MOSFET).

BJTs are simple devices in principle, but the math and theory behind them is incredibly complex and actually involves quantum-mechanical principles (if you want to take a crack at it, I recommend reading this). Most universities save transistors until well after other devices are taught. I'm bringing it up early because it's a great way to show KCL in action, and to get you all used to using them early (because the more you use them, the more comfortable you feel using them and the more you see you can do with them).

When we last left current theory in that weird article of mine, we saw that current is the flow of electrons from one point to another. It's like water moving through a hose, in a way. In order to better understand the transistor, we need to understand Kirchoff's Current Law, or KCL.

To understand KCL, we're going to take this water analogy further. Imagine you have one of those Y-splitters (edit: they're called tees apparently) for 3 garden hoses. One hose connects to your house's faucet, and the other two go to lawn sprinklers.

(laughably bad artist rendition)



Now for the principle behind KCL. Treat the splitter as if it's a point. Then treat the two levers as switches:



The principle behind KCL is that the sum of the currents flowing through that point is zero. Wait, what? That can't be right.

Let's start with the simple case first, which is the one above. There, the two sprinklers are off (as indicated by the switches not completing the circuit). In this case, zero current flows to either sprinkler. Therefore, the current through the hose from the faucet to the splitter must be zero, according to KCL. That's pretty obvious, right?



Ok, now let's turn the top sprinkler on. Let's say that the faucet is a current source that provides 2 amps when 'on'. This means that unless both switches are off (in which case no current can possibly flow) the faucet lets lose 2 'amps' of water:



No current can possibly flow into the bottom sprinkler, so the current through the hose to that sprinkler is 0 amps. The current into the point from the faucet is two amps. Now let's put KCL into an equation. We know that all the current has to sum up.

I_faucet + I_sprinkler_Top + I_sprinkler_Bottom = 0

We know I_faucet is 2 amps, and I_sprinkler_Bottom is 0 amps. So, I_sprinkler_Top has to be -2 amps. Negative amperage is the same as saying that 2 amps are going away from the point.



Now if we turn on both sprinklers, we have two devices buying for 2 amps of current. Since both devices are equal, both devices get half of the faucet's current. So:



This preserves KCL, so that:

I_faucet + I_sprinkler_top + I_sprinkler_bottom = 2 amps - 1 amp - 1 amp = 0 amps.

This should make sense to you. When you use one of those Y-splitters in real life, the pressure behind both sprinklers decreases. If you turn off one sprinkler though, the pressure on the other goes back to normal.

So basically, the current through a 'point' has to equal 0. We can pretty losely define a point. A current source can be a point, since the current going into it must be the same as the current leaving it. A resistor or an LED can be a point, for the same reason. An entire circuit can be a point, since no current enters or leaves the circuit. An iPod, not plugged into anything but playing some music, is a point since no current leaves or enters the iPod until you connect it to a computer. And even then, the current entering that iPod MUST be the same as the current leaving it while it's connected. You get the idea.

Unlike Ohm's Law or some other approximations of electric circuits, KCL is always true. It may seem fairly obvious to some of you, and a trivial observation to the rest, but it's pretty important when analyzing circuits.

Now let's try applying KCL to the real world. Here is what you will need:

Part's List

  • 2 Alligator Clips
  • 1 9V battery
  • 1 Generic LED
  • 1 Generic NPN Bipolar Junction Transistor (I used a 2n2222A for this circuit, a 2n3904 also works)
  • 100 kOhm resistor (code brown-black-yellow-whatever)
  • 1 switch, preferably mountable to a breadboard
  • Some wires

Now to assemble this circuit step-by-step. Apologies for the crappy picture quality.

Start with a blank breadboard:


Step 1: Connect alligator clips to the top two rails of your breadboard (top is positive, bottom is ground). Connect those to the 9V battery.



Unplug one terminal of the battery. Some of my pictures have it plugged in due to me testing it. Don't plug that in till I tell you too to be on the safe side.



Step 2: Place the switch somewhere on the breadboard.



Step 3: Place the transistor on the breadboard, with the flat side facing towards the bottom of the breadboard.



Step 4: Place the LED on the breadboard, so that the longer lead (the positive side) is facing the top side of the breadboard. (Oh god this picture is terrible, I couldn't get a better one though)



Step 5: Place the 100k resistor between the middle pin on the transistor and the switch.



Step 6: Time to wire everything up.

  • Place a wire from the right side of the transistor (facing the flat side) to the negative side of the LED.
  • Place a wire from the left side of the transistor (facing the flat side) to the ground rail on the breadboard.
  • Place a wire from the unconnected side of the switch to the positive rail on the breadboard.
  • Place a wire from the positive rail on the breadboard to the positive side of the LED.



Step 8: Reconnect the Battery. Make sure the positive rail and the negative rail are connected to the respective sides of the battery.



Step 9: Now press the button!



What's happening? If we analyze this circuit, we see that the transistor separates the LED from the switch. We also see that the resistor is far too large a value to turn the LED on by itself, yet the LED lights. The transistor is obviously doing something, but what?

Well, the transistor is acting as a current source, that's what. More specifically, it's acting as a current-controlled current source. In less crazy terms, it's acting as a current multiplier.

You've probably noticed that the transistor has 3 terminals. Looking at the transistor from it's flat side, the right-hand terminal is called the 'collector'. The middle terminal is called the 'base', and the left-hand terminal is called the 'emitter'. If you measure the voltage between the base and the emitter while the switch is on, you'll see a drop of 0.7V. This is the same as a silicon diode.

So there's basically a diode between the base and emitter. Between the collector and the emitter, there's a current source. The current through this current source is directly proportional to the current through the base-emitter diode. For cheap-o transistors like we're using, the current from the collector to the emitter is about 100 times the current from the base to the emitter. This is enough current to turn on the LED, which is connected to the collector.

Thanks to KCL, we can also see that the current through the emitter is the same as the current through the base and the current through the collector added. You can verify this with an ammeter if you want. This current is all dumped back onto ground. Then the current is pushed through the battery, back down the LED and switch-sides of the circuit again.

Things to try:

-Try a much larger resistor, like a 1 Megaohm resistor. Also try a smaller resistor, maybe a 50kohm.
-Try placing a capacitor around the switch (between the resistor and the positive rail). Press the switch and see what happens.
-Criticize my circuit to the core. C'mon, bring it on. I'll fix the problems with it even.

clredwolf fucked around with this message at 14:02 on Jan 21, 2008

clredwolf
Aug 12, 2006

Skycks posted:

Shouldn't that bottom switch be closed?

Fixed now.

scholzie posted:

I think a schematic would be infinitely more useful than a breadboard walkthrough. It's a little hard to follow, and ultimately doesn't leave any lasting understanding of how the circuit is constructed. Other than that, it's useful as a basic example of transistor usage.

I would have made one, but my schematic editor failed to start last night. My intention it to get it working after work today, then slip the schematics in. I agree, it needs those schematics.

clredwolf
Aug 12, 2006

Phlegmbot posted:

If I were actually trying to learn electronics from this thread, I'd be so drat confused.

Yeah I have that impression too :( Oh well, I'll try to keep it going. Would cleaning up the articles help, or should they be rewritten?

clredwolf fucked around with this message at 02:48 on Jan 22, 2008

clredwolf
Aug 12, 2006

Hillridge posted:

I thought of a good project, though it's legality is dubious.

Every FM transmitter (for ipods, etc.) on the market sucks. My theory as to why, is that FCC laws limit the transmit power to something so low a sneeze will cause static.

How about we crack open one of these guys and see about boosting the signal power? I think I may have a few at home I bought off Woot.

I think this can easily be done by simply adding a tuned antenna, or via the more involved route of actually building an amplifier.

I've seen plenty of FM transmitters up on sites for educational purposes and HAM operators. You could very easily take one and make your own transmitter, or an amp for a transmitter you have already. Some of those systems are pretty ridiculous though, and meant for high-power broadcasting rather than getting Sirius to play in your car. I have no doubts that running a roving 40W pirateFM station from a Jeep would be both highly illegal and extremely hillarious. Imagine the look on people's faces when the christian rock they had on earlier is slowly replaced by Slayer, which gets progressively louder and more in tune until a speeding Jeep blows by, then slowly fades off. (Awesome mental image)

There are some modifications for things like the Zune transmitter and the iTrip available. All of them are basically 'add some wire where the antenna should go, enjoy better reception'.

http://www.zunemods.net/cms_view_article.php?aid=13
http://www.surfbits.com/?p=526

I believe a 1/16th wavelength antenna might actually work pretty well for this kind of thing (at the risk of HAM operators coming to flog my rear end for saying that...pretty sure I'm right though). The calculation for this is:

Speed of light / Target Frequency / 16 = Antenna length

Length for an 88.7MHz antenna: 0.698 feet

Round it off to 11/16 of a foot. That's 8-1/4".

Some bare wire is better than nothing, although ideally the straighter the antenna the better. Also having it in orientation with the car's antenna helps too (so facing towards the sky or towards the ground). Run a length of bare wire 8-1/4" off of where the antenna normally connects to on the transmitter. You'll have to solder it on. I'd add some glue to the side of the transmitter box to make sure you don't jerk the wire out and ruin the PCB.

Even a bit of extra wire helps. The closer to an antenna wavelength you can get it the better, although at very small lengths it won't matter so much. It probably doesn't matter as much even at that length, to be honest.

Bonus point for anyone who puts a 1/4-length antennna on their car and drives around with that 40 watt transmitter. Bonus, bonus points if you catch the attention of the FCC!

Jonny 290 posted:

Stuff

I agree with scholzie's suggestions. Also going to add that the HEF4007 is a great source for small, cheap MOSFETS. They're designed for digital stuff, but they work pretty well for RF circuits (not so hot for higher than say, 80MHz-ish). They are certainly not power FETs though. I'm also about to go grab some JFETs too, I keep seeing them in DIY schematics all over the place. Might be worth picking a few.

Also, for a variable linear power supply, can't go wrong with the LM338 IC. 5 amps of fury (provided everything else will take 5 amps and you're drawing 5 amps) and a dead-simple build. Two capacitors, two resistors are all you need (although I'd add a large capacitor on the input, couple of thousand microfarads).

clredwolf fucked around with this message at 03:34 on Jan 26, 2008

clredwolf
Aug 12, 2006

Delta-Wye posted:

I was reading this site: http://users.pandora.be/worldstandards/electricity.htm and it has the following information on it:


If you look at the map they include, a large portion (and notably, China and India) are at 50 Hz. Do they actually mean 20% less than 60 Hz? It seems like 20% of Europe and Asia is a shitload of energy, and a gigantic waste of that energy to boot. I can believe it's less efficient, but I have a hard time buying these numbers - they just don't pass my bs filter. What do you guys think?

Small novel ahead:

Westinghouse (the company that backed Tesla) went with 60Hz before everyone else, and AEG went with 50Hz. It had to be a frequency higher than 40Hz (or else the lights would flicker and look annoying) while being below 100-ish Hz so motors could work.

The article is wrong about the transmission lines though. You actually lose more power at higher frequencies, especially on high voltage transmission lines. The ideal condition there is, ironically enough, DC power. Modern power electronics have made HVDC transmission lines possible and they are more efficient than AC at high voltages. 50Hz does require larger transformers, since the higher the frequency the more efficient the transformer (RF transformers are extremely efficient compared to their 50/60-Hz cousins, but are used for a different purpose). In actual transmission across lines though, 50Hz is more likely to have less power losses across the lines.

The article would be mostly correct, except that nowadays technology is at a point to where it's not that big of a deal anymore. Your computer power supply, for instance, is so efficient because it takes the incoming 50/60Hz line and turns it into a very high frequency (typically in the MHz range), where that is converted to different voltages through some tricky circuitry that exploits the high frequency's efficiency in voltage conversion. HVDC lines do the same thing but instead of high frequencies, they convert to DC (or 0Hz) for super-efficient transmission. Transmission lines can also be designed to minimize power losses at whatever frequency travels across it, and transformers can be designed with tricks to make conversion easier. Basically, it's not a big deal anymore.

The 120V/240V thing is mostly for safety. 240V is actually much more efficient, as you need thinner wire and less current inside houses and buildings to carry the power, which is cheaper and in most cases would have less power loss across the wire. However, 120V is safer when shorted out or when a person accidentally shorts themselves across the wire.

The same thing is happening in cars nowadays. 12V is pretty safe, and in most cases shorting 12V DC through your body only causes a mild shock. Car companies are wanting to move to 48V though (or something higher than 12V) because all of the electronics in modern cars require some very heavy gauge wire to be powered, which is expensive. A higher voltage means a lower wire gauge, and less current to boot (so cheaper fuses, more efficient starting, etc). However, 48V can actually kill you. So if you wreck in the rain it's now possible for you to die from electrocution off a live wire.

edit: I should mention that despite the current state-of-the-art in power electronics, the power grid is a mish-mash of new and old (mostly old because it's expensive to upgrade). So practically, the article is right that there is a difference.

clredwolf fucked around with this message at 07:37 on Jan 27, 2008

clredwolf
Aug 12, 2006

Wisdom posted:

I notice Radio Shack sells these. Is this a good kit to use to get into the hobby?

Mrbill is right on this, BASIC stamps are fun but kinda limited. AVR's and PIC's are better microcontrollers, and are easy enough to get into especially if you have any programming experience.

Wisdom posted:

HP 130c Oscilloscope
GR 1311A Audio Oscillator, General Radio

That oscillator looks like you could use it as a signal generator, which is pretty useful (albiet yours is pretty low frequency, but whatever works). The Oscilloscope definitely looks older (500kHz max range), but a scope is a scope and unless you want to do RF work I think you'd be okay.

clredwolf
Aug 12, 2006

Cuw posted:

EDIT: I am an idiot and should have checked jameco. I have used them before but never realized they had the grab bag things which are awesome.

Jameco grab bags are amazingly good deals. My only beef is that they tend to leave out some useful stuff from them. For example, my resistor bag has not a single resistor above 800k (although I have some 1Mohm resistors around).

Their 7400-series bag also has some pretty worthless chips in it, although they gave me an insane amount of 8-bit registers (so I can't complain too much). Seriously though, I wanted to open that bag and find a 74181 in there. Or twelve.

Also, if you're still looking for a solder station, Digikey sells some nice ones.

edit: Seriously, I just counted 9 646s. What the heck am I going to do with that many?

clredwolf fucked around with this message at 00:54 on Feb 5, 2008

clredwolf
Aug 12, 2006

SuicidalSmurf posted:

Another electronics 101 question. I need to pick up a theory book. I remember what it is that I want, but how to get it done is a mystery to me. I'm not even sure which type of transistors I want to use, I just want to throw a circuit together and have a work. Understanding how it works would be an added bonus.

I want to set up a logic gate. I have a momentary push button, B1, that I want to toggle a power source (+12vdc). So, on button press..

if theCircuit = 0
then turn it on
if theCircuit = 1
then turn it off

If anyone has an easy to understand guide on this stuff that would be great, but I'm a little over my head.

Look at the 'Lessons in electric circuits' link on the first page, or here. He covers digital stuff pretty well, and gives you some transistor level-schematics to work with.

It looks like what you want is an AND gate or a NOR gate with an inverting input. You can make that with...6 BJTs I think (yep, just simulated it). You could also just get a 74LS00 chip (4 NAND gates on a chip, very common chip) and do it with 3 of those gates (which involves wiring parts of that chip together. I'd do the latter, unless you're trying to learn how gates work. It's cheap, easy, and you get to brag about having a (late 80s) computer chip on your board to anyone who cares.

clredwolf
Aug 12, 2006

babyeatingpsychopath posted:

This is a flip-flop, specifically a "T" flip-flop. You can get them on chips individually or wire them with a small number of gates. A TFF is just a kind of JK flip flop with the inputs connected together.

http://www.play-hookey.com/digital/jk_nand_flip-flop.html

Oh, ha, I should have asked. Did you want the output of this to be a momentary on (like a push button switch, motherboard power switch) or an always on (like a normal light switch)?

If the latter, then yeah use a flip flop. It takes alot of transistors to build those unfortunately, I'd say (for TTL) 2 NPNs per NAND gate, 2 NPNs per input for step-up, 1 for an inverter (using the second input transistor), and 1 NPN for an output driver. There are 8 NAND gates in a flip-flop. So you need 12 20 NPNs. You also need several resistors, and a debounce circuit for your switch (a resistor and capacitor will suffice). I'll try and build one real fast, and see if it works like I've thought it will.

Otherwise, if you're just 'gating' the push-button switch (option #1), it takes about half that many transistors. Less if you don't care about glitches and such.

clredwolf fucked around with this message at 04:49 on Feb 7, 2008

clredwolf
Aug 12, 2006

SuicidalSmurf posted:

I need the latter, push button for a moment, power goes on. Push button again, power off. If it's gonna take 20 transistors then the hell with it, I'll use a regular switch. I won't learn as much, but I won't want to kill myself either.

Seriously, 74LS109 T-flip flop. 50 cents and it does exactly what you need without the muss and fuss of dozens of transistors.

Just so you're aware, you can do this with far less, but you start running into nice little glitches then. The 109 is about the best way to do it.

nobody- posted:

Could someone explain impedance to me? I have a kind of fuzzy understanding of it -- I can kind of see how if you're trying to run a high frequency signal through a long wire, stray capacitance and inductance and the natural resistivity of the wire can degrade signal quality (I guess I kind of think of impedance as a special type of resistance that affects AC circuits). I know that for some reason, it's a good idea to buffer analog output from a microcontroller with an opamp before driving a speaker, but I've never really understood what a high impedance or low impedance load are, or what I'd have to do if, say, I wanted to alter an audio circuit designed for headphones to drive a larger speaker.

Impedance is also known as 'complex resistance' in some circles. It's like resistance, but with 'imaginary' elements added (imaginary as in imaginary numbers, not made up stuff).

<long there be dragons beyond this point>
Turns out that capacitors and inductors can be effectively modeled as resistors with an 'imaginary' resistance instead of a 'real' resistance. Put the two together and you get a 'tank circuit'. Imagine a capacitor and inductor in parallel. If you put a DC signal through that, it goes purely through the inductor. A low frequency signal goes mostly through the inductor. A very high frequency signal can't go through the inductor, so it goes straight through the capacitor instead (which it 'sees' as low impedance). The combined effect means that at some middle frequency the current can go through both components, with more current than it would otherwise. This is the resonant frequency of the circuit. It's just like how an opera singer can shatter a glass, too low a pitch or too high a pitch and the glass stays intact. Hit that right note though, and it shatters into a million pieces. You could say that this circuit has high impedance at low and high frequencies, but low impedance at intermediate frequencies.

It also turns out, that weirdly you can model non-perfect elements with a combination of perfect capacitors, inductors, and resistors. So a very long wire is modeled as a string of inductors and capacitors.
</long>


For most things, impedance usually equals resistance at a frequency, especially for audio stuff. An 8-ohm speaker hooked to an ohmmeter gives about 6 ohms, but when hooked up to an audio signal the amplifier 'sees' 8 ohms. Electrically, it's harder and harder to push a signal through the speaker at higher frequencies. At 1 MHz, for instance, you're not going to hear a thing out of that speaker, and the amp is going to see a very high impedance more than likely. It just can't push any current through the speaker that quickly. From about 20 to 20,000 hertz, most speakers are rated to have about the same impedance over that range. Some speakers go lower than that (subwoofers), some go higher (tweeters), and some stay in a middle range (midranges, of course).

As for headphones and speakers, the difference is mostly current. An 8-ohm speaker takes a bunch more current than a 32-ohm headphone (4 times in fact). You'll need another amplifier between your device (microcontroller, iPod, whatever) and your speaker. For tiny little speaker, a good beefy opamp should do it. Larger speakers need larger amps, and bookshelf speakers or floorstanding speakers need big amps >20Watts to power...rare to find on a single chip (but there are some around).

That help any? Kind of the long way to explain it...

clredwolf fucked around with this message at 00:18 on Feb 8, 2008

clredwolf
Aug 12, 2006

babyeatingpsychopath posted:

I model this thing in LTSpice, and the waveform looks good. When I wire it on the breadboard, the LED is always on. What did I do wrong? If I don't hook the 555 to voltage, the LED is NOT on, so I know that's doing something.

Biggest obvious fix I see is to move the LED to where it's going into the transistor's collector, not out of the emitter. In other words, swap the LED and the transistor's positions. The transistor measures current flowing from the base to the emitter, so it's probably 'seeing' some pretty weird changes since the LED should be stopping current when off.

clredwolf
Aug 12, 2006

babyeatingpsychopath posted:

Ok, if I remove the LED/transistor entirely and just read voltage at pin 3, still nothing. I've triple-checked everything. I've even duplicated this circuit on BOTH sides of my 556 to no avail. What gives?

I just built the circuit with and without the LED and it seems to be working (battery w/8.5V). Check your connections and make sure caps are put in the right direction, etc. If that doesn't work, try a different 555.

clredwolf
Aug 12, 2006
Hmm, anything I should be changing in the OPs now? The tutorials aren't a huge hit, so I'm not looking to update those for now.

clredwolf
Aug 12, 2006

sithael posted:

Finally got my Futurlec stuff. The Linear IC grab bags had alot of common ics (alot of voltage regulators though) , but all the grab bags are organized and labeled into smaller baggies. Cool, I hate sorting stuff!

That's amazingly awesome. Jameco just kind of lumps everything together and sends it out the door. Sorting parts suck, especially when you can barely read the drat letters on some of those ICs.

And yeah, Jameco's resistor pack was kind of worthless. Lots and lots of 10k ohms, but nothing over 100kohms at all. That's kind of important for some things, you know? Their electrolytic grab bag was alright though, I actually use those.

clredwolf
Aug 12, 2006
I know, I was just kind of hoping the jameco grab bag would be sufficient. I've got some megaohm resistors lying around anyways, so I'm alright there.

clredwolf
Aug 12, 2006
Oh wow, you guys have kept this thing going in my absence. I'll read through this when I get some free time again sometime tomorrow. Been rather distracted lately, but I definitely want to see this thread stay alive.

clredwolf
Aug 12, 2006

scholzie posted:

Also, wrapped wire capacitor? Do you mean one of these?


On that note, does it look like the big copper thing in the pic here?



Both are inductors, but I've seen the latter kind more in audio equipment. Even sorta looks like a cap if you squint.

That starts to not make sense though because usually inductors are rated by amps, not volts. Stranger things have happened though.

mtwieg posted:

Reacting to frequency is a great deal harder, because unless the sound is a perfect sine wave, any sound will have many frequencies in it. If you're looking for one or more specific frequencies, you could build a bandpass filter for each frequency then rectify the output as before. But if you want to look at continuous range of frequencies you'd effectively have to build a spectrum analyzer, which is pretty deep stuff.

If you go this route and want to do frequencies, a half decent ADC (analog digital converter) and a higher-end PIC microcontroller should be sufficient to build a basic spectrum analyzer. However, the software you'd write for that would be, uh, challenging unless you know what you are doing. Lots of math, FFTs, and craziness involved there.

You can also do it with a whole bunch of bandpass filters, but I somehow doubt you want to contend with that. Volume meter is the easy way to go for now!

clredwolf fucked around with this message at 23:07 on Mar 28, 2008

clredwolf
Aug 12, 2006

jovial_cynic posted:

Now that I've got a better idea of how op-amps work (this site was tremendously helpful), I'm a little more comfortable with experimenting and trying to see what happens when I start wiring things up together.


Regarding the LM386, we've already covered the fact that it's not an op-amp. It's a 1/2 watt audio power-amp. And in my scavenging of parts, I came across a KA22065.

http://www.ortodoxism.ro/datasheets/SamsungElectronic/mXrrtyy.pdf

This appears to be a 4.6W dual power amp, specifically made for audio.

The diagram is sparce, but there's a "test and application" page that shows how it can be wired up.

On that diagram, what is "BS1" and "BS2"? What do they stand for? I see that on the block diagram, they are connected to some kind of thermal-protection unit. And what about "NF1" and "NF2"?

The supply voltage says "6v to 15v," and it originally came from a device that had a 12v AC adaptor. I suppose a 9v would work as well?

So... is this basically an older and more powerful version of what the LM386 will do, in terms of making a small instrument amplifier? Is there anything in this circuit that I should be particularly aware of?

-----

edit: I also found a LA4485 audio power amp chip.

http://www.ortodoxism.ro/datasheets/sanyo/ds_pdf_e/LA4485.pdf

Same questions about that.

The particular opamp you pointed out is an older style opamp with bias inputs. That's BS1 and BS2. Both are set to a particular voltage to try and get the output voltage to be as close to 0V as possible. NF1 and NF2 are connected to ground through a capacitor. If you want to use that particular opamp, then the diagram on page 3 of that part's spec sheet is a good circuit to start with for what you want to do.

There are better opamps nowadays that don't need the biasing. However, I'd reccomend getting an amp on an IC, since it's just easier.

The LA4485 looks like a nice power amp too. The sample circuit on p.15 (the BTL one) is a nice place to start for a monoblock amp (like, say, for a guitar practice amp). BTL simply means that both output stages of the amplifier are tied together, much like in high-quality car amps nowadays.

You can do better, though. The LM1875 pushes 30 watts with few external components required.

http://www.national.com/mpf/LM/LM1875.html

You'll need at least a 16V supply for that though, but that's only 2 9V batteries. I'll be a power hungry beast, but it'll definitely have some kick to it. Both amps (sanyo and national) might push the current draw for alkaline batteries, so you may want to consider using older NiCad/NiMH batteries to power it. Some R/C car stuff is over 12 volts.

clredwolf
Aug 12, 2006

Paul MaudDib posted:

I'm sure there's an obvious guide to this somewhere, but how do I know what transistors to use :psyduck:

There's like a million different ones, and I have no idea why you'd choose a 2N5886 instead of a MJ15022 or what the difference even is. How do you know which transistor is suitable for which application? Is there even a concise guide somewhere, or do you just poke through Mouser for one that fits your specs?

edit: Let it be known that I know very little about transistor design. I read the tutorial on op-amps a while back and that's about it.

It all comes down to knowing what you want to do with one, and reading it's data sheet.

For instance, here are four popular NPN transistors:

2n2222A
2n3904
BC337
BC337

Some common specs to look out for (BJT):

Max. Collector Current (IC) - Basically how much current you can draw through the transistor. Usually you want far less than that. Make sure you're not exceeding the max. power dissipation the transistor (or rather, it's case and heatsink) can handle.

Max. Collector-Emitter and Collector-Base Voltage - At what point the transistors start breaking down. Even if the current is kept low, going to voltages above these levels can permenately damage or destroy the transistors. Make sure you have some safe margins with these values.

hFE or DC Current Gain - How 'sensitive' the transistor. Basically, the ratio of how much current is drawn through the collector vs. how much current is drawn through the base, while the transistor is in the active region. Higher values are best for really sensitive amplifiers, like say for thermocouples or passive microphones. DO NOT rely on this value for making circuits, as the value listed is prettymuch an average value. The actual value can vary a whole lot over temperature or even imperfections in manufacturing. (This is why most good electronics textbooks tell you to use negative feedback-based amplifiers instead of straight common-emitter or common-base amps, as their gain is reliant on much more accurate passive components.) However, a transistor with a gain of 20 is not going to be able to get you a gain of 50 no matter how many passive devices you add (unless you do something really, really crazy).

So keep this number higher than what you need, especially for common-collector or common-base amps. It's always easier to add in feedback and lower the gain than it is to run the thing wide-open and tear your hair out because it performs like crap.

Vbe or Base-Emitter Voltage - Set voltage between base and emitter, as the base and emitter appear to be connected by a diode. Is almost always 0.7V, if the transistor is silicon (99% of the time). It can vary over temperature though, and a datasheet can tell you how badly (not something to worry about unless you have problems with it).

Current-Gain Bandwidth Product or fT - Basically what kind of useful gain over what frequencies you can get. If you're trying to amplify a 100MHz signal, for instance, a 3904 will get you a gain of ~3, as it's GBP is 300MHz. The same transistor with a 1MHz signal can get you a gain of 300. Note that this effect is limited by the transistor's DC-current gain, so in the 3904 the gain cannot go above ~300 (so don't expect super-high gains at low frequencies). If the gain drops below 1, then it's time to look at another transistor (I'd keep it as high as possible personally, unless you want to use jellybean transistors, as high gain = less distortion in negative-feedback amplifiers and any feedback-based circuit).

Cuttoff Currents - The currents at which the transistor slip into cutoff mode. Basically the transistor doesn't work (behaves as two diodes) below this point. Important to pay attention to if you plan on making things battery-powered or low-power. Small signal transistors like the 3904 have very low cutoff currents, in it's case 50nA. Large transistors like the 3055 have higher cutoff currents, in it's case nearly 5mA through the emitter (so base+collector).

Max. Power Dissipation - How much power can this thing take before it melts? A 3904 can take a puny 625mW before the magic blue smoke is released. A 3055 on the other hand, can take a whooping 115 watts before biting the bullet. Keep in mind you may have to sink all of that heat from the device for it to continue to operate at that point. With a 3904 the case itself is fine, but a 3055 will probably need a huge heatsink.

Rise/Fall/Storage/Delay Time - The time it takes the transistor to go through the various parts of a square wave. Important if you are using the transistor in a switching application (as opposed to an amplifier or as some sort of signal modifier).

FET

Replace Collector with Source, Emitter with Drain, and Base with Gate, and you have a FET. All of the same above apply, except Vgs voltage works differently (no 'diode').

Max Vgs - In a FET, there is no diode separating the gate from the source (only a 'capacitor'), so you're free to set that voltage too. There is a max. voltage between the gate and the source you can have though. Generally it's wise to stay within that range, although some FETs can take the abuse if you choose to go over (just don't blame me when blue smoke pours out of the thing).

Drain to Source resistance - A lot of power FETs have this rating. Basically how low to expect the resistance to be between drain and source when the transistor is 'full on'. Most FETs are used like switches anyhow, so that's a good figure to know.


As general rules of thumb:

-Small Signal BJTs are often interchangeable. I know I've found 3904 and 4401 transistors lumped in with 2222A transistors (annoyingly enough). They do tend to differ in maximum current vs. speed. A 4401 can sink nearly 600mA of current, while a 3904 can only sink a paltry 200mA. So watch out if you're designing radio components or driver circuits (a headphone amp I made recently works with 2222As or 4401s, but not 3904s because the application draws too much current...and even 2222As are a bit underpowered).

-Quality tends to shift around a lot on the very popular transistor types, so either find a reputable vendor/manufacturer or consider their data sheets overrated.

-Power BJTs aren't used as much anymore commercially, but you can find 2n3055s and 2955s EVERYWHERE. They're not very fast, but they tend to work alright for switching moderate currents and as high-power output stages, and they're rugged as hell.

-Power FETs are pretty fast, and can switch very large current loads. Use em as power switches, or as part of that Tesla coil you want to build. Many power FETs tend to have a diode between the source and drain as a safety.

-Note that the case of a transistor has a lot to do with it's power dissipation. A TO-92 case, for instance, can only dissipate about 625mW of power. Any more and you can get the transistor too hot and damage it (I'd stay below that number). A TO-3 case or a TO-220 case you can hook to a heatsink and push the transistor to it's limits (and then boil some water with the nice space heater you've made yourself).

Common Transistors:
NPN:

2n2222/A - Seen everywhere, average at prettymuch everything.
2n3904 - Low power, can't take much abuse but works at high frequencies (up to 300MHz). Tends to be very popular for hobbyists, and is also seen everywhere.
2n4401 - Slower speed, can sink more current (but not more power).
2n3055 - Big old sucker, use for high-current applications.

PNP:
2n2907 - Compliment to the 2n2222, probably the most popular small PNP.
2n3906 - Compliment to the 2n3904, fast and low-current. Also seen everywhere.
2n4403 - Compliment to the 2n4401.
2n2955 - Compliment to the 2n3055. Not quite as common as the 2n3055.

Prettymuch any 74xx TTL chip (without a 'C' designator), older chip, and a good number of analog chips use BJTs either exclusively or in combination with FETs. FETs have all but totally replaced BJTs for digital circuits, and are quickly taking ground on the Analog side. Most discrete transistors are either high-power FETs or BJTs of all types.

FET:
IRF540 - Pretty common high-power FET. Often a better choice than a 3055, but more expensive.
HEF4007 - Small-signal FETs on a chip, if you want to play around with those.
Almost every modern IC you'll probably be using, including prettymuch any microcontroller, uses FETs exclusively.

IGBTs:
Don't know of common types off the top of my head. Use them when you need to switch gobs of current. Like, a camera flash, a super tesla coil, or half the freaking power grid. Also, Toshiba seems to like using them for power amplifiers (they can run really cool).

clredwolf fucked around with this message at 06:45 on Dec 23, 2008

clredwolf
Aug 12, 2006
Also I need to clean up that OP, but drat there's a lot of new information to shift through. Think I should keep it the same, or would it really be that beneficial to have a good table of contents?

clredwolf
Aug 12, 2006
Integrated uC ADCs are pretty crappy anyways, with a few notable exceptions (none on the arduinos that I'm aware of, some PICs and the Analog uC line have good ADCs). If you're sampling a depth sensor or doing something pretty innocuous then whatever, but if you're pushing the ADC you probably won't like the results.

SAR(successive approximation)-based ADCs are cheap-as-water and pretty powerful nowadays. Jameco and Digikey have pretty extensive lists of ADCs up and around 100kHz. Remember that for sample rate you need double the highest frequency you will be sampling, and I'd actually make that triple to be on the safe side (to deal with filter rolloff and aliasing effects, go lower if you have a really sharp filter with little bouncing).

Also, do not forget to put a lowpass filter in front of the ADC to block high-frequency signals, even if it's just a low-pass RC circuit. Rolloff should be so that you pick up minimal response at frequencies at or above half the sample rate.

Note for audio I wouldn't go less than 12-bits unless you're trying to get a distorted sound. 16-bits is the gold standard, 14-bits will probably be alright. 12-bits (and maybe 10-bits) gives the same performance at very high sample rates when you resample, like 300kSPS or so (I can do the math if that helps anyone).

clredwolf fucked around with this message at 03:28 on Jan 18, 2009

clredwolf
Aug 12, 2006
Geez that's amazing. Wonder what the SNR/SFDR specs for that ADC is like. You could almost do some fancy IF sampling with that (or at least it's getting into that territory)!

Some of the Analog uCs have ADCs in that range, but those tend to be pricier than normal uCs. Those are pretty much uCs with a proper ADC copy-pasted into it's silicon, so it's kind of cheating.

clredwolf fucked around with this message at 04:45 on Jan 18, 2009

clredwolf
Aug 12, 2006
Ahh, for that kind of app I honestly wouldn't even consider an internal ADC. There's a lot of noise pickup from the microcontroller, digital noise pickup (which is non-random!). By separating the ADC and the uC, you get some noise immunity, especially if you make liberal use of ground planes (recommended) and seperate the analog and digital power sources (probably not necessary).

Honestly interfacing to an external ADC isn't very tough, esp. if you can find a pre-built board. Some of the really high-end ones have a SPI interface for control and that's about it. It is a step or two up from just hooking a uC to a USB port though.

clredwolf
Aug 12, 2006
If the PCB is cracked usually I'd just throw the thing out. If you want to though, best way I've found to fix them is to use solder and a lot of flux.

Put down flux on the traces to fix. I like to use flux pens personally, you can precisely put down lots of flux on an area with them. Then put just a small dab of solder on the iron, and bridge the gap. If the PCB is just cracked, it shouldn't be a large gap.

Then check to see if the circuit works. If it does, superglue it down. If not, keep at it until you either destroy the board or fix it.

It's a royal pain in the rear end to do this though.

clredwolf
Aug 12, 2006
Wow, the Arduino stuff moves fast. A few months ago I'm 90% sure the SPI interface stuff was just not there, now there's at least 3 tutorials up on how to interface using Arduino SPI. I'm so stoked, too bad it invalidates a lot of my project (stupid PIC32)...


Hopefully the Arduino SPI is a half-decent speed (I'd be happy at 1MHz). If not...that's what special crazy overclocking is for, heh heh... Anyone messed with Arduino SPI code before? What's the speed like, if you can tell?

Also, I've mentioned off and on this crazy project I've been wasting my life away on. I'll post a thread on it when I feel like it's ready for photo-ops. That may be a few months away, but I may drop a few hints on this thread here and there if anyone is interested.

For now:

code:

Code flow for initialization:

   PC
   |
   |
  USB
   |
   |
   \/
   uC -------SPI---> Flash Memory (optional)
   |      |
   |      |
  SPI    SPI
   |      |
   |      \/
   |   Cyclone III
   \/
 Blackfin

Gives you an idea of what I'm messing with here.

Adbot
ADBOT LOVES YOU

clredwolf
Aug 12, 2006

Bexx posted:

And getting a Metcal soldering iron cause they loving rock. And they aren't nearly as expensive as they used to be either.

Quoted for truth, Metcal irons are incredible. High quality Weller irons are pretty good too, I like Metcals much better for fine work though. Chaning the tips is so, so easy (just don't EVER trust them to be cool).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply