I just purchased the most amazing relay from Mock Electronics. Now I'm being carried away with dreams of using several thousand of these little beauties to construct a simple 4-bit processor.
In my previous blog, Measuring a Building's Height With a Barometer, I mentioned that I've been invited to give a guest lecture at the local ITT Technical Institute here in Madison, Ala.
As part of this talk, which is planned for the evening of July 29, I want to give the students some real "hands-on" experience -- seeing and touching things like relays and vacuum tubes and so forth. Now, I do have a couple of relays lying around here in my office (who doesn't?), but these little scamps tend to be relatively modern -- being presented in transparent plastic packages, for example -- which doesn’t convey quite the sort of impression I'm hoping to achieve.
Thus it was that, on my way into work this morning, I took a detour via that downtown electronics wonderland known as Mock Electronics (see also Mock Electronics: An Eclectic Emporium of Electronic Elements and And that's when I said "D'oh!").
If truth be told, I'm happy for any excuse to visit the folks at Mock Electronics to discover any new antique delights with which they invariably tempt me. When I explained what I was planning with regard to my talk and asked if they happened to have any old relays lying around, I certainly wasn't surprised when they whipped out the little beauty you see below.
First of all we have the coil, which is wound around a soft iron core, and which can be energized using the two contacts "C1" and C2" (when I returned to my office, my chum Ivan immediately hooked this little beauty up to his power supply and we discovered that it switches at around 4V and consumes only 20mA; based on this, we assume it was actually intended for 5V operation). Next, we have an iron yoke, which provides a low reluctance path for the magnetic flux.
Then we have the armature, which pivots around the left-hand side of the yoke. When no voltage is applied to the coil, a spring pulls the armature such that it is held against contact "A." This means that whatever voltage value is being presented to "input" contact "A" is conducted through the armature to "output" contact "Y."
When the coil is energized, it attracts the end of the armature in the upper portion of this image, pulling it to the right. Since the armature pivots around the yoke, this causes the end of the armature in the lower portion of this image to move to the left, thereby disengaging from contact "A" and pressing against contact "B." Now, whatever voltage value is being presented to "input" contact "B" is conducted through the armature to "output" contact "Y."
The wonderful thing about the relay in the image above is that it offers such a beautiful combination of simplicity (of function) and sophistication (of implementation). Observe how everything can be quickly and easily adjusted, such as the positions of the contacts and the tension on the spring.
Depending on how you wire this up, it could act as a simple isolating buffer, where output "Y" = 0V (logic 0) if the coil is not energized or 5V (logic 1) if the coil is energized; or as an inverter, where output "Y" = 5V (logic 1) if the coil is not energized or 0V (logic 0) if the coil is energized. From this, we could construct AND, OR, NAND, and NOR gates; then XOR and NXOR gates; and then registers and so forth.
Yes, of course, you know me so well... now I'm being carried away with dreams of getting several thousand of these little beauties and using them to construct something like a simple 4-bit processor, but that's something we can talk about on a future occasion...
Let's return to the problem of implementing logic gates and registers using only the type of relay shown in the image above. If you haven’t worked with relays before, I bet your knee-jerk reaction is to think of using them in much the same way you might use transistor switches, but -- generally speaking -- it's not quite that simple. As you will soon discover, constructing logical functions using relays can involve a weird and wonderful mixture of simplicity and complexity; if nothing else, it encourages a lot of "out-of-the-box" thinking.
Now, rather than me just waffling on and explaining everything in excruciating, let's have some fun with this. As a starting point, can you come up with a circuit symbol and truth table that clearly and concisely represents the operation of this relay? (Please feel free to change the names of the various contacts I called "A," "B,", "Y," "C1," and "C2" to whatever you like if it better suits your purpose.) Based on this, can you create a circuit diagram for a single buffer and then for three of these buffers connected in series? Next, can you create a circuit diagram for a single inverter and then for three of these inverters connected in series.
How about creating a circuit diagram for 2-input AND, NAND, OR and NOR gates (a) in isolation, (b) driving one of your buffer gates, and (c) driving one of your inverter gates?
Let's leave things here for the moment. If you rise to this challenge, then we'll move on to consider how we might set about implementing register and memory elements.