Preparing guitar signal for ADC input - Arduino Due

Started by CatsLoveJazz, May 27, 2013, 05:34:07 PM

Previous topic - Next topic

CatsLoveJazz

Hello,

I'm aiming to build a pedal based around the Arduino Due and am currently designing the input stage to prepare the signal for the ADC (range of 0-3.3V). My main experience is in software doing DSP and I can be a little shaky on the intricacies of analogue design. I've built up a circuit that although behaves correctly, I know there are many ways in which it could be improved.

I would be very grateful for some pointers of how I could look at to improve my design. Note that the feedback capacitor value is only really approximate at this point as I haven't decided on a sample rate.

The basic requirements I have are:

  • Provide sufficient input impedance maintain the quality of the original signal as best as possible
  • Remove the DC and bias the signal around half the ADC range (1.65V)
  • Filter the signal to comply with the Nyquist theorem
  • Amplify the signal to make the most of the ADCs range



A few questions I have:


  • Is 100k a sufficient input impedance for a guitar pedal, what other impact does this have on the circuit
  • Should I look at more advanced ways of biasing the op-amp or is a voltage divider ok
  • What are the pros/cons of using an inverting configuration over, say, a non-inverting with a 2nd order sallen-key topology
  • Is it appropriate to use a zener diode in this way to prevent from over voltage on the ADC?

Any suggestions would be gratefully received.

Thank you,

Graeme

merlinb

#1
A TL071 will struggle to swing the rail much below your 1.65V reference. It would be better to use (say) a 3.3V bias voltage and then level shift the signal down to 1.65V with a resistor divider. But if you want to cover the full ADC range then you may need a negative supply voltage (charge pump?). Also non-inverting configuration would be better, so that you can have a 1M input impedance without a noise penalty, then follow that with a second opamp for decent anti-alias filtering.

Gurner

Quote from: merlinb on May 27, 2013, 05:42:52 PM
A TL071 will struggle to swing the rail much below your 1.65V reference. It would be better to use (say) a 3.3V bias voltage and then level shift the signal down to 1.65V with a resistor divider. But if you want to cover the full ADC range then you may need a negative supply voltage (charge pump?). Also non-inverting configuration would be better, so that you can have a 1M input impedance without a noise penalty, then follow that with a second opamp for decent anti-alias filtering.

Everything merlin said (and a TL071 most definitely can't be used here)... but I'd add to get maximum usable ADC range/swing, you'll probably want a variable gain as an option (non-inverting config).

Also presumably your ADC is going to have a 3.3v regulator? it might be better to bias off that voltage supply with tight tolerance resistors, because as presently proposed in your schem you are biasing of an unregulated 9V....as the battery voltage starts fading....so will your bias level! Even better would be to use something like a 4V regulated power supply to your opamp (and bias your +ve opamp input off that supply) - you can then be assured of getting maximum ADC swing (which you might not be able to pull off with the opamp sharing the same 3.3V supply as your ADC)

CatsLoveJazz

Thanks for the replies, really useful information!  I will look to redesign my circuit based around a non-inverting configuration.

I was not aware of this limitation with op-amps, is 1.65V simply too far away from the supply rail?

Quote from: Gurner on May 27, 2013, 05:50:53 PM
Also presumably your ADC is going to have a 3.3v regulator? it might be better to bias off that voltage supply with tight tolerance resistors, because as presently proposed in your schem you are biasing of an unregulated 9V....as the battery voltage starts fading....so will your bias level!

That's a very good point, I was concerned about the battery fading but hadn't though to use the ADC supply as the ref for the bias! Although if I wanted to bias the first op-amp at 4.5V and then scale this down, I couldn't do this. Would it be preferable to run the whole thing from a 5V regulated from the battery?

Thanks again

Gurner

with my own modest ADC related projects (with PICs)...I've found it preferable to have any opamps feeding the ADC to have a supply voltage higher than the MCU itself.

Why?

Well even a rail to tail opamp quite often doesn't swing to true rail (more like a few hundred millivolts close to).....this is lost resolution ....therefore better to power your opamp with a higher voltage (5V would be good)...then you can be assured of getting a clean signal through it (which would be a challenge if using 3.3V...same as your ADC) *and* using all your ADC resolution.

CatsLoveJazz

#5
QuoteBut if you want to cover the full ADC range then you may need a negative supply voltage (charge pump?).
I'm not sure why supplying a negtive voltage rather than ground helps me cover the full range? Is this because the op-amp's output can't swing too close to ground, as with it +ve supply rail?

QuoteI've found it preferable to have any opamps feeding the ADC to have a supply voltage higher than the MCU itself.
This was my thinking for supplying the op-amp with 9V so that a full-scale signal can reach the full 3.3V of the ADC. However, it seems from merlinb's comment that you cannot bias the op-amps input terminals down at 1.65V when the supply is up at 9V, so I'm not sure where to go from here.

Would a 1.65V bias be okay with a supply of 0-5V, or should I bias at 2.5V and step down. More importantly, what tells me about this limitation in the datasheet?

I really appreciate the comments, I am learning a lot!

FiveseveN

Why not AC-couple the op amp's output and then bias it at 1.65 V with precision resistors?
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

Gurner

Quote from: CatsLoveJazz on May 28, 2013, 07:40:49 AM
This was my thinking for supplying the op-amp with 9V so that a full-scale signal can reach the full 3.3V of the ADC. However, it seems from merlinb's comment that you cannot bias the op-amps input terminals down at 1.65V when the supply is up at 9V, so I'm not sure where to go from here.

I'm not sure how you deep you are going wrt noise figures etc ...but I've used a somewhat fairly general purpose MCP6001 just fine...it works up to 5V supply, swings rail to rail etc (I don't think it's jfet input type opamp, but I couldn't tell the difference between it & the much loved Tlxx series)....else just do as FiveSeven says (which rather than kill two birds with one stone, kills two birds with two stones   ..it just depends how many stones you want use!)

R.G.

I'd do it this way:

1. Set the bias voltage at half of your 9V with an equal-value resistor divider. Any value of resistors from 10K/10K to 100K/100K should work.
2. Keep the power supply filter cap from +9V to ground and parallel it with a 0.1uF ceramic.
3. Filter the bias voltage with a 22uF cap from bias to ground.
4. Feed the + input with a 1M resistor from bias to the + input.
5. Swap C1 and R8. Make R8 be a fixed resistor plus a 500K pot to ground. Hook up the 500K pot as a variable resistor. The 500K pot is your gain control, lets you turn gain down to just about unity or up to the value of one plus the ratio of the 500K feedback resistor to the new fixed resistor.
6. Add a new input capacitor from input to the + input. Signal now comes in the + input.
7. Filter the high end by setting the value of C8 to be C = 1/(2*pi* 500K * [your rolloff frequency in Hz]). This gives you a single-pole rolloff, which is probably fine for guitar pickups. If you have other pedals in front of it, you may need more rolloffs. I'd do this with a single RC on the front end rather than going to a formal active filter. Do that last if you get bad results.
8. The output of this will sit at half the 9V power supply. Break that DC with a largish capacitor per five-seven's advice. 10uF is OK. Negative terminal away from the opamp.
9. Limit the output size by taking a 3.3K resistor from the output capacitor to the parallel combination of a 100K resistor, and two back-to-back LEDs to ground. The 100K holds the DC level at ground, the LEDs limit the signal to their forward voltage. Pick LEDs with 1.6V forward voltages. Use another 10uF to couple the signal into the ADC. Negative terminal to the LEDs side.
10. Bias the output of the thing for your ADC input by establishing another equal-resistor divider, this one between the supply to your ADC and ground. I'd make this one 47K/47K, and feed this to your ADC input.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

CatsLoveJazz

Thank you RG! I tried simulating the circuit but I must be interpreting you incorrectly as my output voltage from the op-amp seems to be biased around 9V? Im also not sure how you suggest to layout the resistor diode network to limit the output.


Gurner

If you are going RG's way (& why not!), the right hand side of your Cin cap should not go to the resistor junction, but to the opamp +ve pin.

You need a (large-ish value) DC blocking cap between Rgain & ground

C4' value needs to be a lot higher (I'd go for 200nf)

R.G.

What Gurner said.

Take your input capacitor directly to the + input pin.

Swapping C1 and R8 puts Cr directly to the - input pin, and some resistance between the outside end of C1 and ground. C1 hooked up like this blocks DC from the feedback path and forces a DC gain of +1. As you have it now, the DC bias of half of 9V is being amplified too.

Make C4 10uF electrolytic, + side   to the opamp output.

Place a 1M from the - side of the new 10uF C4 to ground. Parallel the new 1M with two LEDs, one with its anode to ground, one with its cathode to ground.

Take another 10uF cap, negative side to the new 1M and LEDs and - side of C4, and connect its + side to the junction of those 47K resistors.

Tie the top end of R11 to your 3.3V power supply. Tie the input to your ADC to the junction of R11/R12 and the + side of the new 10uF cap.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

CatsLoveJazz

Thanks again folks, I really do appreciate the help and understand where I'm going now! I'll be sure to keep the forum updated as I move toward the software portion of the design, hopefully somewhere I'm a lot happier!

PRR



I disagree with R.G. on one point. I like feedback resistors <100K for low thermal noise.

  • SUPPORTER

CatsLoveJazz

Hi, I just thought I'd post my final circuit that I'm working with now. I switched to the MC3307 series as the Arduino Due has 5V regulated on-board and so I can run this easily from there.

I think that the circuit is doing everything I need in terms of input impedance, Nyquist filtering and optimal ADC range.

You folks have been very kind in gently explaining where I've been going wrong, it's been great to see such a helpful forum and I hope I can share my knowledge here as I learn more!

Graeme




R.G.

Quote from: PRR on May 29, 2013, 11:54:10 PM
I disagree with R.G. on one point. I like feedback resistors <100K for low thermal noise.
So do I. But I find that in practice, the use of 100K-range resistors in carbon and metal film is not dramatically worse than not optimizing the opamps for noise source resistance. It's relatively benign if absolute lowest noise is not critical, or if your opamp has limited drive and avoiding wasting power in the feedback resistor is an issue.

Quote from: CatsLoveJazz on May 30, 2013, 02:14:15 PM
I think that the circuit is doing everything I need in terms of input impedance, Nyquist filtering and optimal ADC range.
One quibble: change R1 to no more than 1K for noise reasons. Resistance in series with the input *is* a noise issue, especially for 1M range resistors.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

CatsLoveJazz

#16
Quote
One quibble: change R1 to no more than 1K for noise reasons. Resistance in series with the input *is* a noise issue, especially for 1M range resistors.

Thanks RG, although how does this effect the input impedance? I used 1M to keep this high, although on second thought, would the op-amps (very high) internal input impedance dominate anyway making this unnecessary. Am I correct to assume that if I change R1 I would want to match the resistor coming out of the bias section (Rb6 - badly named) to keep the summing balanced?

R.G.

Quote from: CatsLoveJazz on May 30, 2013, 02:35:18 PM
...although how does this effect the input impedance?
No.
QuoteI used 1M to keep this high, although on second thought, would the op-amps (very high) internal input impedance dominate anyway making this unnecessary.
And this is indeed why.

QuoteAm I correct to assume that if I change R1 I would want to match the resistor coming out of the bias section (Rb6 - badly named) to keep the summing balanced?
No. You don't want this to be balanced; it's not a summing. R1 is only providing some voltage to keep the opamp off the metaphoric rocks and in its working zone of voltages. Other wise, you want the input voltage to absolutely dominate. Using R1=Rb6 divides your input signal by half before you start.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

> Using R1=Rb6 divides your input signal by half before you start.

+1.

Also puts your noise-source up near 500K, too high.

> input impedance? I used 1M to keep this high

In my plan, the input impedance is Rin in parallel with OA7 in-pin. The opamp input impedance is (ruff number) 200++Megs. So 1Meg||200Meg= 1Meg for all practical purpose. You want to be over 250K, 500K may be a touch better, 1meg is gold-standard (all old Fenders).

My plan plagiarizes the best examples. We can debate if the input 7.7KHz R-C should be 47K+470pFd, or less than 47K (but then to have an audio-range cut-off the 470pFd becomes distressingly large), or more than 47K (68K is widely used for wrong reason and would allow a smaller cap). The "best" approach may be to let this low-pass run high, >100KHz, then add additional filtering stages before the DAC. But that's complicated. And unlike many other signals put into ADCs, with guitar we "know" output over 5KHz will be very-small, because of string mass and pickup/cable R-L-C lowpass.


  • SUPPORTER

CatsLoveJazz

#19
Thanks again PRR, I know the difference is negligible but just to satisfy my mind would I be correct in saying that the input impedence form the resistors would be
47k + (1M+100k || 200M)

I'm a little unclear on the way that Vbias/Rb6 and Vin/47k interact,  woudl I be correct in saying that Rb6>>R1 so that the proportion of the signal seen at V+ve input is higher i.e.

Vout = (1+ Rf/Rg)*( Vin(Rb6/(R1+Rb6)) + Vbias(R1/(R1+Rb6)) )

meaning I'll get about a 5% loss of the input with 47k and 1M?



EDIT: fixed Rb6 value