Atmega s&h

Hello people,
I was wondering how many s&h units can someone create with an atmega 88pa chip and if such an application could be feasible (speed wise) using a digital circuit.

What would it need, such a circuit to be accomplished?

I’m thinking a adc, some opamps to scale the cv-in signal, a 5V regulator to power the opamps and clamp the output voltage of them, and a dac to output the hold cv.
Is there something Im missing?
Would such a configuration be fast enough to be used as a decent s&h?

Thank you!

Dozens of channels, easily! If the calibration is handled with trimmers there’s no processing involved, just shuffling data between an ADC and a DAC.

Unless you use an external ADC, you’ll hit pretty fast the resolution and noise limit of the internal ADC though!

So the MCU should be used as the intermediary between the ADC and the DAC without trying to calibrate anything (everything should be trimmed with the opamps and the trimmers).
To cover a range of ±5V, an 10bit ADC (I cannot find a more accurate in the local market) is sufficient enough?
Should I use SPI or I2C ADCs/ DACs? I’mleaning towards three or four s&h units with a mcu.

Thank you for your answers :slight_smile:

Depends on how many channels you want! With calibration done in hardware (trimmers), the MCU doesn’t have to do any computation, that’s the easiest case.

With calibration done in software, you’ll use more CPU - say 40 or 50 CPU cycles per sample for loading calibration constants into registers and doing two 32-bit multiplications. Adding 20 or 30 CPU cycles for writing/reading to the DAC and ADC, and assuming a 20kHz refresh rate, that gives you 20 MHz / 20kHz / 80 ~ 12 channels.

Do the maths! 10V / 1024 steps = 9.8mV per step (= 12 semitones if you’re processing V/O signals). Should an error between the input and output of 12 semitones be acceptable?

Depends on the refresh rate you wish! I personally find working with SPI easier, and the reads/writes are faster.

I’m curious about one thing, though… Why not do it in the analog domain? In terms of cost and PCB real-estate, I’m sure analog beats digital. Do you need insanely low droop times? For that they might be better circuits than Kinks’ (which is as simple as it can get!). Or maybe you’re planning on extra features like quantization?

The droop time is one advantage I can think of, the midi output is another, and maybe some step constraints would be nice (maximum allowed voltage from previous step). I’ve studied the s&h circuit of kinks and yes, it could be simpler and cheeper but what I wanted was a simple circuit to get my hands dirty with the mcus and the arduinos I have laying around.

I want to learn how to input from the cv world to the mcu and how to output for the mcu to the cv world :slight_smile:

Ok! well for a beginner project it’s a good choice, the logic of the code isn’t overtly complex and you’re learning about converters which is a very useful skill for everything else! (My first MCU project was a MIDI to CV/Gate interface)