BASICS
Simple Circuit
The picture above shows a 'battery' connected to a 'light bulb' by a 'power wire' and a 'ground wire.' A power wire is a wire connected directly to the top of the battery. A ground wire is a wire connected directly to the bottom of the battery. Any electrical machine is called a circuit.
Simple Diagram
The diagram above also shows a 'battery' connected to a 'light bulb' by a 'power wire' and a 'ground wire.' This diagram means the same as the preceding picture. The ground wire is not shown because it is assumed that one connection of every light is always connected to the bottom of the battery by a ground wire in diagrams. Diagrams are simpler to draw than pictures that mean the same thing.
Key Circuit
The picture above shows the 'top of' a 'battery' connected by a 'power wire' to a 'key' that is connected by a 'light wire' to a 'light bulb.'
A key is a flat piece of springy steel that is bent up so that the key only touches the wire to the key's right when the key is pressed down by someone's finger.
When someone pushes the key down, the right end of the key touches the light wire and electricity flows from the top of the battery, through the power wire, the key, and the light wire, to the light bulb, turning the light bulb on.
When the key is released, the key springs back up. Now the key does not touch the light wire and electricity can not get from the key to the light wire to the light bulb so that the light bulb goes off.
Key Diagram
The diagram above shows the same circuit as the preceding picture.
Again, there is also a wire from the other connection of the light bulb back to the bottom of the battery, but that wire does not need to be shown because the other connection of every light is connected to the bottom of the battery and you know the ground wire is there without drawing it.
Electromagnet
The picture above shows the top of a battery connected by a wire to an electromagnet.
An electromagnet is a coil of (plastic coated) wire. An electromagnet becomes magnetic when electricity goes through it, just as a light bulb glows when electricity goes through the light bulb.
The wire that makes up the coil of wire that is the electromagnet has two ends (connections). There is also a 'ground wire' from the other connection of the electromagnet back to the bottom of the battery.
Electromagnet Diagram
The diagram above shows the same circuit as the preceding picture.
The wire that makes up the coil of wire that is the electromagnet has two ends (connections). There is also a ground wire from the other connection of the electromagnet back to the bottom of the battery, as in the picture, but that wire does not need to be shown because the other connection of every electromagnet is connected to the bottom of the battery.
Relay
The picture above shows a 'bottom key' that controls an electromagnet.
The electromagnet, in turn, controls the top key. A key and the electromagnet that controls it are, together, called a relay. The relay is in the dashed box.
When the bottom key is pressed, the electromagnet is powered and the electromagnet becomes magnetic. That makes the electromagnet attract the top key and pull the top key down just like a finger can push a key down. A magnet (or a powered electromagnet) attracts the top key because the top key is made of steel. A magnet (or a powered electromagnet) does not attract the wires because the wires are made of copper.
Important: The electromagnet does not ever touch the top key. No electricity can go from the electromagnet to the wires attached to the top key.
A computer is almost entirely made up of a lot of relays (today, transistors) connected by wires. Just how the relays are connected and just what they do is the main subject of this book. Other concepts, especially programming, will also be explained.
(Today, transistors are used instead of relays for lower cost and greater speed. The design remains practically the same, however. Relays are easier to understand and, so, will be used in this explanation.)
Relay Diagram
The diagram above shows the same circuit as the previous picture in a different way.
One Battery and Touching Wires
In this picture, only one battery powers all the circuitry in the previous picture. Note the symbol for wires that touch.
One Battery and Connected Wires Diagram
Loop
Loop Diagram
The picture and diagram above show a relay that controls its own electromagnet! The square of wire that takes electricity from the key of the relay to the electromagnet of the same relay is called a 'loop.'
No electricity can get from the top of the battery to the electromagnet because the key is up. However, if someone presses the key, then electricity can get to the electromagnet. Then, the electromagnet will hold the key down - even if the person lets go of the key! So we say that the loop remembers that the key was pressed. Remember that the key normally springs up because it is springy and bent upward.
Similarly, if someone then lifts up the key (A person is much stronger than a little electromagnet.), then no electricity will reach the electromagnet and the key will remain up even after the person releases the key. So we say that the loop remembers that the key was lifted up.
Most relays in a computer are used to make loops, or connect the loops together.
Pixel
Pixel Diagram
The picture and diagram above show a loop that controls a light bulb. A light bulb that is controlled by a loop is called a 'pixel.'
In a diagram, where a horizontal wire and a vertical wire meet, without crossing, there is a connection of the two wires.
Therefore, when the key is pressed, electricity can flow from the top of the battery, through the key, to both the light and the electromagnet. When the key is down and the light bulb is glowing, one says that the loop has value '1' and the pixel is 'on.' The loop has value '1' even if there is not a light bulb, just so the loop wire has electricity going through it, to the electromagnet, because the key is down.
When the key is up and the light bulb is not glowing, one says that the loop has value '0' and the pixel is 'off.' The loop has value '0' even if there is not a light bulb - just so the loop wire does not have electricity going through it (because the key is up).
Normally Closed Key
Normally Closed Key Diagram
The picture and diagram above show the top of a battery connected by a wire to a normally closed key, that is connected by another wire to a light bulb.
A diagram of an electrical machine is called a circuit diagram, a diagram, a schematic (pronounced ske-ma'-tic) diagram, or just a schematic.
The normally closed key is different from the keys described previously. The normally closed key is also a springy piece of steel, but is bent so that it normally is connected to the right wire. Therefore, the light bulb in the circuit above is normally on. However, if you push down on the normally closed key, the light bulb becomes disconnected from the 'power wire' and the light goes out.
A key is called 'closed' when electricity can flow through it from a wire on its left to a wire on its right. A key is called 'open' when electricity can not flow through it from a wire on the left to a wire on the right.
A normally closed key is normally closed, but is open when you push it down. A normally open key is normally open, but is closed when you push it down.
A relay is called closed if its key is closed. A relay is called open if its key is open.
An electromagnet is called 'powered' if the electromagnet is connected to the top of a battery, even if that electromagnet is connected to the top of the battery through a series of closed keys. In fact, any piece of wire is called 'powered' if that piece of wire is connected to the top of a battery, even if that piece of wire is connected to the top of the battery through a series of closed keys.
Any piece of wire that is powered is said to have value '1.' Any piece of wire that is not powered is said to have value '0.'
The values of the wire in a loop as described previously are a special case of these rules for assigning values to wires.
Normally Closed Relay
Normally Closed Relay Diagram
The preceding picture and diagram show a bottom key that controls an electromagnet. The electromagnet, in turn, controls the top, normally closed key. A normally closed key and the electromagnet that controls it are, together, called a normally closed relay.
When the bottom key is pressed, the electromagnet is powered and the electromagnet becomes magnetic. That makes the electromagnet attract the top, normally closed key and pull the top, normally closed key down, just like a finger can push a normally closed key down. A magnet (or a powered electromagnet) attracts the normally closed key because the normally closed key is made of steel. When the bottom key is pressed, the light turns off.
In other words, when the bottom key is pressed, the electromagnet energizes, disconnecting the top key.
Clear Key
Clear Key Diagram
The picture and diagram above show a loop as before, but a normally closed key has been added. As long as the normally closed key is closed, the loop works as before.
However, if the normally closed key is pressed, then the normally closed key will be open and electricity will not reach the electromagnet, so the electromagnet will not be magnetic, and the normally open key will pop up if it was down. If the normally open key already was up, it will stay up.
Therefore, pressing the normally closed key will clear the value of the loop to '0.' Therefore, this normally closed key is called the 'clear key' for the loop.
Loop to Loop Data Transfer
In the circuit above, the 'connecting key' connects loop A and loop B. Both loops have value 0. Temporarily pressing 'loop key A' gives the value 1 to loop A. Now, temporarily pressing the 'connecting key' will make loop B have value 1. That is because when loop A has value 1, loop key A is closed, loop wire A has value 1, and when the connecting key is closed, electricity can reach the electromagnet of loop B, giving loop B value 1.
However, if loop A has value 0, and loop B has value 0, and the connecting key is pressed, then both loops keep their values of 0.
Therefore, if one temporarily presses 'clear key B' to clear loop B to value 0, and then temporarily presses the connecting key, whatever value is in loop A will be copied to loop B. Then loop A and loop B will have the same value.
Oscillator
Oscillator Diagram
The picture and diagram above show a normally closed relay that controls its own electromagnet. The square of wire that takes electricity from the normally closed key of the relay to the electromagnet of the same normally closed relay is called a feedback wire. (Notice that this circuit is different from a loop circuit, which uses a normally open relay.) This circuit is called an oscillator because the relay oscillates (changes back and forth) between open and closed.
Electricity can get from the top of the battery, through the closed, normally closed relay key to the electromagnet. The electromagnet then pulls the normally closed key down and opens the normally closed key. Because the normally closed key is now open, no electricity can get to the electromagnet. The electromagnet now no longer attracts the normally closed key and the normally closed key closes.
Thus, the normally closed key repeatedly opens and closes without anyone touching the key. The feedback wire gets value 1, then value 0, then value 1, etc. It takes a relay about a hundredth of a second to change values.
Just as a normal loop is the basis of a computer memory, this feedback circuit is a key part of a computer's clock. A computer's clock is a circuit that repeatedly generates signals (1 and 0 values).
Keys in Series
Keys in Series Diagram
In the picture and diagram above, one must press both 'key D' AND 'key E' to turn the light on.
AND Gate Circuit
In the circuit above, the three triangles are all the top of the same battery. When 'key D' AND 'key E' close, then the light comes on. When 'key A' is pressed, then 'key D' closes. When 'key B' is pressed, then 'key E' closes. Therefore, when 'key A' and 'key B' are pressed, the light turns on. Another way of describing the operation of the circuit is to say that 'output wire C' gets value 1 only when 'input wire A' gets value 1 AND 'input wire B' gets value 1.
The bottom row of the following table also shows that 'output wire C' has value 1 (only) when both 'input wire A' has value 1 AND 'input wire B' has value 1.
AND gate truth table A B C 0 0 0 0 1 0 1 0 0 1 1 1
AND Gate Circuit with Symbol
The diagram above shows a circuit with the symbol for an 'AND gate' which is shown, alone, below.
AND Gate Symbol
The light in the circuit below only comes on whey key D, key E, AND key F are all pressed.
Three Keys in Series
Keys in Parallel
Keys in Parallel Diagram
In the picture and diagram above, one need only press either 'key D' OR 'key E' (or both) to turn the light on.
OR Gate Circuit
In the circuit above, the crossing wires do not touch. Crossing wires never touch! They are never connected. In the circuit above, when 'key D' OR 'key E' (or both) closes, the light comes on. When 'key A' is pressed, then 'key D' closes. When 'key B' is pressed, then 'key E' closes. Therefore, when 'key A' OR 'key B' is pressed, the light turns on. Another way of describing the operation of this circuit is to say that 'output wire C' gets value 1 only when 'input wire A' has value 1 OR 'input wire B' has value 1.
The the following table also shows that 'output wire C' gets value 1 only when either 'input value A' has value 1 OR 'input wire B' has value 1.
OR gate truth table A B C 0 0 0 0 1 1 1 0 1 1 1 1
OR Gate Circuit with Symbol
The diagram above shows a circuit with the symbol for an 'OR gate' which is shown alone, below.
OR Gate Symbol
Three Keys in Parallel
The light in the circuit above turns on when key D, key E, OR key F is pressed.
Normally Closed Key
Normally Closed Key Diagram
In the picture and diagram above, the light is on, as we have seen before. One must press the normally closed key D down to turn the light off.
NOT Gate Circuit
In the circuit above, the triangles are both the top of the same battery. When 'key A' is pressed, 'key D' is pulled down and the light goes off. That is, when 'key A' is pressed, normally closed 'key D' opens. Therefore, when 'key A' is pressed, the light goes off. Another way of describing the operation of the circuit is to say that 'output wire C' gets value 0 when 'input wire A' gets value 1. 'Output wire C' gets value 1 when 'input wire A' gets value 0.
The following table also shows that 'output wire C' gets value 0 only when 'input wire A' gets value 1.
NOT gate truth table A C 0 1 1 0
NOT Gate Circuit with Symbol
The diagram above shows a circuit with the symbol for a 'NOT gate' which is shown alone, below.
NOT Gate Symbol
Interconnected Gates
The diagram above shows that the output of an AND gate can be the input for a NOT gate. The circuit above can also be represented with gate symbols as below.
Interconnected Gates with Symbols
A 'NAND gate' can be constructed from an AND gate followed by a NOT gate as indicated below.
Constructed NAND Gate
A NAND gate can be represented by the single symbol in the circuit below.
NAND Gate Circuit
A lone NAND gate is pictured below.
NAND Gate
The truth table for the NAND gate is shown below.
NAND gate truth table A B C 0 0 1 0 1 1 1 0 1 1 1 0