Before you begin using microcontrollers, you'll need some basic electrical definitions:

Electricity The flow of electrical energy through some conductive material. more...
Electronics The process of using changing electrical properties to convey information. Electronic sensors convert one form of energy (light, heat, sound pressure, etc.) into electrical energy so that we can interpret what's going on electronically. For example, a microphone changes sound pressure waves in the air to a changing electrical voltage. By amplifying and reading that electrical signal, we can interpret what the sound was that caused it. This process of changing one energy into another is called transduction, and devices that do it are called transducers. Much of the technical work of physical computing is about figuring out what form energy a person is putting out, and what kind of transducer you can buy or build to read that energy.


In order to make circuits and build interactive pieces it's necessary to understand a few things about electricity.

The basics

Current The measure of the magnitude of the flow of electrons in a circuit. It is measured in coulombs per second, but this unit is more commonly referred to as amperes, or amps. If you compare electrical current to the flow of water, current would be how much water (or electricity) is flowing past a certain point. The higher the amperage, the more water (or electricity) is flowing.
current
Voltage The measure of the electrical energy of a circuit. To get the current to flow from one point to another, a voltage must exists between the two points. It is measured in Volts. In the water analogy, voltage would be the water pressure. Think of a geyser as high voltage, and the shower of a low-rent apartment on the fifth floor of a tenement building as low voltage .
Resistance The measure of a material's ability to oppose the flow of electricity. It is measured in Ohms. A sponge in the pipe would act as a resistor, limiting the current (and the voltage) flowing through the pipe.
A circuit A closed loop containing a source of electrical energy (like a battery) and a load (like a light bulb). Every circuit has to have a load of some sort. Electrical energy flows from the positive side of the source through a conductor to the load and from the load to the negative side. The load resists the flow of energy, converting it from heat to light.

All of the electrical energy in a circuit has to get used by the load. The load will convert the electrical energy to some other form of energy.
<—A very basic circuit, consisting of a lamp, a switch, and a battery. The electrical energy coming from the battery is converted to heat and light energy by the light bulb. the switch is the break in the circuit that stops the electrons from flowing.


A circuit with no load is called a short circuit. In a short circuit, the power source feeds all of its power through the wires and back to itself, and either the wires melt (if you're lucky), or the battery blows up, or something else disastrous happens. SHORT CIRCUITS ARE VERY BAD.

The two common kinds of circuits
DC, or Direct Current A Direct Curent Source supplies current on one wire and ground on the other. The voltage between them is constant with the supply wire always at a higher voltage.
AC, or Alternating Current Poles of the circuit are reversed in a regular repeating cycle. In one part of the cycle, one pole is at a higher potential (positive) and the other is at a lower (negative). In the next part of the cycle, the second pole is more positive, and the first pole is more negative.


Schematic Diagrams of circuits, with symbols representing the components in the circuit. Many of the typical symbols are shown below.


Electrical Components

Conductors Materials through which electrical current moves freely.
Insulators Materials which prevent the flow of electricity.
Resistors These provide resistance to the flow of electric current. The larger the resistor, the more opposition to current it provides. In doing this the resistor reduces the voltage of the electrons passing through it, and that energy is let off as heat. So an overloaded resistor gets hot, and can even melt (this is smelly) or burn (even smellier). Use them to control the flow of current. Current can move either way through a resistor, so it doesn't matter which way they're connected in a circuit. They are symbolized like this:

Resistor Chart and info

Capacitors Store up electricity while current is flowing into them, then release the energy when the incoming current is removed. When the charging voltage is removed after the capacitor is charged, the capacitor can push the electrons back through into circuit. This results in smoothing out peaks and valleys in a varying voltage. The larger the capacitor, the more energy it can store. Sometimes capacitors are polarized, meaning current can only flow through them in a specific direction, and sometimes they are not. If a capacitor is polarized, it will be marked as such on the diagram. Don't wire a polarized capacitor backwards; it might explode. Capacitors are symbolized like this:


Diodes Permit the flow of electricity in one direction, and block it in the other direction. Because of this, they can only be placed in a circuit in one direction. They are symbolized like this:

They are usually made of glass and have a black or yellow band at the end.The band is on the cathode side (negative).
Light-Emitting Diode (LED) A special type of diode which emits light when current flows through it.

led

They are symbolized like this:

switches Control the flow of current through a junction in a circuit. These make contact between two wires or break contact between two wires. The spring loaded switches are classified as normally open (NO) or normally closed (NC). NO switches have the connection open, or broken, unless the switch is pushed. NC switches have the connection closed unless the switch is pushed. This is the symbol for switches: :


transistors and relays Switching devices. Transistors can be switches or amplifiers. We'll be using them as switches, which can be turned on and off electronically. Large amounts of current are controlled by very small currents. Normally a transistor provides very high resistance between the collector and the emitter; it allows no current through. However, once there is a small current through the base to the emitter, the resistance between the collector and emitter plummets, allowing current to flow.

There are two types of trasistors NPN ad PNP. These two types of transistors do the same thing but using inverse signals to do so. The NPN turns on when the base has a high signal(+) applied to it. The PNP turns on when the base has a low (-) signal applied to it.
Symbolized like this:

Potentiometers Potentiometers (pots) provide a variable resistance; twisting the shaft changes the resistance to allow more or less current through. This should control the brightness of the light bulb,or the volume of the buzzer.
thermistors Change resistance in reaction to varying temperature.
photoresistors Change resistance in reaction to varying light.
flex sensors Change resistance in reaction to being bent or flexed.
piezoelectric devices Create a varying voltage in reaction to slight changes in pressure.

Relationships

Voltage (V), Current (I), and Resistance are related (R) are all related, by the following formula:
Volts = Amps x Ohms, or

V = I x R

Current (I), voltage (V), and resistance (R) are also related to electrical power (P) (measured in watts), as follows: Watts = Volts x Amps or

W = V x A

A 120-watt light bulb needs 1 amp at 120 volts.

Electrical current flows from places of higher potential energy to places of lower potential energy (i.e. from positive to negative).

Ground is the place in a circuit with where the potential energy of the electrons is zero. Sometimes this point is connected to the actual ground, either through a grounded electrical circuit, water pipe, or some other method. Basically, any conductor that goes to the earth will do.



A few important rules:

Current follows the path of least resistance to the ground. The better the conductor, the eaasier it is for the electrons to flow. If the electrons have a choice of two paths in a circuit, and one has less resistance, that's the path they'll take. If you have a wire from pwer to ground, there is no resistance. Electricity will follow that path, rather than go through your circuit.

In any given circuit, the total voltage around the path of the circuit is zero. Each component that offers a resistance lowers the voltage, and by the time we reach the end of the circuit loop, there will be no current left. Extra energy is converted to heat. If there is too much energy, your components will overheat and stop working.

The amount of current going into any point in a circuit is the same as the amount coming out of that point.

These last two rules give us a way to figure out what's going on when we put components in a circuit. When we look at how components in a circuit are placed in relation to each other, there are two ways we can do it:

  • One in line after another or in series with one another.

    Series circuit


  • Side by side or in parallel with one another.
    Breadboard parallel circuit
    light bulbs in parallel with breadboard
    parallel circuit diagram
        parallel circuit diagram

When components are in series or in parallel

When two components are in series, they are placed one after another, like so:

When resistors are in series, the voltage drops down across each resistor, and the total resistance is equal to the sum of all the resistors. We know in the above circuit, the current anywhere is constant. We know the voltage drops across each resistor, and we know the total voltage at the end is zero. So Vin = V1 + V2. If we know the values of the resistors, we can use the formula V= I x R to calculate the exact voltages at each point.

When two components are in parallel, they are placed beside each other, like this:

For resistors in parallel, the voltage across them is equal, but the current is divided between them. The total current is constant, however, so we know that the divided current across the parallel resistors is equal to the total current. So I1 + I2 = Itotal.

Though it's sometimes useful to think about the mathematical relationships of parallel and series circuits, it's often more useful to think about them in terms of practical effects. Again, think of the water metaphor. For the series example, if one resistor lowers the voltage (water pressure), only a smaller voltage (trickle of water) gets through to the next. For the parallel example, the amount of water from the main stream (total current) gets divided into two streams, but the total amount of water flowing through those two streams is equal to the original amount of water. Keeping in mind these basic relationships will help you figure out what the effect of one component is on another when you see them in a circuit together, even if you don't know (or care about) their precise mathematical relationship.

Ohm's law practice

When you're ready to begin building circuits, read the notes on breadboards for a quick introduction to how to use a solderless breadboard.