Analog Logic

Let’s take a look at logic modules. I was inspired to make one for the usual reason - I had a specific idea of what I wanted, and couldn't find any existing module that checked all the boxes. Namely, I wanted something flexible yet simple, that takes up only a few hp, is patch programmable, and can be used on analog signals as well as clocks and gates.

So lets take a look at how logic modules work, and the process of designing one that covers all the bases.

Circuit Design

Logic circuits at their most basic look like this:

On the left is an OR circuit, and on the right is an AND circuit. The output of the OR gate will be high if either Input 1 or Input 2 is high, while the output of the AND gate will be high only if Input 1 and Input 2 are both high.

The way these work is pretty simple; let's look at the OR gate first. The pull down resistor R1 pulls current through both input diodes toward the output. Diodes only allows current to flow one way, from anode to cathode. If the anode is at a higher voltage than the cathode, current will flow through the diode and the voltage at the cathode will be raised to match the voltage at the anode. If the anode is at a lower voltage than the cathode, the diode will block current from flowing and the output voltage will not change.

So let's say we have different voltages at the two inputs: 5V at Input 1 and 0V at Input 2. Diode D1 will allow current to flow, raising the output to 5V. Diode D2 will then have 0V at the anode and 5V at the cathode, so the output will be held at 5V.

The cool thing about using analog components is that we can work with continuous voltages - so if we have 3.5V at Input 1 and 6V at Input 2, the output will be 6V. It will always output whatever the highest voltage is at any given time. If we patch in two triangle LFOs at different frequencies, the output will look something like this:

The AND circuit functions similarly, but with the opposite result. The pull up resistor R2 pushes current through the diodes back toward the inputs, and whichever input is lower determines the output voltage.

Unfortunately, in the real world, diodes introduce a voltage drop. I want to avoid that; I want the output to be exactly equal to the highest or lowest input. After poking around for a while, I found DJB's Analogic Module, which uses superdiodes to remove any voltage drop.

I talked about superdiodes a little in my Slew Limiter post - they are useful when you need a diode but also want precise voltages. By dropping one of these in place of each diode, our circuit now looks like this:

DJB also included a low pass filter and buffer after the logic circuit. I think the filter is there to remove oscillations introduced by the op-amp, and the buffer is there to separate the op amp inputs from the output jack and whatever modules are patched downstream.

So that's the core of the logic module. At this point, I'm going to start to tailor it to my needs. I want it to be analog, which we have accomplished. I want all outputs to be available simultaneously, which will require more op amps. And beyond that, I want more inputs and outputs.

I decided to go for three inputs and three outputs. We already have a min and max output... for the third output, I decided to figure out a way to determine the "mid" signal, the input value that is neither minimum nor maximum.

(Note - at this point I am moving away from the terms AND and OR and will be using Min and Max instead, since those are the analog equivalents)

Well, we can do that with arithmetic! One of the inputs will always be equal to the maximum output. Which specific input that is, is not constant - but there will always be exactly one input that is equal to the max output. Similarly, there will always be one input that is equal to the minimum output. Therefore, we can calculate the "middle" output with this equation:

In 1 + In 2 + In 3 = Min Out + Mid Out + Max Out

Mid Out = (In 1 + In 2 + In 3) - (Max Out + Min Out)

That equation can be expressed in a circuit like this:

U1A and U1B are both inverting amplifiers. The voltage at each one's output is equal to the sum of its input voltages, multiplied by -1. So U1A's output voltage is equal to -(In 1 + In 2 + In 3), and U1B's output is

-(Max Out + Min Out - (In 1 + In 2 + In 3))

Which can be simplified to

(In 1 + In 2 + In 3) - (Max Out + Min Out)

There is one problem with the circuit: Op amps can't output voltages higher than their power supply. If the sum of the three inputs is higher than 12V, this won't work correctly.

We can solve this by adjusting the resistor values so that U1A's output is low enough that it will never go above 12V, and then boost it back up it when it comes out of U1B.

I chose to use resistor values with a 1:10 ratio. Now if all inputs are maxed out to +12V, U1A’s output will only be -3.6V and U1B will output the desired voltage, +12V.

Let's put it all together and take a look at the complete circuit:

Interface Design

Before I settled on the final design, I had to decide how much hands-on control this module should offer. I mocked up three potential designs: a 4hp version with no knobs; a 6hp version with an attenuverter for each input; and an 8hp version with attenuverters and offsets. I figured it might be fun to really push the signals around, and the knobs would also let you adjust static voltages normalled to unpatched inputs.

I elected to start with the Goldilocks option, in 6hp. I built one and used it for a few months, and found that I really didn't turn the knobs all that often. So I settled on the 4hp option for the final design. Also, by eliminating the pots and knobs, the total cost of all the components for this module comes out to around $6 - not bad!

With that decision out of the way, there are new issues that arise: how to label the inputs and outputs on such a small panel; how to normal the inputs so that the module can still be used with one or two left unpatched; and how to communicate what the outputs are doing with only a couple of LEDs.

First, the LEDs. The first draft of the module used bicolor LEDs to indicate positive and negative voltages. It worked, but I didn't love the results. The only bicolor LEDs offered on Tayda are red/green, which I felt was a little confusing. It wasn't obvious to me which should be for positive voltages and which for negative - and I like for my modules to be immediately intuitive. Also, it bugged me that the same amount of current produces different levels of brightness on each polarity.

I took some inspiration from Mutable Instruments, who had just released their updated Shades module around the time I was working on this. They used a yellow LED for positive voltage and an orange LED for negative. I tried out a bunch of different color combinations, but ultimately decided I liked it best when both LEDs were the same color.

Next decision: how to normal the inputs. The biggest drawback of the slim 4hp size, to me, was not being able to control the normal voltage when an input is unpatched. I don't want them to be ground all the time. If that were the case, if one input was left unpatched, the Max output would never be able to go below 0V and the Min output could never go above 0V.

That can be desirable, but I didn't want it to be the only option. So I decided the best compromise would be if each input were normalled to a different voltage. One is -5V, one is 0V, and one is +5V. That way, you can use two inputs between the range of -5V and +5V without any rectification-type effect - if you choose.

Now, how to communicate all this to the user in just 4hp. I want the module to be easy to use; I hate it when I need to stop patching to consult the manual. I decided to visually separate the inputs and outputs by drawing a box around each group, and labelling them "ins" and "outs." Inputs are labelled with their normalled voltage, and outputs are labelled "Min" "Mid" and "Max." LEDs are arranged in a small matrix at the top of the panel, with negative voltages on the left and positive voltages on the right.

The last thing to decide was the name. I didn't want to call it something plain like "LOGIC," since I feel the Middle output is a unique feature. The name needed to be short though, the panel is less than an inch across. I considered "Spock," but searched modulargrid and saw that Intellijel had already put out a logic module with that name (long discontinued, but still).

I decided to lean away from the logic aspect, and instead focused on the modules ability to sort signals into layers - high, medium, and low. In geology, the word STRATA refers to mostly flat, horizontal rock layers stacked atop one another. I felt that word contained a nice sort of metaphorical image of what this module does. Plus it fits in 4hp!

Previous
Previous

Lo-Fi Delay/Filter Effect

Next
Next

CMOS Clock Dividers