Help needed with audio in circuit

Status
Not open for further replies.

unicornpower

Well-known member
Here is my circuit design which is intended to take Eurorack modular audio (-5V..5V), and convert it to the range (0V..1.2V), for the Teensy 3.6 ADC. The first op-amp is in an inverting summing op-amp configuration. 5V is added to the input, putting it in the range of 0V..10V, and the op-amp reduces this to the range (-1.2V..0V), the second op-amp, inverts this signal at unity gain, giving a signal from (0V..1.2V). The circuit appears to work, but it is very noisy. There is a LOT of background noise coming from somewhere. I've tried adding capacitors across the feed back resistors, but that doesn't change much. Can anyone tell me if there's a fundamental mistake with my schematic? All help much appreciated! Screen Shot 2017-08-12 at 20.31.29.jpg
 
Here is my circuit design which is intended to take Eurorack modular audio (-5V..5V), and convert it to the range (0V..1.2V), for the Teensy 3.6 ADC. The first op-amp is in an inverting summing op-amp configuration. 5V is added to the input, putting it in the range of 0V..10V, and the op-amp reduces this to the range (-1.2V..0V), the second op-amp, inverts this signal at unity gain, giving a signal from (0V..1.2V). The circuit appears to work, but it is very noisy. There is a LOT of background noise coming from somewhere. I've tried adding capacitors across the feed back resistors, but that doesn't change much. Can anyone tell me if there's a fundamental mistake with my schematic? All help much appreciated!

get rid of the diodes, exit your 5V circuit with a capacitor followed with a simple voltage divider to obtain 0.6V bias. choose capacitor high enough to avoid significant high-pass effect.
 
Agreed - you might be able to do this in one stage. The input cap will let you bias the +/- 5V input to 0.6V, with the positive input to the op-amp also biased to 0.6V and then you can scale the op-amp gain to 8.33. Level shifter.jpgLevel shifter output.jpeg

This is an LTSpice schematic that should show what I'm thinking.
 
Thanks for your help and suggestions everyone! I had read both of those links beforehand, Paul. I decided to use op-amps for the input rather than a potential divider, as I thought this was better to ensure the input was high-impedance. I'm rather new at this so I apologise if my questions are a little basic.

WMXZ - why do you think I should remove the diodes, they are there to protect the teensy from high voltages, do you think they might cause the noise? I tried removing them but the problem persisted. I'm using schottky diodes for these. The capacitor you suggest adding, should that be between 5V and ground?

I have had some PCBs made with this circuit design for prototyping, so I'm keen to find a solution which can be hacked into this circuit, if one exists. Does the schematic look wrong to you guys? I've measured the outputs on an oscilloscope with a signal generator on the input, and the ranges do seem correct (e.g. it's correctly mapping -5V/+5V to 0V/1.2V. I plan to go back to my breadboard and see if the problem exists there. The interesting thing is that when an audio signal is present at the input the noise seems to disappear. Which suggests something might be floating? I shall do some more head scratching! :)
 
What kind of noise? Is it AC hum or white noise?
I do not see any power supply bypass caps in your circuit. That could be a problem. They should be added even if not causing this particular problem.
It may be noise on the unfiltered +5 volt line. You could test that by powering the +5 connection with a battery temporarily and see if the noise is still there.
In your program, do you have AGC code? That would increase noise when there is no signal in.
Are you testing with long unshielded wires? They act as antennas and will pick up noise. If you are close to a radio station or other types of radio transmitters( like a cell phone ), they will pick that up also.
 
Is the 5V noise free?

Any noise on that 5V ought to couple right into your signal...

There was noise on the 5V line actually. I was using a voltage regulator only regulated up to 100mA, and I was drawing slightly more than this (Teensy 3.6, plus PIC, plus LEDs), and showed some noise on the scope. I replaced the regulator with a meatier 2A one, but unfortunately the problem remained. I shall post my power circuit when I get home, for reference. It would make sense if the problem was there.
 
What kind of noise? Is it AC hum or white noise?
I do not see any power supply bypass caps in your circuit. That could be a problem. They should be added even if not causing this particular problem.
It may be noise on the unfiltered +5 volt line. You could test that by powering the +5 connection with a battery temporarily and see if the noise is still there.
In your program, do you have AGC code? That would increase noise when there is no signal in.
Are you testing with long unshielded wires? They act as antennas and will pick up noise. If you are close to a radio station or other types of radio transmitters( like a cell phone ), they will pick that up also.

It's white noise. The noise seems to go when an audio signal is present. AGC is Auto Gain Control? (had to Google ) I don't have that, no. Just a simple pass-thru in the audio library. It's a PCB, so the wires are short. I shall post up the schematic tonight.
 
Thus, it's the noise of the "dirty" 5V supply rail which is greatly amplified by your op-amps. Professional engineering requires normally separate power supplies or at least separate voltage regulators for analog and digital circuitry.

A simple but not so efficient quick fix for your existing circuit would be replacing that 8.3k resistor (R2) by a T-lowpass filter:

+5V >---[2k1]---(x)---[6k2]--->pin2 of TL074A and a 4.7uF electrolytic capacitor from (x) to GND.
 
Capture.JPG
Insert a simple R/C filter on the 5V supply to see what happens. I used 100 ohms and 100uF as approximate values but the goal is to turn that 5V supply into a super quiet reference voltage. Ideally, you'd use an actual precision reference.
 
It's white noise. The noise seems to go when an audio signal is present. AGC is Auto Gain Control? (had to Google ) I don't have that, no. Just a simple pass-thru in the audio library. It's a PCB, so the wires are short. I shall post up the schematic tonight.

For reference, this is the power circuit I'm using, adapted from Radio Music module. I’m actually using 10uF for C6 instead of 1uF. Not sure how much difference that makes..

Screen Shot 2017-08-14 at 18.18.15.jpg
 
It's white noise. The noise seems to go when an audio signal is present...
Do you mean the noise goes away, or you hear the noise when an audio signal is present?

On Teensy 3.2 the noise increases when audio is present, and I now know why (and fixed it).
Could it be this issue? I have a fix in my fork
https://forum.pjrc.com/threads/4577...e-distortion-in-input_adc-cpp-input_adcs-cpp

One way to test is take your audio output right off the input to the ADC, bypassing the whole software side of things. Then you can hear what it is like right at the input of the ADC. This will help you know if your op amp circuit is getting noise or if it's something inside the Teensy after the ADC.

It's good to separate these things in functional blocks and test down through the system. Something common in the DIY stompboxes community is an Audio Probe

[EDIT] I do recommend using the diodes for input protection. The only change to the circuit is put a 47 ohm resistor feeding the ADC input with a 47n to 150n capacitor to ground at the ADC input. The parasitic capacitance in the diode works as a nice low impedance to inject switching noise on the ADC input. The capacitor will shunt this to ground and the resistor gives it some impedance to work against. This also serves as a basic anti-aliasing filter.

Here is what I am doing for a guitar input. My circuit is optimized to guitar signal levels, and it is hard limited between 0V and 1.2V. I noticed wrap-around when the ADC is overdriven -- in fact the ADC makes noise when it gets signal between 1.2V and 3.3V (another possible source of your problem -- maybe you are overdriving the 1.2V range).

I decided to use a precision voltage reference to clamp the voltage just shy of 1.2V, and used the discrete "op-amp" circuit to give me decently linear operation right down to the 0V rail. The second harmonic measured in SPICE simulation is around -80 dB for a 0.5Vpp output and the remaining harmonics are in the noise floor (<90 dB). For a 1Vpp output the first harmonic is about -60dB and the final visible harmonic before dropping into the -90 dB floor is the 6th. I am expecting the nice mix of even harmonics will not sound bad on guitar as it approaches the limit and it is on-par with typical stompbox effects.

I have added several stages of ground-earth capacitors for anti-aliasing. This comes to about -6dB at 20kHz, intentionally starting to roll off at around 14 kHz since this is not too hard to correct with a digital filter.

ADC_INPUT_BUFFER.jpg
 
Last edited:
Do you mean the noise goes away, or you hear the noise when an audio signal is present?

On Teensy 3.2 the noise increases when audio is present, and I now know why (and fixed it).
Could it be this issue? I have a fix in my fork
https://forum.pjrc.com/threads/4577...e-distortion-in-input_adc-cpp-input_adcs-cpp

One way to test is take your audio output right off the input to the ADC, bypassing the whole software side of things. Then you can hear what it is like right at the input of the ADC. This will help you know if your op amp circuit is getting noise or if it's something inside the Teensy after the ADC.

It's good to separate these things in functional blocks and test down through the system. Something common in the DIY stompboxes community is an Audio Probe

[EDIT] I do recommend using the diodes for input protection. The only change to the circuit is put a 47 ohm resistor feeding the ADC input with a 47n to 150n capacitor to ground at the ADC input. The parasitic capacitance in the diode works as a nice low impedance to inject switching noise on the ADC input. The capacitor will shunt this to ground and the resistor gives it some impedance to work against. This also serves as a basic anti-aliasing filter.

Here is what I am doing for a guitar input. My circuit is optimized to guitar signal levels, and it is hard limited between 0V and 1.2V. I noticed wrap-around when the ADC is overdriven -- in fact the ADC makes noise when it gets signal between 1.2V and 3.3V (another possible source of your problem -- maybe you are overdriving the 1.2V range).

I decided to use a precision voltage reference to clamp the voltage just shy of 1.2V, and used the discrete "op-amp" circuit to give me decently linear operation right down to the 0V rail. The second harmonic measured in SPICE simulation is around -80 dB for a 0.5Vpp output and the remaining harmonics are in the noise floor (<90 dB). For a 1Vpp output the first harmonic is about -60dB and the final visible harmonic before dropping into the -90 dB floor is the 6th. I am expecting the nice mix of even harmonics will not sound bad on guitar as it approaches the limit and it is on-par with typical stompbox effects.

I have added several stages of ground-earth capacitors for anti-aliasing. This comes to about -6dB at 20kHz, intentionally starting to roll off at around 14 kHz since this is not too hard to correct with a digital filter.

View attachment 11289

Thanks very much for this! I'm now pretty sure that the 5V offset from the regulator is responsible for the noise, as I went back to my breadboard, and as soon as I disconnected it the noise went. I'm going to try a voltage reference IC, but will also try your suggested filtering just before it goes into the ADC.
 
On Teensy 3.2 the noise increases when audio is present, and I now know why (and fixed it).
Could it be this issue? I have a fix in my fork
https://forum.pjrc.com/threads/4577...e-distortion-in-input_adc-cpp-input_adcs-cpp
I recommend you look at this one once you get the external noise problem resolved. The existing DC removal algorithm will increase your THD to a very audible level.

I don't know what Paul will want to do for a final solution but my testing so far on what I implemented in my fork seems to resolve the issues in the history of the DC removal algorithm: Notably it performs an "un-do" operation on the nasty aliasing from the current method. The current DC-removal algorithm will increase in "badness" according to the amount of low-frequency content in the source signal. If you're using it for a synth and do a lot of wide-band stuff (bass and treble) I expect will become intolerable.

I think you will hear what I'm talking about when you get your input amplifier noise resolved and start really listening. Play some chords and hear, then apply my fork and try again and you will hear the difference.

The ADC isn't actually **THAT** low-fi :)
 
Status
Not open for further replies.
Back
Top