A relay is an electrically operated switch. When you turn it on, it switches on way. When it is off, it switches the other way.You can use a relay to switch on and off a high current device, like a coffemaker.
A relay has an electromagnet, called a coil, and a lightweight switch inside it. When you energize the coil, a piece of the switch is attracted by the coil's magnetic field, which switches the switch on or off.
The following schematic shows the basic circuit.
Attach the circuit to one of the HC11's port pins. Use the switch terminals of the relay to switch the device on and off.
The transistor allows the HC11 to control the relay's medium-sized coil current. The diode prevents the relay from arcing by providing a return path for the energy stored in the coil's magnetic field, extending the relay's life.
Some relays have more complicated switching configurations than the one in the picture, for example, some have several switches in parallel. Other relays, called latching relays, have two or more coils and a mechanical latching mechanism inside. A momentary pulse on one of the coils switches the switch. The switch stays switched until you put a momentary pulse on the other coil.
If the relay dosen't seem to do anything, it may have the wrong coil voltage. Most relays have a 12 volt coil, but some have a five volt coil. Five volt coil relays are easier to use, since you don't need a high voltage power supply. If you have a twelve volt relay and want to put it on your board, you might try putting nine volts (which is avaliable on the board) on the coil instead of five volts, as shown in the schematic.