# [sdiy] Digital accumulator VCO core?

Brian Willoughby brianw at audiobanshee.com
Fri Feb 12 07:25:47 CET 2021

```
On Feb 11, 2021, at 21:32, cheater cheater wrote:
> I'm less looking for current and more looking for charge.

I'm tempted to say that circuit design involves only voltage and current. Magnetic fields pop into the picture from time to time, but usually the magnetic field itself is ignored, and the circuit design just assumes the voltage and current that results from the magnetic fields.

Charge is incredibly elusive. Modern devices really wish they could measure charge, because then we wouldn't have those annoying battery indicators that end up being WRONG. Charge is what a battery stores, and nobody can measure it exactly. Charge is also what a capacitor stores, but you can pretty much read the charge in a capacitor by measuring its voltage (but be careful to use an FET so you don't drain the cap while measuring it).

If you're looking for charge in your design, then you're probably looking in the wrong direction.

The flow of charge is current, and that exponential converter is probably actually dealing with current, not charge. To be honest, I haven't looked at exponential converter circuits, so I might be missing something there.

> BTW, in my application, I am free to have a large shunt resistor,
> which will give me a full scale voltage of even say 15V - because I
> don't need to preserve the current.

Right. And that shunt resistor voltage will be a fine input to a voltage based ADC. Ideally, you'll have a FET input op-amp voltage follower between the shunt resistor and the ADC, because you don't want the ADC operations to affect the expo+shunt in any way.

> However...
>
> any ADC normally works by capturing some amount of charge into an
> internal capacitor and then measuring the discharge time of that. So
> it is kind of odd that you can't find an ADC that directly reports the
> charge captured in some way... maybe it's implied somehow, and you
> just have to use a normal ADC and somehow process its output based on
> the math around its charge capture device.

Oh, man, that architecture is dog slow!

Capacitors do not charge or discharge instantly, so basically all ADC chip architectures use a different technique and avoid capacitors altogether. At least that's the case for any reasonably fast ADC.

But congratulations, you reminded me of my first ADC: the peripheral interface of the Apple ][. It actually does work like you say. The joystick pots on the game controller are a variable resistors, so the Apple CPU would discharge a capacitor and then charge it through the variable resistance until the voltage on the capacitor reached close enough to 5V to cross the logic threshold. The CPU manually timed this charging in a loop with a counter. The code was written so that the loop would run between 0 and 255 times before the cap hit the threshold, corresponding to the minimum and maximum resistance - basically creating an 8-bit A/D. The only reason to design an A/D like this is when you have no budget for a chip, and you don't really mind that it burns CPU processing power like mad.

I actually managed to record audio using that crappy system, by feeding a voltage instead of connecting the potentiometer. The trick I used was to continue the counter loop to the same constant value, because otherwise small values have a higher sample rate than large values if the loop stops at the threshold, and you can't really record audio very effectively with a conditionally variable sample rate.

Note that this capacitor system is still voltage based. You basically have a comparator that's triggered by digital logic levels. As you say, it's measuring the time elapsed until the capacitor voltage reaches the fixed "comparator" level.

Faster ADC can been seen in several early digital-controlled analog synths. This is called successive approximation. With that ADC architecture, a DAC is used to create a test voltage, and this test voltage is compared to the input voltage. If you start with the most significant bit, you can get an 8-bit value in only 8 steps. This 8-step SAR is 32 times faster than the 256-step capacitor architecture. You can actually perform a 16-bit ADC using SAR and still be 16 times faster than the 8-bit capacitor architecture. I guess you can see why I forgot all about this technique. I mean, why waste time with a capacitor to get an 8-bit value when you can get a 16-bit value in less time?

One nice thing about SAR is that you can trade off between sample rate and bit depth. If you want to sample a little faster, then leave out the last bit. You can go twice as fast if you only run half the steps, but then you end up with half the bit depth.

Lots of early analog synths saved money on ADC chips by reusing the DAC chip in an SAR architecture. The DAC was already needed to produce CV outputs for the VCO, VCF, VCO, et cetera, so looping it back for ADC was affordable. The CPU in the synth would use 8 to 16 steps to measure the input voltages, and they could dial in the accuracy versus time as needed.

An even faster ADC architecture is a flash converter. It has tons of comparators so that the voltage is determined in a single step. Not 256 steps, not 16 steps, but 1 step. Unfortunately, building a flash converter bigger than about 6 bits (IIRC) is really difficult. Some ADC chips use both. The flash converter is used to grab, e.g., 6 bits, and successive approximation is used to increase the bit depth. It ends up being faster than using successive approximation for all of the bits.

Modern 24-bit ADC also use voltage comparators. These chips keep the previous voltage around and compare the new input to the old voltage. The delta of +1 or -1 depends upon whether the new voltage is larger or smaller than the previous voltage. Sigma-delta converters do tons of digital processing on the bit streams, so they're not good at all for measuring CV. You get more noise than a 16-bit or 20-bit ADC.

Anyway, all of the fast sample rate ADC chips use voltage comparators (unless I've forgotten something even more obscure than 8-bit computer joystick technology).

Brian Willoughby

```