About the article
This article does not assume any training in electronics.
Explanations of various components will be given, but only so much
as will allow you to understand what you are building without fully
understanding the details of the components.
I am not a trained electrician or electronics engineer. I may
make a few mistakes, so please be lenient, and correct me nicely.
Also, you can simply buy a board that will allow you to switch
lights with your personal computer. If you prefer to that, there are
links in appendix 1 to various websites that sell boards that will
allow you to do so.
These commercial boards are often a bit more expensive than
simply getting the individual components and soldering them
together. If we build the board ourselves, the combined cost of all
the components we will use will come to just a bit over 5 Euro.
Appendix 2 lists the item numbers of all components we will use for
the Conrad.de store. This is probably only useful for people in
Germany. Non-German readers should take a look at Appendix 3.
The basics of electricity
If you are familiar with current and voltage, you can skip this
Potential difference and voltage
An electrical voltage is the difference in potential between two
points. For example, a 5volt battery is labelled on one end +, and
on the other -. This means that there is a potential difference
between the + and - ends of 5 volts. If you connect the two ends,
the battery will seek to make both ends have the same voltage, and
so current will flow from - into +.
You can think of it as a can of water, one end of which is full,
and the other empty. The empty end is also very much larger than the
full end. If you connect them together with a pipe, water will flow
from one can into the other till they have the same level of water.
This level will be very low because the empty bucket was much
Potential difference is indicated with the V symbol, which stands
for volt. The + and - symbols indicate which side of the circuit has
excessive potential, and which has a lower or 0 potential.
Current, indicated with the A (ampere) sign, is the flow of
electricity as it tries to balance out the potential difference. If
you have a potential difference of 5v across two points, there will
be a flow from the higher potential to the lower potential. That is
A higher voltage will cause a larger current, much in the same
way as a pipe connected to a large tank will cause a stronger flow
of water from a pipe connected to it, when compared to a small can
So obviously, there is a relationship between potential
difference and current. This relationship is described as V=IR. R is
the proportionality constant between the two values, and is called
A short introduction to circuit boards and the components
we will use
is the circuit we will use to build our relay board that will be
controlled by the personal computer.
There are a number of electrical components that all
behave differently when they are placed in an electrical circuit.
These components are all represented with different symbols.
is the site where I get all the diagrams and descriptions of the
- If you understand the circuit and the components that are
indicated there, then you might want to skip this bit.
The circuit board
The board looks like your PC main board - you know - that green
thing in your computer. It is a physical thing, and the picture
above is merely a representation of it.
The lines represent current carrying connections between the
various components. The symbols all represent different components,
which will be described here.
A resistor is a component that reduces the current in our
circuit. Like the name already says, it acts as a resistance against
the current. If you introduce a large resistance into a circuit, the
current will drop proportionally.
Resistors are measured in ohms (Ω). A typical resistor is colour
coded to enable one recognize its value. A description of the colour
coding is available here.
This is how the resistor is represented in a schematic, such as
the one above:
A square represents a
resistor. You can view a gif image of the square here.
Sometimes (but not in our circuit diagram above), resistors are
represented with zigzag lines. An example is here.
A Diode is a simple electrical component that only allows current
to flow in one direction. When the current is reversed, for example
by switching the negative with the positive pole, then the diode
acts as a very large resistor, and blocks the current from flowing.
This has a limit however - if you screw the current too high, the
diode will go kaput and allow current to flow in the wrong
The diode is represented with this symbol:
The diagram shows us in which direction the current will flow.
The arrow points at the flow direction and the vertical line show
the direction which will block the current.
We all know LEDs. Those little green lights you probably have in
front of your computer. Well, L.E.D. is an acronym for "Light
Emitting Diodes". Yes, that is right, a LED is just a diode like
described above. Well, it also emits light:
Gif image available here.
You see, the symbol is the same as that of a diode, but has a few
squiggly lines which I suppose are to indicate the light being given
A relay is basically a switch. It is a mechanical switch that you
can control by applying a current to it. When you apply a current,
it flicks the switch to the on position. When you turn of the
current, it turns itself to the off position. There are other types
of relays (like solid state relays), which toggle themselves when
you apply a current, and do nothing when you turn off the current.
is a photograph of a relay.
A transistor is similar to a relay; the main difference is that
it is an electronic switch.
This is how a transistor looks like:
View gif image here.
To put it simply:
That is a very
simplified description of a transistor and how it functions in a
circuit. The internal functionings of a transistor are a bit more
- The wire sticking out of the bottom (emitter) with an
arrow on it leads to the negative pole of the battery, also called
- The wire pointing towards left (basis) controls the
switch. If a voltage is applied there, then there will be current
flow from the wire pointing upwards through to the wire pointing
downwards. The switch would then be on. If there is no voltage in
the wire pointing left, the switch is in the off position.
- The wire pointing upwards (collector) carries the
current that we want to switch on and off.
The circuit board and how everything works
*** Link to
diagram. Editor should replace this text with the image itself
The board pictured above is the board we will build. The board is
made up of only the components we have described above.
The diagram above is schematic ¨C it serves to show us how the
connections between the various components is going to occur, but
does not really represent how our physical board will look like.
a photograph of the finished board.
The interaction of the components
Note the following about power sources:
We have a 5volt current coming out
of our parallel port. Our goal is to use those 5volts to regulate a
220volt current. We will thus examine the circuit from the lower
left hand side, and see exactly what occurs.
- Our parallel port provides us with 5V, 2mA
- We connect an external 5v supply to control the relay to the
poles marked +5v
- The relay can switch up to 16A. My washing machine needs a 16A
switch, for comparism
There are three current flows in the circuit. There is the
current flow that is provided by our parallel port, and is switched
on and off with the PC. There is the current from an external 5volt
device, and which is switched on an off by the parallel-port current
with the transistor. There is the 3rd current that is isolated from
our components, and switched by our relay.
When we provide the 5volt potential difference from our parallel
That has explained the workings of the
circuit in general. You are wondering why we need all those other
diodes and resistors, are you not?
- The transistor is switched on, and acts as a switch for the 5v
external power supply. There is a resulting current flow through
the LED, and through the relay
- The LED goes on, and the relay switches itself on. The relay
thus flicks the electrical appliance we have connected to it into
- The resistors keep our current at sane levels. If we didn't
have a resistor, our current will be way too high, and our other
components will die fiery deaths
- The LED is just there to tell us when the circuit is switched
- The diode D2 is there to protect us from ourselves: if we swap
the negative and positive poles, it isn't very good for our
transistor. With the diode D2 present, we simply short-circuit the
wires, and protect our transistor
Once you understand the theory, then building the board is a
snap. First of all, you have to buy all the components; Appendix 3
has a list of all the components you should get. Those living in
Germany should look at Appendix 2.
When you have the components, you plug all the components into
the board following this
There is nothing complex about this, if you plug everything in
exactly as the picture shows, then you have built the circuit we
looked at above. Dotted lines indicate a part of the board where the
current carrying path should be sliced through to prevent current
The circle with the slash-through indicates a screw.
When everything is done, you will need a soldering iron and some
solder lead. Solder all the components to the board, and you are
done! Remember to make sure that everything was connected BEFORE you
solder, and not after ;)
Check that you connections are OK with a resistance measuring
meter, after which it is recommendable to test with two external
power sources such as adapters or batteries and not directly
with your PC parallel port yet.
Programming the board
After you have verified that your board is working properly, you
will want to trigger the board on and off with your computer. For
this, you just need to provide 5volt to the transistor circuit.
These 5volts can come from your parallel port interface.
This page describes which of the parallel port pins will supply the
5volt. German speakers will find this
resource detailing the parallel port and it's programming useful. This resource describing the parallel port in detail should also be read by all who want to further understand
what they are doing. This
You will need to switch off the single bits of the port
independently. If you wish to roll your own code, this site has got a good number of samples on how to do it. If you prefer readymade parallel port controlling software, then that site has some.
But your premier source for parallel port switching software
should be DiscoLitez.
Download the software, plug in the board, and start switching.
- Links to websites that sell ready-made relay boards:
- List of components we use, and their order numbers at
Conrad.de. This list is only relevant for users in Germany and
neighbouring countries, so it isn't translated for their convenience
- Relais-Leistungsrelais GER-1-E, 6 V [Order Number:
- D1-Universaldiode 1 N 4148 [Order
- D2-Universaldiode 1 N 4148 [Order Number:
- T1-Darlington-Transistor BC 517 [Order Number: 154695]
- LED-LED 3 mm grün
[Order Number: 184713]
- R1-Widerstand 1/4 W 5% 150 Ohm [Order Number:
- R2-Widerstand 1/4 W 5% 100 K-Ohm [Order Number:
- R3-Widerstand 1/4 W 5% 1 M-Ohm [Order Number :
- Schraubklemme 2-pol
[Order Number : 729787]
- Schraubklemme 3-pol
[Order Number : 729795]
[Order Number : 743992]
[Order Number : 527629]
- List of all the components we need, in English, and without order
- One Relay, that requires 6 V to switch, and can switch up to
- Two Diodes: 1 N 4148
- One T1-Darlington-Transistor BC 517
- One LED-LED 3mm Green
- Resistor (1/4W 5%) 150 Ohm
- Resistor (1/4W 5%) 100 KOhm
- Resistor (1/4W 5%) 1 MOhm
- Connector 2-poles (see picture here)
- Connector 3-poles
- Circuit board
of all the components.