<div dir="ltr">fwiw, and remember this is #amateur_mode here, this is how i implemented clamping for my Arduino module. i ran my rail to rail opamps (LT1013 IIRC) at +/-5, scaled to +/-2.5v, biased up by 2.5v, so the uP saw 0-5v. the firmware considered anything below 2.5v as "negative".<div><br></div><div>for digital ins i just used the same opamps in a straightforward comparator config.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 19, 2018 at 2:48 PM, O Gillet <span dir="ltr"><<a href="mailto:ol.gillet@gmail.com" target="_blank">ol.gillet@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> The inputs must be clamped that range.<br>
<br>
</span>The circuit I have posted clamps all voltages below -8V to 3.275V, all<br>
voltages above +8V to 0.025V, and is linear in-between. You can change<br>
the resistor values to get other scale/offset ratios.<br>
<br>
Unless you're building something like a development board, I don't see<br>
a case for directly exposing MCU pins to the external world. What<br>
you're sending to those MCU pins is very likely to need some<br>
conditioning anyway (filtering, scale/offset) - so the idea is to use<br>
a single-supply rail to rail op-amp powered by the same voltage as<br>
your MCU to get the clamping "for free".<br>
<div class="HOEnZb"><div class="h5">On Tue, Jun 19, 2018 at 11:40 PM Tim Ressel <<a href="mailto:timr@circuitabbey.com">timr@circuitabbey.com</a>> wrote:<br>
><br>
> the issue is this: the uP input cannot tolerate voltages much beyond its<br>
> rails, so the max range is -0.3V to +3.6V (in my case). The inputs must<br>
> be clamped that range.<br>
><br>
> --timmers<br>
><br>
><br>
> On 6/19/2018 2:22 PM, O Gillet wrote:<br>
> > The CV input circuitry of pretty much all my modules look like this:<br>
> > <a href="https://imgur.com/a/Xz5YN0X" rel="noreferrer" target="_blank">https://imgur.com/a/Xz5YN0X</a><br>
> ><br>
> > The op-amp has R2R outputs and is single-supply, powered by 3.3V.<br>
> ><br>
> > Benefits:<br>
> ><br>
> > - The V- input of the op-amp is a summing point - you can attach there<br>
> > as many CV inputs or pots as you want. It's very helpful in some<br>
> > situations to have both a CV input and a pot to control a parameter!<br>
> ><br>
> > - If you connect an external signal straight to an MCU ADC input, the<br>
> > range of the CV will be necessarily equal to the range of the<br>
> > microcontroller ADC input. It's probably OK if you use a +5V<br>
> > microcontroller and want 0V to correspond to the minimum value of the<br>
> > parameter, +5V to the maximum value of the parameter... But what if<br>
> > you want the range of the parameter to be -5V to +5V ; or 0V to +8V?<br>
> > Or what if your microcontroller is powered by +3.3V? The schematic I<br>
> > have posted covers all these cases - you just change the resistors to<br>
> > get different scale/offset values.<br>
> ><br>
> > - The capacitor acts as a 1-pole low-pass filter which removes some of<br>
> > the high frequencies in the CV signal - providing cleaner readouts.<br>
> ><br>
> > - ADCs do not like being driven from sources with high ouptut<br>
> > impedances. For example, the ADCs on the AVR want a source impedance<br>
> > of 10k or lower - to rapidly charge the S&H capacitor which is part of<br>
> > the ADC circuit. The output of the op-amp works as a very low<br>
> > impedance source for the ADC - and will simultaneously leave you in<br>
> > control of the input impedance of your module (100k is an implicit<br>
> > standard for Euro modules). Standardizing all input impedances to 100k<br>
> > is great - it allows consistant behaviour when using passive modules.<br>
> ><br>
> > - Of course the op-amp input will never "see" extreme external<br>
> > voltages, because you're not directly exposing any gate to the<br>
> > external world - every input voltage goes through the 100k resistor.<br>
> > If you connect +50V to the CV input, well, that's only 0.5mA flowing<br>
> > through the input resistor (and 25mW dissipated by the resistor).<br>
> ><br>
> > So yes, an op-amp might look a bit too much, but it kills a whole<br>
> > flock of birds with one stone.<br>
> > ______________________________<wbr>_________________<br>
> > Synth-diy mailing list<br>
> > <a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
> > <a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
> ><br>
><br>
> --<br>
> --Tim Ressel<br>
> Circuit Abbey<br>
> <a href="mailto:timr@circuitabbey.com">timr@circuitabbey.com</a><br>
><br>
> ______________________________<wbr>_________________<br>
> Synth-diy mailing list<br>
> <a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
> <a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
______________________________<wbr>_________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
</div></div></blockquote></div><br></div>