Designing analog modules is fun, but digital are simpler
Updated: Mar 5
Some months ago I posted about my efforts on making modules that are less affected by the semiconductor shortage. It is already 2022 and I'm still not able of producing more Freak modules. The Freak module uses a very popular microcontroller and those are hard to get. In general finding STM32 microcontrollers is still complicated and the cost are quite high. For that reason, I decided to design modules using only analog components.
Analog components are somewhat available, specially in through-hole packages. Since I spend a lot of time modeling analog circuits, I have acquired a bit of knowledge on the design aspects. Analog circuits are a lot of fun, but as you will see later in this post, there are a lot of caveats that make the designing and assembling more challenging.
Feigen is a module that I designed some time ago and it is available for VCV Rack and also for Voltage Modular. The module is inspired by the Logistic Map. The underlying equation is simple and it requires few operations to be calculated. This made it a good target to be replicated as analog hardware.
You can see Feigen in action on Omri Cohen's video:
The following figure shows a simplified block diagram of the internals of Feigen. The module is driven by a clock signal. Every time a clock is received, the internal "state" is moved forward according to the Logistic map equation. Basically, we need to calculate the "next state" and when a clock is received, the current "state" takes the value of the "next state".
Let us take a look at how to calculate the "next state" using analog components.
To calculate the next state we need two multiplications and one subtraction. Subtractions are easy to do in analog using simple op-amp. Multiplications are a bit more complicated to do in analog.
We could do the multiplications using an IC like the AD633. That IC is described as a "low cost" analog multiplier. However, as of today, the cost of one AD633 is $19 dollars. That's in my opinion quite expensive. Since we need (at least) two, that accounts for $38 dollars. That is quite high. With $38 it is possible to buy a Raspberry Pi 4 which can do much more than two multiplications.
A cheaper alternative is using VCAs. The main difference of a multiplier compared to a VCA is the number of quadrants of operation. A multiplier works in four quadrants, this means that it can multiply two values and these can be positive or negative. A VCA can multiply in two quadrants. Specifically, one of the values can be either positive or negative, while the other has to be positive. With a VCA we cannot multiply -1 by -1 and get +1.
Fortunately for us, the Logistic Map equation has to perform operations on positive values, therefore a two quadrant multiplication is enough. The main issue to consider a VCA as multiplier is that the VCA must accept linear control voltage. Most VCAs are logarithmic because they are made to control the perceived volume of a signal. Linear VCAs are less common, but they are available. A good candidate is the AS3364D which consists of four linearly controlled VCAs. This would have been quite good for Feigen. However, when I was trying to make a protoype, those ICs were not in stock. That lead me to try a third alternative: Operational Transcoductance Amplifiers (OTA).
OTAs are widely used in synthesizer circuits thanks to their wide range of applications. OTAs can be used as VCAs and by default the control signal is linear. The LM13700 is easy to obtain. The DIP version has been discontinued recently but the SMD versions are still in active production. Since I have a few LM13700 in my parts box I decided to use them in my first prototype.
The following figure shows the simplified implementation of Feigen using OTAs as multipliers.
In order to design the circuit, I created a simplified model of the OTA in the best simulator around there Wolfram System Modeler, which coincidentally I work on developing it. The model was based on the measurements I made in one of my OTAs. That model was not extremely precise but it was very useful to determine the values of the resistors and capacitors used.
One thing that I quickly learned when testing the VCAs is that the LM13700 has a bit of variability. The variability in gain and offset, in addition to the variability of the resistors involved in the circuit is large enough to make necessary adding a few calibration trimpots. I needed to add 3 trimpots in order to calibrate the circuit. I used 20 turns trimpots and those can cost more than $2 each. That adds up to $6 which is more costly than a basic microcontroller.
Once the core equation is being calculated, now I need to be able of moving the state forward at each clock step. In order to do that, we need a Sample & Hold (S&H) circuit. An S&H can be constructed out of a few discrete components, like a op-amp, capacitor and FET. However, there exist chips that perform that task in a single package. For example the LF398, which can be used as well as a single pole two throw switch. One important thing to notice is that these analog S&H perform continuous sampling while the trigger signal is active. This behavior is illustrated in the following figure.
In the case of Feigen, it is not possible to use a single S&H because our circuit has feedback. To illustrate this problem, consider the following diagram that intends to be a counter.
In that diagram we can see that we use the output of the S&H in order to calculate the next state, which in the case of a counter, it is the state + 1. The next state is feed back to the S&H. When using an ideal S&H, every time the clock signal is received, the input signal would be sampled, then a "small pause" would be performed, then the sampled voltage is sent to the output. When using an analog S&H like the LF398 the "small pause" is not present: the input signal is immediately sent to the output. Since the output is used to calculate the input.. and the input is used to calculate the output... we have a feedback system that will be solved as fast as the analog components can (which will be very fast). The effect we will notice is that the output goes immediately to the maximum possible output.
In order to solve that problem, we can add a second S&H in order to create a two stage S&H that includes the "small pause" I mentioned before. This circuit is shown in the datasheet of the LF398-N. The trick is to have one of the S&H in continuous Sampling mode while the other is in Hold and then flip the states using a small dead time in which both are in Hold.
At this point I was able of creating a breadboard version of the Feigen core. However, the virtual module has a few extra features, like the ability of being reset to a given state (Root value) and the possibility of modulating the Growth parameter ("r" in the original equation). The original module allows for adding offset and changing the range of the produced signal as well.
The Offset, Range and Growth controls are implemented using a combination of an attenuverter and one adder. I won't cover this because the implementation is straightforward. The Range signal needs to be multiplied by the output therefore we need an extra VCA (this would be the third multiplication).
The only missing part would be the reset behavior. In order to implement that, I used an extra LF398 in switch configuration. Basically, when a reset signal is received, the switch connects the "next state" to the Root value and triggers the S&H pairs. This needs to be performed with the correct timing that way the Root voltage is present before triggering the S&H.
The following figure shows the block diagram of the analog Feigen (excluding the modulation inputs and attenuverters).
The following is a picture of one of the prototypes. It consists of 3 x LF398, 2 x LM13700, 3 x TL074, 3 x trimpots and bunch of passive components.
The problems of Analog Feigen
This fully analog module has a few small issues. None of those is a real deal breaker but compared to the virtual (VCV Rack) version there are a few small disadvantages. The first one is that in the virtual version, by the nature of the module, it is possible to dial the Growth into points where the sequences produced are repeated continuously. In the analog version, due to the small inaccuracies of the computation and the inherent noise these points are not stable. What I observed is that those repeated sequences could change. In a sense, that could be considered a good feature: the analog version has an extra element of subtle chaos.
The second nitpick is regarding the attenuverters. If you have used a module with analog attenuverters you may know that it is hard to find the exact center, which is the point at which the modulation impact is set to zero. In the Freak module I have digital attenuverters on which I implemented a dead-zone where the modulation is effectively zero.
My next issue is regarding the fact that if I want to sell this module I have to manually calibrate them. As I mentioned before, I added three trimpots (of 10 K ohms) to calibrate the module. The calibration required me to design the board with a jumper that I have to disconnect to break the feedback. once the feedback path is broken, I have to insert a test signal and measure with the scope different test points and tweak the trimpots until I get the desired behavior. This process is a bit tedious because the trimpots produce a wide effect on the signal. I could improve this by picking more carefully the values of the potentiometers. But since the trimpots are "expensive", it is better to use the same value everywhere and buy them at a larger bulk discount.
All those issues I talked about before could be improved by refining the design values and adding a few extra components. However, at this point I have invested many design hours on this project and I have made 3 revisions of the board. I want to finish this and continue with the next project.
Digital to the rescue
Some weeks ago I started designing a new (unrelated) module that needed to be digital. Since I cannot buy microcontrollers I decided to use a ready-made board: the famous Teensy. I have used Teensy boards in the past for different projects. They are my favorite Arduino-like boards and it is possible to buy them in small quantities from different distributors.
I decided to give a try designing Feigen using the Teensy LC. After a few hours of planning, I found that the Teensy LC provided enough I/O and speed to carry out the processing needed to run Feigen (which is not a heavy algorithm). I quickly designed a prototype board and send it to manufacture. Meanwhile I ported the code from the actual VCV Rack module and wrote all the drivers needed for the board.
Some weeks later the boards arrived and I was able of testing the module. Everything worked perfectly. Here you can see a picture of the board
You may see in the picture that the board has a few patches, but those are because I assembled it before I had received all the components.
Analog vs Digital
In a module like Feigen there is no controversy. Both versions work great and do the job. Each one has a few small advantages over the other. Here is a summary:
70mA (+12V), 50mA (-12V)
30mA (+12V), 10mA (-12V)
Manual and fiddly
3 (Teensy counts as 1)
As you can see in the table, the analog version ended up consuming more power. This could be reduced by redesigning some of the values, but doing so is a bit complicated because I did not automated all my calculations.
In the case of the digital Feigen, I wrote a script that communicates with the module and my measuring instruments. This script performs measurements and sends all the calibration data to the module. That data is stored in the memory and it is recalled when the module starts.
Having less components, the digital version is easier to assemble. This is nice because I'm manually placing the SMD components. Additionally, the digital version requires single PCB and I don't need to add connectors to communicate two boards which results in less soldering.
The analog version has a few advantages. For example, the analog Feigen could work with a very high frequency clock signal, probably in the order of Mega Hertz. But that's an overkill. For audio applications anything above the audible range is not very useful. On the digital Feigen I have set it to a maximum of 1 kHz. It could be higher, but I have not measured the timings of the code.
Lastly, digital Feigen can produce voltages values in steps of ~4 mV. This is due to the resolution of the DAC. Analog Feigen could produce any voltage value. The quantization is not a problem in this module because the output is always a discontinuous signal.
As a whole, the digital version has more advantages and the disadvantages are less important. For that reason I decided that I'm going to produce the digital version. If you are interested in getting one, I will open the pre-orders in the coming weeks once I secure all the parts needed for a first batch.