EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: krcm0209 on February 07, 2021, 04:06:04 pm

Title: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: krcm0209 on February 07, 2021, 04:06:04 pm
I want to sample an audio signal coming from a Behringer XENYX 502 audio mixer (max output +22 dBu) with the ADC on a Raspberry Pi Pico. The ADC on the Pico is referenced to 3.3V, input range 0-3.3V. It is my understanding that a 22 dBu signal can reach peak-to-peak voltages of ~27.5V. (http://www.sengpielaudio.com/calculator-db-volt.htm (http://www.sengpielaudio.com/calculator-db-volt.htm)) I am not expecting to operate the Behringer mixer at full tilt, so it is likely the voltages I'm sampling will be considerably lower, but would like to be able to handle the max just in case.

I've been reading about using op-amps for audio sampling, but I'm a little confused. It seems that they are used to amplify the signal from a small voltage up and center it around the DC bias. Would op-amps also be used in the case where you potentially have higher voltages on the input? (22 dBu)

Ideally, I'm looking for a circuit that can handle up to a 27.5V peak-to-peak signal (with 0V DC bias), and convert that signal to a 3.3V peak-to-peak signal DC biased at 1.65V. (one-half 3.3V)
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: TimFox on February 07, 2021, 04:55:45 pm
You can do that with three resistors and a DC voltage, where one resistor goes from the output terminal to ground, one goes from the (positive) DC voltage to the output terminal, and the third goes from the input to the output terminal.  This is a good homework problem.  Start with your available DC voltage.
Hint 1: define two of the resistors as multiples of the third.
Hint 2:  derive two linear equations for the two resistors:  one for the maximum positive limit of the input and the desired output, the other for the negative limit and the desired output voltage.
Then, choose a reasonable value for the third resistor and obtain the other two.
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: krcm0209 on February 07, 2021, 05:07:32 pm
You can do that with three resistors and a DC voltage, where one resistor goes from the output terminal to ground, one goes from the (positive) DC voltage to the output terminal, and the third goes from the input to the output terminal.  This is a good homework problem.  Start with your available DC voltage.
Hint 1: define two of the resistors as multiples of the third.
Hint 2:  derive two linear equations for the two resistors:  one for the maximum positive limit of the input and the desired output, the other for the negative limit and the desired output voltage.
Then, choose a reasonable value for the third resistor and obtain the other two.
I'll get on that. In the meantime I was working on drawing up a schematic with an op-amp. Would this work assuming I add protection on the input to clamp any voltages higher than 3.3V down to 3.3V?
[attach=1]
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: TimFox on February 07, 2021, 05:13:19 pm
You have the - and + inputs reversed (positive instead of negative feedback on the op amp).   With that fixed, you need to change the ratio of the resistors from +3.3 V, to give +1.65 V output with 0 input, since the other two resistors are not equal.  Start by proportioning the input and feedback resistors to map the input swing to the output swing, then calculate the DC resistors to map 0 to +1.65 V.
If the input goes through a capacitor before the resistor, that changes the DC feedback and the +1.65 V at the + input will be mapped to +1.65 V as desired.
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: iMo on February 07, 2021, 05:50:53 pm
For example:
Opamp - a single voltage 1.5-5.5V, rail to rail, low noise, jfet input, or something like that..
Finetune R2 to get your input into 0.0-3.3V output.
R1C2 creates a simple antialiasing filter (around 20kHz here).
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: krcm0209 on February 07, 2021, 06:47:40 pm
You can do that with three resistors and a DC voltage, where one resistor goes from the output terminal to ground, one goes from the (positive) DC voltage to the output terminal, and the third goes from the input to the output terminal.  This is a good homework problem.  Start with your available DC voltage.
Hint 1: define two of the resistors as multiples of the third.
Hint 2:  derive two linear equations for the two resistors:  one for the maximum positive limit of the input and the desired output, the other for the negative limit and the desired output voltage.
Then, choose a reasonable value for the third resistor and obtain the other two.
I want to make sure I am understanding you correctly. Does this schematic match what you were describing?

I'm trying to come up with the equations, and I'm not sure I'm on the right path.
So far I have:
3.3 = 13.75(R3/R3+R1)
and
0 = 17.05(R2/R2+R3)

13.75V is from half of the peak-to-peak 27.5V. 17.05V is from the voltage difference between -13.75V and 3.3V. I got these by plugging in the voltages on my schematic and noticing that it appears to simplify to two different 2-resistor voltage divider circuits at the desired min and max output voltage.
Title: Re: Up to 22 dBu audio signal to 1.65V DC bias for Rasp Pi Pico ADC input
Post by: JohnnyMalaria on February 07, 2021, 07:56:14 pm
I think you'll find it more useful to consider your ADC input as the input to an op-amp acting as a summing amplifier. That should help you understand why the combination of dividers works. i.e., look at the classic way the input topology of a summing amp is drawn and represent your resistor network that way. You should see more readily how the separate audio and DC bias signals combine.