DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: knutolai on June 20, 2020, 08:03:10 PM

Title: Eurorack compatible CV input for FV1
Post by: knutolai on June 20, 2020, 08:03:10 PM
Hi

Not strictly stompbox related, but I've been tinkering with some ideas for a spinsemi FV-1 based eurorack module. As part of this project I wish to set up proper CV control for the digital parameters (POT0, POT1, POT2) of the FV-1. Hopefully this will be of interest to the community.

For the uninitiated: (correct me if I'm wrong, I'm only recently looking into this)

* Eurorack runs on a +/- 12V PSU with signal strengths of +/- 5V for audio and control signals.
* Normally every parameter will be adjustable with an associated voltage-divider pot and a control voltage (CV) input socket.
* Connecting a CV signal will cause the parameter to be set by a combination of the CV and pot values with the following relationship:
- If the pot is a the middle position (2.5V) sweeping the CV input signal from -2.5V to +2.5V will cover the total range (min to max) of the parameter, clipping at values beyond 2.5V (+/-). Thus setting the pot at min (0V) or max (5V) will allow you to increase or decrease the parameters setting by adding a positive (0 to 5 V) or negative (5 to 0 V) control voltage.
- If no CV signal is connected the pot will be able to cover the total range (min to max) of the parameter on its own.

For controlling the FV-1 you'd need to scale/offset the combined control voltage to fit the 0 to 3.3V supply range of the FV-1. So far this is my circuit (untested):

(https://i.imgur.com/fcI6u8t.png)

The circuit is a non-inverting mixer which sums the voltages from P1 and U1 at the U2 pin3 node with gains of 0.6 and 0.4 respectively. U2A with R4/R3 adds a gain of 1.666. Note that U1 socket applies 0V when nothing is connected to it. The opamp is a MCP6002 rail-to-rail opamp running on 0 to 3.3V which, from my understanding eliminated the need for over/undervoltage protection diodes.

From my understanding of the math:
* The voltage from P1 is first attenuated to gain 0.6 and boosted by gain 1.666 giving a total gain of ~1, thus producing an output voltage of 0 to 3.3 V when U1 applies 0V.
* The voltage from U1 is attenuated by 0.4 and the boost by 1.666 giving a total gain of 0.666 (+/- 3.3V).
* Any voltage present on U2 pin3 beyond 0 to 3.3 V is hard clipped by the opamp supply rail.

I haven't been able to test this thing yet so could be I'm way off on the math. I'm feeling very uncertain about the Vref for R3 as I don't quite understand at what voltage I should keep this node for a rail-to-rail opamp. Hopefully someone can shed some light on this.
Title: Re: Eurorack compatible CV input for FV1
Post by: bartimaeus on June 21, 2020, 11:54:33 AM
it's true LFOs are often +/-5V. but envelopes are often 0 to +10V. there aren't hard standards. but of course, you can always call the clipping of the top of the envelope "character"

i think you need to research more about rail to rail opamps on single supplies. there are lots of videos on youtube on how to pick your supply voltage and Vref for the best headroom and slew rates.

if you run on a 3.3V supply with Vref at half, positive voltages are going to clip at 1.65V. probably even lower, because rail to rail opamps still have a little bit or headroom. even attenuating +10V down to 6.66V, you'll end up with only the bottom ~25% of the envelope's range having any effect on the pot inputs, which is some serious loss.

since this is a euro module, why use a single supply when you have a dual supply available from the PSU? you may want to use more attenuation and a larger supply voltage, and rely on zener diodes for the clipping instead.

your plan for combining the pot and the cv input also seems to be throwing away a lot of the range of LFOs and similar control voltages, since you're only allowing a 5V swing (or did you mean for it to be 3.3V?).
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on June 21, 2020, 02:43:12 PM
Was looking around to see how others interface CV to DSPs running on a 3.3V supply before posting this thread. The Marbles module from Mutable Instruments uses a similar (but definitely different) solution where the MCP600x opamps run on a 3.3V single supply. See page 3 for the CV input circuits and page 5 for the -10V (!?) reference.

https://mutable-instruments.net/modules/marbles/downloads/marbles_v70.pdf (https://mutable-instruments.net/modules/marbles/downloads/marbles_v70.pdf)

Their selection of DSP microcontroller (STM32F4xxx) allows for the luxury of digital mixing of the CV and onboard voltage-divider pot as there are plenty of ADCs available.

Quote from: bartimaeus on June 21, 2020, 11:54:33 AM
it's true LFOs are often +/-5V. but envelopes are often 0 to +10V. there aren't hard standards. but of course, you can always call the clipping of the top of the envelope "character"

i think you need to research more about rail to rail opamps on single supplies. there are lots of videos on youtube on how to pick your supply voltage and Vref for the best headroom and slew rates.

if you run on a 3.3V supply with Vref at half, positive voltages are going to clip at 1.65V. probably even lower, because rail to rail opamps still have a little bit or headroom. even attenuating +10V down to 6.66V, you'll end up with only the bottom ~25% of the envelope's range having any effect on the pot inputs, which is some serious loss.

since this is a euro module, why use a single supply when you have a dual supply available from the PSU? you may want to use more attenuation and a larger supply voltage, and rely on zener diodes for the clipping instead.

your plan for combining the pot and the cv input also seems to be throwing away a lot of the range of LFOs and similar control voltages, since you're only allowing a 5V swing (or did you mean for it to be 3.3V?).

I will definitely take your advice on investigating single supply rail-to-rail opamp. I decided to go with this approach instead of zener protection diodes from reviewing the Marbles schematic. Would be very interested to hear your thoughts on their approach (especially with that odd -10V reference).
Title: Re: Eurorack compatible CV input for FV1
Post by: bartimaeus on June 22, 2020, 12:33:52 PM
the -10V reference makes more sense when you consider 1) that it's being scaled with a 200k and a 33k resistor at each mixer and 2) that each mixer is inverting. combine that with the 33k/100k scaling of the +/- 5V input cv and you'll see that it doesn't actually rely on the opamp's headroom to ensure that voltages are below +3.3V.

still, i think might make more sense to run it at 5V and use zeners to clip it to 3.3V. that way you avoid the opamp limiting you to less than 3.3V, since no rail to rail opamp is perfectly rail to rail. you may want to breadboard the chip and measure the actual max opamp output voltage with a 3.3V supply. mutable can just adjust for both the inversion of the input cv and for the loss of max voltage inside their chip to ensure that the voltages control the full range of the effect, but that's more annoying to do with the fv1 since you have so few instructions.
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on June 25, 2020, 03:30:21 AM
Thanks again for your insights. The new schematic below uses the +/- 12V supply available with ground (0V) as reference. As the full power supply range is used the OpAmp doesn't need to be a rail-to-rail type. A series resistor and over/undervoltage diodes are added post-OpAmp to protect the FV-1 input pin. I haven't tested the circuit yet, but will make an effort to report on its functionality once tested.

Would an ESD protection capacitor on the CV input be overkill?

(https://i.imgur.com/72yK31L.png)
Title: Re: Eurorack compatible CV input for FV1
Post by: bartimaeus on July 10, 2020, 01:06:59 AM
It's looking better, but I still think you might run into issues. For one, you need to make sure that you don't have any negative voltages – it looks like you're scaling the input to -3.3V to 3.3V.

Additionally, you may encounter problems when using a non-inverting summer rather than an inverting one. A non-inverting amp can work fine for known and stable inputs. But for something like euro, where you're connecting and disconnecting different sources, you can get issues. See this: https://electronics.stackexchange.com/questions/268547/inverting-summing-amplifier-vs-non-inverting-summing-amplfier

Mutable seems to like those ESD protection caps, so I'd keep them. Euro users aren't always especially careful with patch cables, so I wouldn't be surprised if inputs get hit with ESD more often than in the pedal world.
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on July 10, 2020, 10:30:25 AM
Quote from: bartimaeus on July 10, 2020, 01:06:59 AM
It's looking better, but I still think you might run into issues. For one, you need to make sure that you don't have any negative voltages – it looks like you're scaling the input to -3.3V to 3.3V.

Additionally, you may encounter problems when using a non-inverting summer rather than an inverting one. A non-inverting amp can work fine for known and stable inputs. But for something like euro, where you're connecting and disconnecting different sources, you can get issues. See this: https://electronics.stackexchange.com/questions/268547/inverting-summing-amplifier-vs-non-inverting-summing-amplfier

Mutable seems to like those ESD protection caps, so I'd keep them. Euro users aren't always especially careful with patch cables, so I wouldn't be surprised if inputs get hit with ESD more often than in the pedal world.

It is correct that I'm scaling to -3.3V to 3.3V, but I'm clipping negative voltages with D2. The way I see it I must accept negative voltages in order to allow the CV input to subtract from the offset set by P1.

You bring up a very good point about the amp instability considering the unknowable external CV source. One fix could be to add a voltage follower between U1 and the summing amplifier. The circuit should be quite stable when no CV source is connected due to the tip switch being connected to GND.

I've drawn up an alternative using an inverting mixer that, from my calculations, would output 3.3V at the "min" position and 0V at the "max" position (simple to invert in software). Note the pinout numbering of P1.

(https://i.imgur.com/CeBuu7R.png)
Title: Re: Eurorack compatible CV input for FV1
Post by: ElectricDruid on July 10, 2020, 10:56:55 AM
Looks good, except R2 should be 300K, shouldn't it? (reduce 10V range dow to 3.3V range).

Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on July 10, 2020, 01:17:25 PM
Quote from: ElectricDruid on July 10, 2020, 10:56:55 AM
Looks good, except R2 should be 300K, shouldn't it? (reduce 10V range dow to 3.3V range).

Assuming you are commenting on the latest schematic. From my thinking I'm expecting a signal from -5V to +5V on the CV input. With R2 = 150k this produces a +3.3v to -3.3v output (ignoring P1 and R1).

P1 with R1 = 150k produces a signal from 3.3v to 0v (cw).

For some reason mixing DC signals makes me really confused so I might have done the math wrong.
Title: Re: Eurorack compatible CV input for FV1
Post by: ElectricDruid on July 10, 2020, 03:10:53 PM
Fair enough. I assumed that you'd want the range of the pot and the CV input to be the same, but there's no reason why you have to.
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on July 10, 2020, 06:18:46 PM
Quote from: ElectricDruid on July 10, 2020, 03:10:53 PM
Fair enough. I assumed that you'd want the range of the pot and the CV input to be the same, but there's no reason why you have to.

Do you recon it would be harmful to the FV-1 ADC to input [1N5817 forward voltage] beyond the supply rails? If I narrowed the supply of U2A to 3.3V unipolar I would produce a gentler input to the FV1, but I would have to do more complicated tuning of the parameter range in my code. The FV-1 datasheet states the maximum voltage range for "Analog Input" (a little diffuse IMO) as -0.5V to Vdd+0.5. The 1N5817 has a max forward voltage of 0.45V (at 1A current).
Title: Re: Eurorack compatible CV input for FV1
Post by: ElectricDruid on July 11, 2020, 12:07:54 PM
It sounds to me like the FV-1 has internal diodes to limit the input. I don't know much about the FV-1, but if that's true, that's the same as the PIC.

On the PIC, the major risk is that you push the input voltage so far outside the normal range that you fry the internal protection diodes. Adding external diodes to take some of the load works (especially if like yours they have a lower Vf) and/or you can add a series resistor to limit the current that flows through the diodes. Like that, no, I don't think it's harmful. I've fed big signals into a PIC's input and as long as there's 4K7 in series, it doesn't care. I've also pushed the dsPIC too far *without* the protection, and that chip will crash and reboot - but the was without external diodes or a resistor.

With the diodes, I think you'll be fine. With R5 too, I think you've got a safety margin as well.
Title: Re: Eurorack compatible CV input for FV1
Post by: bartimaeus on July 12, 2020, 02:20:09 PM
this looks a lot better and should definitely work!

personally, i'd attenuate the input signal even more. right now, there's no pot position where the full range of a -5V to 5V lfo would be used. at every pot position, you're still going to get some clipping with a waveform like that. but this should work well if you want a 0V to 5V gate signal to control the full range of the input, for example.

also, i found this on the spin forum concerning protection diodes:
"Yes, you should protect the inputs from voltages outside the operating range (typically 0 - 3.3V) as the internal protection it really designed for transient protection, not continuously bleeding excess power to the rails as that will damage the chip. This is true for any chip, they all have some protection devices at the pins but they are not designed for running past their operating range continuously."
http://www.spinsemi.com/forum/viewtopic.php?f=2&t=90

Title: Re: Eurorack compatible CV input for FV1
Post by: idiot savant on July 13, 2020, 09:32:40 PM
This is what you want:

(https://i.imgur.com/BcDEmF8.jpg)

The first opamp scales the voltage to 0V to -10V. The second opamp inverts, and scales to 0V to +3.3V. The diodes are there to make sure no negative voltage passes.
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on July 14, 2020, 09:02:09 AM
Quote from: bartimaeus on July 12, 2020, 02:20:09 PM
also, i found this on the spin forum concerning protection diodes:
"Yes, you should protect the inputs from voltages outside the operating range (typically 0 - 3.3V) as the internal protection it really designed for transient protection, not continuously bleeding excess power to the rails as that will damage the chip. This is true for any chip, they all have some protection devices at the pins but they are not designed for running past their operating range continuously."
http://www.spinsemi.com/forum/viewtopic.php?f=2&t=90

Considering this and looking back over the MCP600x datasheet they claim the output voltage range to be Vss+25mV to Vdd-25mV. With the 3.3V parameter range of the FV-1 that just shaves of 0.76% of the top and bottom of the range. I think for my purpose that will be a negligible amount of adjustment-loss.

Will buy some MCP600x chips and breadboard to following circuit and report my findings. Will be interested to see if their claims hold true.

(https://i.imgur.com/H57rqZG.png)
Title: Re: Eurorack compatible CV input for FV1
Post by: knutolai on August 05, 2020, 05:10:27 PM
Finally got around to testing the latest schematic and can report that it is working even better than expected. From my measurements the MPC6004 output is reaching within 3mV of the supply rails (0.2% bandwidth loss). Very pleased that such a simple solution ended up being sufficient.