logic

It’s time to do a series on logic including things such as programmable logic, state machines, and the lesser known demons such as switching hazards. It is best to start at the beginning — but even experts will enjoy this refresher and might even learn a trick or two. I’ll start with logic symbols, alternate symbols, small Boolean truth tables and some oddball things that we can do with basic logic. The narrative version is found in the video, with a full reference laid out in the rest of this post.

Invert

The most simple piece of logic is inversion; making a high change to low or a low change to high. Shown are a couple of ways to write an inversion including the ubiquitous “bubble” that we can apply almost anywhere to imply an inversion or a “True Low”. If it was a one it is now a zero, where it was a low it is now a high, and where it was true it is now untrue.

AND

Moving on to the AND gate we see a simple truth table, also known as a Boolean Table, where it describes the function of “A AND B”. This is also our first opportunity to see the application of an alternate symbol. In this case a “low OR a low yields a low”

NAND

Most if not all of the standard logic blocks come in an inverted form also such as the NAND gate shown here. The ability to invert logic functions is so useful in real life that I probably used at least three times the number of NAND gates as regular AND gates when doing medium or larger system design. The useful inversion can occur as spares or in line with the logic.

If you have a BeagleBone, you already have a lot of tools. We’ve seen them used in driving hundreds of LEDs at a very high frame rate, used as a video card for ancient computers, and as a software defined radio. For his entry to The Hackaday Prize, [Kumar] turned his BeagleBone into a 14-channel, 100Msps logic analyzer that’s good enough to debug just about all those hobby electronics projects you’re working on.

The BeagleBone is only able to have this sort of performance as a logic analyzer because of its PRUs, those fancy peripherals that make the Beagle great at blinking pins really, really fast. [Kumar] is using both PRUs in the BeagleBone for this project. PRU1 reads from the input probes, and PRU0 writes all the samples into DDR memory directly. From there, the samples are off to kernel modules and apps, either sigrok, dd, or something you coded up in Python.

Compared to the cheap logic analyzers we have today like the Salae Logic and the DSLogic, [Kumar]’s project is just as good as any commercial offering (provided you can live with 14 channels instead of 16), and because it’s based on a BeagleBone, the software is infinitely expandable.

[Bob] and [Aubrey] run the System Source Computer Museum a little north of Baltimore, Maryland. For an exhibit, they thought a visual representation of digital logic and came up with a two-bit binary adder. Yes, it’s just a full adder and exactly what you would find somewhere in the second or third chapter of any digital logic textbook. The way they’re illustrating how a full adder works is the killer feature here: they’re using EL wire for all of the wires connecting the gates.

The full adder is implemented with an Arduino Mega, but the interface is the real show here. On the left side of the display there are four illuminated toggle switches that show virtual electrons flowing through EL wires, through gates and finally out to a seven-segment display. The EL wires are controlled with an EL Escudo Dos shield – a good thing, since there are a lot of lines between switches, gates, and outputs.

You can check out [Aubrey]’s demo video that also shows off how they built it below. If you’re around Baltimore, you can check out the display at the museum.

You’ve seen CMOS logic, you’ve seen diode-resistor logic, you’ve seen logic based on relays, and some of you who can actually read have heard about rod logic. [Julian] has just invented optoisolator logic. He has proposed two reasons why this hasn’t been done before: either [Julian] is exceedingly clever, or optoisolator logic is a very stupid idea. It might just be the former.

Inside each optoisolator is a LED and a phototransistor. There’s no electrical connection between the two devices, which is exactly what you need in something that’s called an isolator. [Julian] was playing around with some optoisolators one day to create a weird push-pull circuit; the emitter of one phototransistor was connected to the collector of another. Tying the other ends of the phototransistor to +5V and Gnd meant he could switch between VCC and VDD, with every other part of the circuit isolated. This idea whirled around his mind for a few months until he got the idea of connecting even more LEDs to the inputs of the optoisolators. He could then connect the inputs of the isolators to +5V and Gnd because of the voltage drop of four LEDs.

A few more wheels turned in [Julian]’s head, and he decided to connect a switch between the two optoisolators. Connecting the ‘input’ of the circuit to ground made the LED connected to +5V light up. Connecting the input of the circuit to +5 made the LED connected to ground light up. And deeper down the rabbit hole goes [Julian].

With a few more buttons and LEDs, [Julian] created something that is either an AND, NAND, OR NOR, depending on your point of view. He already has an inverter and a few dozen more optoisolators coming from China.

It is theoretically possible to build something that could be called a computer with this, but that would do the unique properties of this circuit a disservice. In addition to a basic “1” and “0” logic state, these gates can also be configured for a tri-state input and output. This is huge; there are only two universal gates when you’re only dealing with 1s and 0s. There are about 20 universal logic gates if you can deal with a two.

You could cruise the Internet bazaars for a talking clock but you’ll never find one as awesome as this. Just look at it… even if it didn’t work it would be awesome.

[Art] certainly lives up to his username. His Rubidium-standard atomic real-time clock is surely an example of hardware art. The substrate is a collection of point-to-point soldered perfboard modules. Each laid out meticulously. What does such layout call for? A gorgeous enclosure which doesn’t obscure your view of the components. For this he went with a copper tube frame and a custom fabricated aluminum chassis pan.

For the circuit itself [Art] tells us he wanted to build something akin to the old HP nixie frequency counters so he went with logic chips. The pictures and a few video annotations are the only clues we have for how this works. Hopefully your encouragement in the comments will help prompt him to share more about that.

Oh, and the talking clock part that we referred to earlier? Every minute you get a readout of the time thanks to a PIC playing back audio using [Roman Black’s] BTc sound compression algorithm.

When [Thundersqueak] was looking for a project for The Hackaday Prize, she knew it needed to be a special project. IoT devices and microcontrollers are one thing, but it’s not really something that will set you of from the pack. No, her project needed to be exceptional, and she turned to logic and balanced ternary computing.

[Thundersqueak] was inspired to design her ternary computer from a few very interesting and nearly unknown historical computing devices. The first was the [Thomas Fowler] machine, designed all the way back in 1838. It could count to several thousand using a balanced ternary mechanical mechanism. The [Fowler] machine was used to calculate logs, and the usual boring mathematical tasks of the time.

A bit more research turned up the Setun, an electronic computer constructed out of vacuum tubes in 1958. This computer could count up to 387,000,000 with eighteen ternary digits. On the binary machine you’re using right now, representing that would take twenty-nine binary digits. It’s about a 2.5 times more efficient way of constructing a computer, and when you’re looking for the right vacuum tubes in 1950s USSR, that’s a great idea.

[Thundersqueak] isn’t dealing with vacuum tubes – she has a world of semiconductors at her fingertips. After constructing a few truth tables for ternary logic, she began designing circuits to satisfy the requirements of what this computer should do. The design uses split rails – a negative voltage, a positive voltage, and ground, with the first prototype power supply made from a 741 Op-amp. From there, it was just breadboarding stuff and checking her gates, transistors, and truth tables to begin creating her ternary computer.

With the basic building blocks of a ternary computer done, [Thundersqueak] then started to design a basic ALU. Starting with a half adder, the design then expanded to a full adder with ripple carry. We’re sure there are plans for multiplying, rotating, and everything else that would turn this project into a CPU.

Would you consider this to be doing math the old-fashioned way? Instead of going with silicon-based switching (ie: transistors) this 4-bit adder uses mechanical relays. We like it for its mess of wires (don’t miss the “assembly” page which is arguably the juiciest part of the project). We like it for the neat and tidy finished product. And we like it for the clicky-goodness which surely must bloom from its operation; but alas, we didn’t find a video to stand as testament to this hypothesis.

The larger of the two images seen above is from the register memory stage of the build. The black relay in the bottom right is joined by a ring of siblings that are added around the perimeter of the larger relays before the entire thing is planted in the project box.

Sure, simulators are a great way to understand building blocks of logic structures like an adder. But there’s no better way to fully grip the abstraction of silicon logic than to build one from scratch. Still hovering on our list of “someday” projects is this wooden adder.