You don't have to know a lot about why your circiut works to get started. Instead you can learn to make a rote translation from the electronic diagram called a "schematic" to the actual attaching of wires. You don't have to know much because we only need to make enough of a circuit to transduce the energy into digital form and then do all the rest in software.
Ground. This is the simbol for the negative side of the power. It is the ambition of all good electrons to flow to ground. Ground one of the most popular destinations in your curcuits so we usually reserve a big long line of holes on your breadboard for it. An electron only recognizes its own ground so in circuits with two power sources, you may have to connect the negative sides of different DC power sources to the same common ground.
Switches. Switches allow or interrupt the flow of current. Switches usually have two interchangable leads. In addition to the explicit switches that you buy in the switch section of Radio Shack or your hardware store, you may be interested in switches that your audience is not fully conscious of. The burgalar alarm section is a good place to find these. You can also grow your own switches. Inside a switch are just two peices of metal that either touch or don't touch. Because the electricity that are going through our circuits won't hurt you (unlike the electricity that is going through wall switches) you can invent ways for two peices of metal to touch or not depending on what a person does.
Resistors. Resistors give electricity something to do. Electicity without something to do is a short circuit and a bad thing so you will have to at least some resistance in every circuit. Resisitors usually have two leads with no polarity (no positive and negative side) so the leads are interchangable. You can identify different resistors by; 1) the package; 2) decoding the stripes from a chart; 3) check it with a multimeter. Resistors are also rated in Watts but even the tiny ones (1/4 watt) resistor are fine for these circuits.
Capacitors. Capacitors store up electricity. They have two leads. Sometimes it doesn't matter which side you connect. If you are using a polorized capacitor, a + or - sign should be printed on the outside of the capacitor itself. Match the + side up with the + side in the schematic.
Diodes. A diode is like a one way street that only allows electricity to flow in one direction. LED's emitt like in the process. They have two leads, a Cathode and an Anode. You may have to consult the packaging or the outside of the diode itself to tell one lead from another. The longer leg being positive is one common convention for distinguishing the two leads.
Variable Resistors. Variable Resistors discourage the flow of electricity to varying degrees. They have two or three leads. When they have two leads you can connect them any which way. With three leads use the middle lead and then one of the other two that works best.
Connected Wires. When there is a dot at the joint in the diagram, then the two wires should touch each other.
Unconnected Wires. When two lines skip over each other, the wires they represent should not touch. They cross only for convenience in making the diagram.
Transistors. Transistors are like switches that are switch by a electricity instead of by your finger. Transistors usually have 3 leads, a Base, a Collector and an Emitter. When the base gets electricity, it connects the Collector with the Emitter (for an NPN transistor). You can't use a transistor for switching something which uses AC power (use a relay instead). Keep the packaging for your transistors because it may have a key for telling which leg is the Base, Collector and Emitter.
You will run across all these units for describing electricity. I look at it like a bus driving off a cliff. The height of the cliff is the Volts. This is easy to remember because things at the top of the cliff (like all good electrons) will move towards the "GROUND." How many people are on the bus is the current measured in amps. The Ohms is like the wind resistance or shrubbery on the side of the cliff. Watts are the power of the impact at the bottom of the cliff. Volts is often a given for example 120V from a AC wall socket or +5 volts DC from a microcontroller.
If you have a switch or a relay, they are only rated as being safe for a certain amount of amperage. To figure out how many amps in your circuit, you can use the formula Watts (size of disaster) = (Volts (how high the cliff) multiplied by Amps (how many people on the bus) so for example a 120 Watt light bulb using 120 Volts uses 1 amp.
Ohm's law describes the relationship between resitance, current and voltage. This would be useful if we were designing curcuits (knowing that your microcontroller might be putting out 5V at 20 milliamps you could calculate the resistance needed) but we are not designing circuits so I won't go on.
Because I have a naive way of thinking about these things I am encouraged by the fact that electricity actually flows in the opposite direction of all the diagrams that engineers use. Apparently Ben Frankliin figured that electrical particles probably flowed from positive to negative (from the top of the cliff to the bottom). By the time scientist could see that in fact electrons flowed to the positive, I guess they figured it didn't matter so much so they kept all the diagrams the same. This is what I am told. If many engineers choose to view it as the more intuitive positive to negative flow, it should give you liscence to adopt whatever model you like for all this stuff as long as it works).
It is best to use 22 AWG solid wire with the experimentor board because it is stiff enough to be easily fed into the holes on the board. This wire is not so good when you need to run multiple wires (say you have ten switches to wire up) or for long distances because it gets messy. For these and others purposes you may want to use a more flexable stranded wire like ribbon cable or telephone wire which cannot be forced into the experimenter's board very easily. To solve this problem you can; 1) solder solid wire to the ends of the soft stranded wire; 2) solder wire wrap ends sold at radio shack to the ends of the stranded wires or 3) (Best) solder "headers" not sold at radio shack but you can get from any electronics catalogue to the ends of the stranded wires. A couple of alligator clips or test leads (Radio Shack# 278-016A) can come in mighty handy when your wiring is at an experimental stage.
Checking for continuity is even more useful. Continuity means that there is a good connection. If your multimeter doesn't have a thing called "continuity," you check for 0 resistance. First set the multimeter to one of resistance (ohms) scales. Continuity is more convenient because because it beeps and you don't have to look back at the multimeter's display. When you touch the probes of the meter together, the it should react by beeping (if you have a continuity setting) or showing 0 resistance. Now you can stick those probes at different points in the circuit that you expect to have good connections and see if they are in fact good. Don't leave your meter in the resistance mode because it uses up the battery.
The intuitive part of this circuit is where the Stamp's pin either
touches 5V or not depending on the position of the switch. The problem is
that when the switch is open (not touching) the pin would be waiving in the
breeze. We need to tie it down to a default position. We can take advantage
of the fact that electricity always goes along the path of least resistance.
While the switch is open, the current from the microcontroller's pin goes
along the resistor towards the ground because it is the only game in town.
The pin then feels LOW (0) (Ground). When the switch is closed the path
towards +5V is unimpeeded by a resistor and so looks more appealling to the
electrons. Now the pin feels HIGH (1) (5V).
Also
See
Digital
Input Catagory
Digital
Input Program
Digital
Input Transducers
Table
of Contents
The easy (naive) way to look at this circuit is that the stamp sends out 5V and depending on how much resistance the variable resistor is providing, a certain percentage of that 5V comes back. (Actually the stamp is sending out some juice and then timing how long it takes the capacitor in the ciruit to discharge.) Depending on that percentage, the microcontroller gives you a number (0-225) that descibes the analog state of the variable resistor. All this happens really fast when you give your Stamp the POT command.
Also See
Analog
Input Catagory
Analog
Input Program
Analog
Input Transducers
Table
of Contents
With digital output you are usually turning things on and off. Which circuit you use will depend on the power requirements of the thing you are controlling. The simplest way is to turn on an off a LED which is small enough that the microcontroller itself can power it.
You can use a transistor as a
switch which is thrown when power is applied to its base. You only need to
apply the microcontroller's 5 Volts and the transistor can switch far
greater voltage. In this way the transistor is acting as an amplifier. THIS
CIRCUIT WILL NOT WORK FOR AC POWER (LIKE THE POWER FROM A WALL SOCKET). You
can only use this with DC circuits. You should also check the transistor's
package to see that it meets your load's voltage and current requirements. A
common mistake with this circuit is not comingling the ground of the stamp
with the gound of your DC load. You need to combine these grounds for the
circuit to work.
Finally if you want to turn something on
that uses electicity from a wall socket AC power, you have to add a relay to
the circuit. This adds another level of amplification and isolation from the
microcontroller. The transistor can switch the kind of power the relay needs
and the relay can switch the kind of power your AC appliance needs. Check
the package of the relay to see that it meets your AC load's voltage and
current requirements. The LED and capacitor are only there to eat up the
charge that the coil in the relay kicks back into the circuit when it turns
off. There are 5V (TTL compatible) solid state relays that make all this
easier. Please be very careful
and fully test the circuit (you can hear the relays click) before you add
the AC Power.
Also See
Digital
Output Catagory
Digital
Output Program
Digital
Output Transducers
Table
of Contents
Your microcontroller does not itself have enough power to drive anything but tiny electrical components like a LED or a Piezo transducer. To power real electrical appliances you would have to amplify the signal coming from the stamp. For now, just try using the Pulseout command with and LED or Piezo.
Also
See
Analog
Output Catagory
Analog
Output Program
Analog
Output Transducers
Table
of Contents
Put a 22k resistor between the transmit pin of the computer and the SERIN pin of the stamp. You can directly connect the the recieve pin of the computer to the SEROUT of the stamp. The resistor is to protect the stamp which operates at lower voltages than real RS232 devices. You may also attatch the "Ready to Send" (RTS) line of the MAC to the stamp. One thing about the stamp is that the SERIN Command totally freezes the stamp until some serial communication comes in. You can use the RTS line attached as an ordinary digital input to tell the stamp that it is safe to use the SERIN command because you are about to send something.
The stamp operates at 5V which is lower than proper R232 communication. The MAC which really uses RS423 communication is also a lower voltage so everything works fine. There is a circuit that you can add to your stamp to make it real RS232. If you are communicating with something like a laserdisc player which has a choice between RS232 and TTL, use TTL.
Also See
Serial
Communication Catagory
Serial
Communication Program
Table
of Contents