How to build things like this
How to Make Cool Electronic DevicesBuilding electrical devices is probably the most inexpensive engineering you can do because most electronic components are very cheap, like less than $1. How to actually build devices on your own isn't taught enough in engineering courses, so here's a quick summary of how to get started making devices like I have on my site. In this page, I kind of assume you're an engineer/scientist of some sort (or studying to be one) and that you've already had a few electrical engineering classes.
If you don't know any electrical engineering, you'll obviously need to learn the basics before you can start inventing. A good place to start is the book Make: Electronics, which teaches you theory and practical knowledge of components at the same time. Also reading about electricity and electrical components on Wikipedia and elsewhere may help. But this page is mostly for students in engineering who want to make something cool with what they're learning. Engineering classes are hard, and it helps to know that you can invent cool stuff after you've been through them. (Unlike the Liberal Arts classes which will only teach you to write essays!)
First, get an idea
To get an idea for something cool to make, it helps to go to online stores for electronic components (Jameco.com is a good one) and look at the components they have. Looking at cool things like photosensors, IR sensors, ultrasonic sensors, motors, etc. is a good way to get an idea for something interesting. If you don't know what a particular component is, look it up on Wikipedia. It's good to know what kinds of components are out there.
When you have your idea, look at the datasheets for the components you want to use to figure out how to use them: if you know you want a general type of part, like a voltage comparator, go back and forth between your store's web page (which will have different models of that part available) and the parts' datasheets (which will tell you if that specific model does what you want) Datasheets are absolutely vital; if you can't find the datasheet for an electronic component, don't bother trying to use it. (An exception is motors and LEDs, which are pretty straightforward.) Good sources for datasheets are DatasheetCatalog.com and DatasheetArchive.com. Often, especially if you get your parts from a university, they'll just be listed by the part number and name, like "LM358 Op-amp." There are all kinds of op-amps (they're a very useful part), so you need to know if that particular one meets your needs. So search for "LM358" at DatasheetCatalog.com, look at the datasheet, and see if it's what you want. (The part number is usually also printed on the actual device, which is nice if you salvage transistors and things.)Here are a few typical parts that I use a lot:
Op-amp: LM358 . It's powered by a single 5V input (some other op-amps need +10V and -10V).
Comparator: LM393 . (It does have an open-collector output, which basically means you need to connect a pullup resistor to its output to make it work. That's sort of annoying, so I'm not necessarily recommending this comparator, but it's a starting point.)
Motor Controller: like this or this. Motor controllers are used to switch the larger currents and voltages that motors use. They're fairly cheap, and much easier than trying to control a motor with transistors.
Stepper motors or R/C servos: The specific model you want will depend on your needs and what deals you can find, but stepper motors are a great, cheap way to get controllable motion. For example, I use a stepper motor to rotate the turret in my Starburst Turret. Standard R/C servos are also very easy to use when you need to move something to a specific angle.
Power itElectronic parts mostly all use 5V. The way I get 5V is with the "7805" voltage regulator chip, which is around 30 cents at Jameco.com. What the 7805 chip does (as you could see from its datasheet) is take a higher DC voltage, like between 6 and 12V, and turn it into exactly 5V on the output. (As noted on its datasheet, it's important that you put a capacitor between the output and ground to make the voltage smooth. Otherwise there will be small high-frequency oscillations in the power, which can mess up some types of circuits.)
It's up to you how you get the DC 6-12V power to input to the 7805. A 9V battery works well for mobile circuits. For building and testing a circuit, I use a DC wall power supply. For example, I have one from Radio Shack that can supply 9V at like 300mA. I also sometimes use the DC power supplies that charge cordless phones (just cut off the charger plug to get to the wires). That's a good source for them because a lot of people get a new phone and then have the old charger lying around. You can see on the charger's case what voltage it outputs, or test with a multimeter, which you should have if you're doing this sort of thing. The fancy battery-charging circuits are generally inside the cell phone itself, and the charger just constantly outputs a DC voltage, which is exactly what you want.
As a side note, it's a bad idea to try to get 5V just by putting 3 "AA" batteries in series. If you do that with fresh batteries and measure the voltage, you will read around 5V. The trouble is, that voltage will vary depending on how much current you're using. That's why it's good to have a regulated supply, such as from a 7805. Also, if you have motors in your circuit, they often want more than 5V, so you'll probably want to power them with just the unregulated voltage from your 9V battery or wall power supply. Unlike electronic chips, motors aren't very particular about voltage, so there's no need to give them a regulated supply.
Put it togetherThe combination of the Internet, datasheets, and your engineering skills should allow you to design something that uses your cool parts. So now you have to put it together and see if it works. I always build things on a solderless breadboard. They're very nice; they have a lot of springloaded holes put together in rows of about 5, and all the holes in a row are electrically connected to each other. So if you want to make a connection between 2 wires, you just plug them both into the same row and they're connected. And they make it easy to use any chip that comes in a DIP package, which is most chips. Solderless breadboards are about $7 at Fry's or Jameco.
AdviceSo now you know how to put a circuit together and power it. Beyond that, it's just reading about how to use components on the internet and having a few good engineering classes. Here are a few random tips that they didn't teach me in my freshman engineering class (or I forgot), and that I learned the hard way.
--If your circuit isn't working for some reason, make sure you have a capacitor across the power supply wires to smooth out the voltage (like 100 uF or higher). Batteries are not ideal voltage sources; add a voltage regulator and a capacitor, and they pretty much are.
--Electrolytic capacitors (the cylindrical ones that you use to use to smooth out your power supply voltage) are not "ideal" capacitors: they have a positive and a negative end. The negative wire is the one with a bunch of "-" signs printed above it. If you put the negative side at a higher voltage than the positive side, current leaks through, and the capacitor gets hot and doesn't work. Also, big electrolytic capacitors (like 2000uF) are fun to play with-- touch the two wires to the corresponding terminals of a 9V battery to charge them; then, after taking the battery away, touch the two wires together and they make a little spark from the brief high current. Using several batteries in series to get a higher voltage makes the effect better; just make sure you don't exceed the rated voltage of your capacitor (which is printed on the side).
--A good practice is, if you're turning on a complicated circuit for the first time, have a multimeter reading the voltage on the 5V power supply. If there's a short circuit somewhere or a chip connected backwards, the voltage will often be lower than 5V. If that happens, quickly turn it off so a part doesn't get damaged and find the problem. (A voltage of 5V doesn't necessarily mean there's no problem though.)
--The most important thing is to just buy some stuff and experiment; don't be afraid to break things, because they aren't that expensive. The first circuits I designed didn't work very well, and I broke some components. That's the way to get smarter, though.
Quick Transistor tutorial:
My main advice on transistors is: avoid using individual transistors if you can. You can buy integrated circuits called H-bridges or motor drivers that are better for controlling things and are more user-friendly. For example, with one transistor, you can only send current one way through a DC motor, so you can't run it in reverse. But an H-bridge can run it in both directions with a single chip. So if you want to control motors, I recommend you read about H-bridges on Wikipedia and see what sort of motor drivers you have at your electronics source. Then look up their datasheets on DatasheetCatalog.com.
If you really want to use a transistor, here's a brief tutorial:
There are many different kinds of transistors you can buy. The most common type is the NPN transistor. The following explanation is probably hard to remember, so just look it up when you're ready to wire the circuit. Remember that the below explanation is only for NPN type transistors.
You connect the "emitter" wire to ground. (Figure out which wire is which using the datasheet.)
You connect the "base" wire to your control signal through a resistor (1000 Ohms will probably work for most transistors; it may need to be lower. You can figure out exactly what to use from the datasheet, but 1000 Ohms will keep the current low enough that it won't hurt a normal transistor, so if things work with 1000 Ohms, don't bother with calculations.)
You connect the "collector" to the "low" side of your motor (i.e. the side that's not connected to the + voltage) Then, if the control signal is 0V, the transistor will be off, and if it's high, like 5V, the transistor will turn on, and current can flow from the "collector" to the "emitter."
The important thing to remember about NPN transistors is that they switch on the GROUND SIDE of the motor. They won't work to connect the positive supply to the motor, only the ground to motor. In other words, the emitter wire must be grounded (specifically, it must be at a lower voltage than the "base" wire or the transistor won't turn on). Also, current only flows through NPN transistors one way (they can be modeled as a switch in series with a diode, if that helps). So if you confuse the collector and emitter, current won't flow. By the way, I remember "collector" and "emitter" because current goes into the collector, so it collects the current. That is not why they are named that, but it's easy to remember. NPN transistors can be good if you really only need a simple switch between your load and ground. For example, my whistle-activated switch uses an NPN transistor to switch the coil of a relay on or off.
If you need to switch something on its positive side, PNP transistors can do that. They are used differently from NPNs. They also are worse at handling larger currents, so it's better to do things with an NPN if you can. If you find yourself thinking about using PNP transistors, it's probably better to just buy an integrated circuit, like an H-bridge, that does what you need to do.