Jacques Mattheij

Technology, Coding and Business

Electronics for programmers

If you came in to information technology from the ‘soft’ side and you view a computer as a chunk of black magic that allows your screen, keyboard and network connection to function and you are curious about what goes on inside then this article is for you.

We’ll start off with some very simple concepts and slowly expand to more complicated stuff, I’ll try to write this in such a way that a minimum of prior knowledge is required.

One of the more useful analogies to use when explaining electronics is that of a fluid, instead of the electrons that flow to do the work in any piece of electronics. This analogy holds so well that it is in fact possible to create a computer using nothing but hydraulics ( http://en.wikipedia.org/wiki/MONIAC_Computer ).

Electronics circuits are made up from components, much like software is written using building blocks called subroutines. And just like subroutines, some electronics components are built using other such components until you get to the bottom where components are ‘primitives’, you can’t simplify them further.


The most primitive component used in any electronics circuit is the conductor. Examples of conductors are pieces of wire (insulated or bare), circuit traces etched on boards of insulating material. Conductors and insulators are actually expressions of the same basic property, how well something conducts electricity. Things that allow electrons to move freely from one spot to another are called conductors and things that obstruct electrons in their flow are called insulators. The degree to which a substance has this property is called it’s specific resistance.

Metals usually conduct electricity very well, for instance, copper, aluminum, silver and gold all conduct electricity very well and have very low specific resistances.

In the fluid world a conductor would be called a pipe. Note that just like in the fluid world electrons need a place to ‘flow to’, water won’t flow unless it is downhill and electrons are no different, flowing from a higher potential to a lower one. (though because of their charge they actually flow the other way (electrons are negatively charged) for the purpose of understanding electronics at this basic level it is much easier to think of electrons as moving from a higher voltage to a lower one). This difference in potential is called a voltage, and any measurements are expressed in a unit called Volt.


On the opposite side of the spectrum there are the ‘good’ insulators, such as glass, most plastics and dry paper. Insulators are useful if you want to confine electrons to specific locations or paths that they should follow. If conductors are the riverbeds that the electrons flow through then insulators are the banks.


Then there is a whole range of materials in between. One of the more interesting ones of the in between variety is carbon, though you could use any other conductor as well (either by making it very long, or very thin). This conducts electrons only ‘so-so’, and because of that allows you to make a variety of resistances with great accuracy. Such pre-packaged ‘useful’ resistances are called ‘resistors’, and after the wires and conductors these are the second component that we can identify.

Resistors are a very common component, they exist in many different shapes and sizes, from large ones the size of a basball-bat on the roof of a street car to extremely small (you’d have to handle them with tweezers) or even smaller (integrated into the guts of other circuitry).

The water analogy is to think of a resistor as a restriction to the flow of the water. A narrowing of the tube the water flows through, or a rough surface that it has to flow over slowing it down.

Resistance is specified using a number, and the unit affixed to that number is the Ohm, typically indicated using the Greek letter Omega.

If you push enough current through a resistor the friction will cause the conductor to get hot, a principle that is exploited in electric heaters. If you push even more current through that resistor at some point it will get hot enough to glow, a principle which is used in the incandescent light bulb. The reason the bulbs are encased in glass is to create an oxygen poor atmosphere around the glowing wire so it can not oxidize (which is just a nice way of saying that that stops it from burning up), greatly extending its life.

Resistance, voltage and flow relate through a simple formula called Ohms law. The flow rate is measured using a unit called the Ampère.


A switch is a device that can be either a conductor or an isolator dependent on some mechanical effect, typically a button to push on or a lever that can be positioned.

When a switch is activated the electrical circuit is completed by pushing two conductors against each other.

The fluid analogy of a switch is a valve, when it is open the fluid flows freely, when it is closed there is no flow.


A potentiometer is a fancy name for a variable resistance. Typically these consist of a resistor of a certain value that a slide moves across to select a smaller or a larger portion of the resistor. This causes a decrease or increase of the flow of electrons depending on the direction in which the slide is moved.

In the world of plumbing such a device is called a tap.


Capacitors are two conductors separated by an insulator. When you ‘charge’ a capacitor you create an inbalance between the two sides of the capacitor, one side will have more electrons on it than the other. Discharging a capacitor means that you are restoring the balance between the two sides. Charging a capacitor takes energy from a source and discharging releases that energy again.

The fluid analogy to a capacitor is a bucket, and just like a bucket it takes some time to fill a capacitor. How much time depends on the size of the capacitor, and on the rate of flow. As soon as the level in the bucket is the same as the level in the source the capacitor is deemed to be ‘charged’.

How much charge a capacitor will hold is known as its ‘capacitance’, the unit of which is Farad. Because a Farad is a unit that is rather impractical it is common to see capacitors with values expressed in micro, nano or even pico Farads.

The ‘height’ of the fluid in the bucket is equivalent to the voltage to which a capacitor has been charged. Because a capacitor has an insulator between the two conductors there is a maximum voltage to which they can be charged. To stretch the bucket analogy a bit further, the thickness of the walls of the bucket determines how high the fluid can be stored, at some point the insulating wall breaks down.


Coils are conductors that are wound around some insulator to create a spool. Coils have tons of interesting properties, one of which is that if you energize one that you create a magnetic field. There is no readily available way to extend the fluid analogy to explain a magnetic field. Suffice to say that coils and magnetic fields go hand-in-glove, as soon as electrons flow through a coil of wire a magnetic field appears, and the reverse is also true, if you create a magnetic field near a coil that will cause electricity to be generated in the coil.

Someone noted that a circuit of one loop is also a coil and that a stretch of wire is a part of a coil and sure enough, those generate magnetic fields as well.


Enterprising people figured out that if you take two coils and place them near each other that you can send energy from one circuit to another even though the circuits are electrically separated from each other by an insulator.

By picking the relationships between the windings and the thickness of the windings transformers can also be used to increase or decrease voltages and currents.


Yet others found that since a coil is essentially an electro magnet (a magnet that you can engage and disengage using electricity) that you can use it to do work. For instance, you could attach a bit of metal to a switch and have the electromagnet operate the switch

Such an arrangement of an electromagnet and one or more switches that such an electromagnet operates on is called a relay. Relays are part of a class of components called ‘electro-mechanics’.

The fluid analogy is a pressure operated valve.


Electric motors are just about everywhere, it’s hard to think of society without them. They’re a further application of the electromagnetic forces described above, only instead of simply pulling on a switch to engage it the electromagnetic force is harnessed to create a rotary motion, which can in turn be used to do all kinds of useful work, for instance to drive a pump.

The fluid analogy of an electric motor is an impeller driven shaft, the flow of the fluid moves the wheel which in turn exerts a force on the shaft causing it to turn.


After this brief detour through the world of electro-mechanics back to ‘real’ electronics, the workhorse of the first digital revolution, the diode.

Diodes are interesting because they are the first of all components that we encounter that are not symmetrical. Electrons will flow readily in one direction but will be stopped when they attempt to go the other way. The earliest diodes were made from lead crystals with needle points touching the surface of the crystal. That’s characteristic of all diodes, there is some boundary layer between two or more materials that cause some non-linear relationship between the voltage and the current through the device to be exhibited.

In the fluid world we call such a device a one-way valve.

Some diodes have peculiar properties, some for instance are sensitive to light, some make light (Light emitting diodes, or LEDs for short). Some make coherent light (laser diodes) and some can change some of their parameters based on the level of voltage present. All of these have specialist applications but their ‘essence’ is that they are all diodes.


A very tight coupling of two diodes will form a device that we call a transistor. A transistor is an ‘active’ component. With the exception of the relay above all the components thus far are passive, they can only reduce the flow of electrons by smaller or larger amounts. But transistors have the amazing property of being able to amplify a signal (relays can do this too but in much more limited fashion). So a small flow of electrons can be used to regulate a much larger one.

The transistor wasn’t the first device invented to exhibit this property, before it the vacuum tube has shown that amplifiers were a practical possibility. But unlike transistors vacuum tubes required a large amount of energy to operate, generated copious quantities of heat and were notoriously short-lived and fickle. On top of that they were mechanically fragile.

The ability to amplify signals conveniently and using ‘solid state’ technology was so important that when the transistor was invented it revolutionized the landscape of electronics overnight. Stuff got smaller (much smaller!) and much more reliable overnight. Batteries became a usable source of power which engendered the portable revolution (a portable tube device was probably better described as a ‘luggable’).

There are many kinds of variations on the transistor theme, both basic variations as well as variations in the amount of power they can handle or the speed with which they can switch.

Digital Logic

Relays, diodes and transistors and tubes all shared the common property of being able to be used to implement something known as digital logic.

Digital logic is an interesting branch of electronics because it allows you do to something that is a cornerstone of computing: it allows you to build up a variety of basic circuits that can be used to create machinery that is capable of relatively complex operations on numbers that are represented by a series of carefully defined changes of state.

Some ‘programs’ are so simple that you could wire them up directly using a bunch of relays. An example of such a control program is what a 1970’s elevator would have used. Another example is a phone switchboard. But once a certain level of complexity is reached this method runs into scaling issues and it becomes harder and harder to create reliable circuitry.

Also, because relays are basically mechanical in nature you can only go so fast. Have a look at this relay based computer to see what the world of computation would look like if the transistor had not been invented ( http://web.cecs.pdx.edu/~harry/Relay/ shows a relay based CPU, be sure to check the video and note that the memory in that example is a chip, not made up using relays, if it would have been that computer would have been quite a bit larger)

Using diodes, for digital logic is feasible as long as you don’t need to invert signals. And that is unfortunately very important, in order to invert a signal you need an active component and diodes are strictly passive.

Vacuum tubes have been used to make computers, see for instance http://en.wikipedia.org/wiki/ENIAC . While faster than relay based logic vacuum tube computers were even more massive, required enormous amounts of power and generated equally enormous amounts of waste heat.

So we had to wait for the invention of solid state amplification to power the computer revolution. But once that had happened it didn’t take all that long for digital electronics to appear on the scene.

The basic arrangement of transistors that allows computers to be built up from essentially nothing but large numbers of transistors is called the NAND gate. NAND is a contraction of ‘not’ and ‘and’, it takes two (or more) signals, compares them and if all of the input signals are equivalent to a logic ‘1’ then the output is a ‘0’, otherwise it is a ‘1’.

With this very simple building block it is possible to create all the other higher level circuitry that allows you to build a modern computer.

A ‘bit’ of memory is easily constructed using NAND gates, the specific arrangement is called a latch or a flip-flop: http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29 .


Now, theoretically it is possible to build a computer from nothing but transistors arranged in NAND gate patterns. But this would occupy a fair amount of space and would require quite a bit of power. In order to reduce the space and the power required we’ve done as much as we can to miniaturize the circuitry, specifically the conductors, insulators and transistors.

First the devices themselves shrunk, then they were placed with tweezers on a common carrier, this was called ‘thick film’ technology. Then the carriers were shrunk even further and then then more than one transistor was fabricated at once and packaged. Thus the IC was born.

IC’s were initially limited to simple arrangements of transistors into more commonly used circuit fragments called gates (besides the NAND gate mentioned above there is a whole zoo of possible variations on that theme).

The next step after that was to create circuitry with a more specific function and many more transistors. With each step in this process the size of the transistors shrank until where we are today, with transistors a fraction of the size of a grain of sand, and circuits containing billions of transistors on a single chip.

So, that’s it. From piece of wire to NAND gate to ‘chip’.

The underlying bits and pieces of the computer you’re working on are deceptively simple, it is their arrangement into more complex patterns that makes it possible to do useful work. You could make one from any ‘level’ of the stack of electronics, the only reason why we build them the way we do is because that is the most cost effective way of doing so.