High gain audio amp picks up noise from analogRead ?

blakeAlbion

Well-known member
I am using a Teensy 4.0 within an antique transistor-powered drum machine.
It handles MIDI control and MIDI clock conversion very well. All was great until I wanted to add faders to the analog drum sounds. They were summed as low impedance signals going into a high gain transistor amplifier. Any small change to the level of one instrument had side effects on the mix, especially the bass drum. So I knew I needed an active mixer in there, so added an NE5532 low noise op amp to my board. (a solderable pcb breadboard)
I'm doing all sorts of crazy things in this project, and have been able to mitigate a lot of audio noise problems, but am now stuck.

There's a buzzing noise. By process of elimination I discovered the buzz was coming from rapid calls to analogRead().

This wasn't a problem until I brought op amps into my signal path. (with gain determined by 100K inverting feedback resistor). Most signal levels are high enough to not need a high gain amp. But those darn inductor-powered classic analog drum sounds need a lot of boost.

I use analogRead for 4 potentiometers which control some sound synthesis in the Teensy.
The use of analogRead in loop() is causing an audible buzz in my new little active mixer circuit. I was able to reduce it with some power decoupling capacitors and shielded cable for the audio lines and the analogRead() pins. But it's still there, just audible enough to make a person using headphones unhappy.
I can make the sound less noticeable by slowing down the rate at which loop calls the analogReads. But this is still audible as a choppy sound, and reduces the responsiveness of the pots, of course.

I can try to describe my audio and power setup but it's just a nightmare. The old drum machine has an unregulated (unless you consider a huge ceramic resistor a regulator) power supply at around 20V. I added my own enclosed high-current 5v supply for the digital electronics.

So I can keep trying to eliminate the noise. But is there anything else I can do? I read in the forum that using an external ADC is the pro way to minimize this kind of noise. But is there anything inherently noisy (making electrical noise in my amplifier circuit, not ADC read error noise) about analogRead() and is there any alternative method for reading that is less noisy?

I am using 100K potentiometers and read they should be 10K. I can switch those tomorrow. But again, would that account for the noise I hear in my mixer circuit ?

Thanks,
Ben
 
I have had similar noise problems using I2C for OLED displays in my audio projects. But for that problem it was simply a matter of adding a hella-big capacitor right to the OLED board. This is not so simple to solve.
 
Blake:
Just to start, the NE5532 was a pretty good Op-Amp in 1979 (I remember it well), but by todays standards it is JUNK.
5 nV/√Hz is not considered low noise, and a CMRR of 70 - 100 dB is not very good either.

Without a schematic and some pictures of your setup it will be difficult to give you much help on this problem. It sounds like EMF problems to me.

Regards,
Ed
 
Blake:
Just to start, the NE5532 was a pretty good Op-Amp in 1979 (I remember it well), but by todays standards it is JUNK.

Perfectly adequate for audio use, the 5534A and 5532 are in most mixing consoles used in the 70's until taken over
by DSP.
Yes there are better opamps, but they are usually many times more expensive. The 5532 is 50 cents or so in bulk and
a solid performer. Its still one of the few opamps that can drive a 500 ohm load without struggling.
Low noise below 5nV/√Hz matters for phono and mic level signals, not for line level. The current noise performance
is often more important in real circuits, so many people gloss over that.

You should probably read some of Douglas Self's books on audio circuit design. Using 5532's will not be a problem in
any way for a project like this unless you want 5V rail-to-rail operation (avoiding +/-15V supplies).

Back to the point - this sounds like there a ground loop, or that parts of the digital ground wiring are being used for
analog ground (never a good thing). So digital noise is getting into the analog circuit.

Most mixed circuitry like this has completely separate analog and digital supplies, with the grounds commoned in
one place only. This avoids digital hash causing IR voltages in the analog circuitry wiring. Attention to detail of
grounding is important - a good detailed schematic would be needed to troubleshoot I think.
 
Blake:
Just to start, the NE5532 was a pretty good Op-Amp in 1979 (I remember it well), but by todays standards it is JUNK.

Perfectly adequate for audio use, the 5534A and 5532 are in most mixing consoles used in the 70's until taken over
by DSP.
Yes there are better opamps, but they are usually many times more expensive. The 5532 is 50 cents or so in bulk and
a solid performer. Its still one of the few opamps that can drive a 500 ohm load without struggling.
Low noise below 5nV/√Hz matters for phono and mic level signals, not for line level. The current noise performance
is often more important in real circuits, so many people gloss over that.

You should probably read some of Douglas Self's books on audio circuit design. Using 5532's will not be a problem in
any way for a project like this unless you want 5V rail-to-rail operation (avoiding +/-15V supplies).

Back to the point - this sounds like there a ground loop, or that parts of the digital ground wiring are being used for
analog ground (never a good thing). So digital noise is getting into the analog circuit.

Most mixed circuitry like this has completely separate analog and digital supplies, with the grounds commoned in
one place only. This avoids digital hash causing IR voltages in the analog circuitry wiring. Attention to detail of
grounding is important - a good detailed schematic would be needed to troubleshoot I think.
 
Blake:
Regardless of what I or Mark have to save about circuit design techniques, without a detailed schematic and most probably pictures of your setup, solving this or any other unwanted noise problems is very unlikely.
Ground Loops, flying leads coupling noise, power supply noise bleedthru to high gain circuits, even stray magnetic fields impinging on wiring. These are just some of the many different problems that could be causing your unwanted noise.
However I do agree with Mark that a ground loop is probably the most common type of problem in audio circuits.

Regards,
Ed
 
Thanks for some input! I looked up some contemporary op amps and read about ground noise, again.
I'm no good at book learnin' but I finally had to put on my deformed, underdeveloped thinking cap and concluded that I had not tried different levels of impedance. The original audio circuits were very low impedance, so I had to match my inputs/outputs on my op amp more carefully. This solved my problem. Teensy buzzing and clicking is now below the threshold of perception. In this case I absolutely must share grounds because I'm using the Teensy for control input, triggers and DAC output, MQS audio, and MIDI on the same board as my audio circuits. It's tedious to keep it quiet but it's awesome when I get it working correctly.
 
Blake:
I glad you have solved your problem.
Both Mark and I have pushed you to learn more about the innards of working in this domain. This has been the goal all along, because if we did it for you, you would not have learned anything. You have a new fold in your brain now and that's is really great!

Regards,
Ed
 
Agreed, the buzzing noise is very likely a ground loop issue.

I also feel NE5532 is a pretty good opamp for audio, if you're using +/- 12 to 15 volt power, and you don't mind the power consumption, and you're doing only "normal" audio stuff where the large input bias current isn't a problem (eg, no sample & hold). But if you're making small portable low power things, it kind of is a relic of the past when everything was big and bulky and came in cases made of steel or iron.
 
I also feel NE5532 is a pretty good opamp for audio, if you're using +/- 12 to 15 volt power, and you don't mind the power consumption, and you're doing only "normal" audio stuff where the large input bias current isn't a problem (eg, no sample & hold). But if you're making small portable low power things, it kind of is a relic of the past when everything was big and bulky and came in cases made of steel or iron.

Currently low voltage CMOS opamps are starting to come to the fore - they've made significant strides in lowering the voltage noise of CMOS analog,
so chips like the AD8656 which are 5V capable true rail-to-rail and pretty good performers are available. There are plenty of low voltage opamps but
few of them have the combination of low cost, low noise, low distortion and high drive capability wanted for general purpose audio use (high drive is useful for
low noise circuitry where the loads are low impedances to reduce Johnson noise from the resistors).

Interestingly the NE5534A is still perhaps one of the top few affordable bipolar opamps with decently low current noise at 0.4pA/√Hz - if your circuitry is
10k impedance or above current noise is usually dominant and very often overlooked - FET input opamps are ultra-low current noise so
this is a unique issue to bipolar input opamps.

Even the LM4562 touted as one of the latest high performance bipolar audio opamps has much higher current noise than the 5532 and a serious issue with
quality control with popcorn and 1/f noise. And its still more expensive.

Cheapness of the 5532 allows a rather unique approach to building an audio power amp too: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiVuOjjy7T2AhUPZcAKHT6xCWsQFnoECAUQAQ&url=https%3A%2F%2Fwww.physicsforums.com%2Fattachments%2Fdouglas_self_elektor_amp5532_compressed-pdf.254881%2F&usg=AOvVaw0nC43peZf7Po8gK7OQGR3O
 
Thanks all for the input, all! What I found was the clicking/buzzing was greatly attenuated by adjusting analogRead bit depth and resampling. I had resampling at 32 and setting that to 0 cut noise by 3-6 dB to my ear. Cutting the bit depth from 12 to 8 also reduced noise, but I'm going to have to try 10 bits because my knobs are now too quantized. I also replaced the original power supply for analog components, and that cut the noise down so low you can still hear the analogRead() noise.
I have 10µF capacitors on the 5V supply to the Teensy, the 3V output of the Teensy's regulator, and on the 2 other daughterboards. The one on the 3V pin helped the most.
Shielded cable on my analog input pins had no effect whatsoever except to make my wiring look more legit.

But fundamentally my problem is, this is a drum machine from the early 1970s and the 2-transistor mixer circuit is extremely high gain. To solve this correctly, I need to replace the high gain/high impedance mixer with the lowest gain mixer possible, and bypass the mixer resistors.
 
BTW for audio use 10µF decoupling is rather small, you'd expect 100's of µF on the supplies as more normal values to
keep lower frequency noise and mains hum/buzz under control.

Another technique that can be employed is to sample synchronously at ultrasonic rates so there's no audio frequency
energy in the ADC circuitry - this does mean having to drive your ADC readings on a regular clock at 20kHz or higher,
but a T4 is faster enough to take this in its stride. The same trick applies for switch-mode power supplies used for
audio circuitry - switch at a fixed ultrasonic frequency to avoid putting energy into the audio band.
 
Thanks MarkT. I have no problem dropping in the 100µF capacitors. But how do I change the sample frequency? I am sampling in loop(), do I need to use a timer?
 
I am sampling in loop(), do I need to use a timer?

Sampling audio has to be precisely timed or you get distortion due to jitter (it will typically be _very_ audible) - if the sampling rate
isn't constant its equivalent to injecting artifacts, even 0.1% timing variation is only -30dB down from full-scale. This is why decent audio
ADCs are always hardware-clocked from quartz crystal oscillators.

I added a timer. It was easy and FUN. Thankyou!
Glad its worked out for you.
 
(I used a 470µF capacitor to quiet down an IC2 OLED display.)

@blakeAlbion I'm also having noise issues caused by a write/read (volume control) on my system. When I pause the volume write/read the noise disappears, so that's how I know it's the I2C line causing the noise. I don't have an OLED display. Should I put a large capacitor close to my DAC on the AVDD power supply? Is that a solution? I'm assuming that the noise is getting into the power supply somewhere on the system, and then by putting this large capacitor near the DAC I can filter it from going into the DAC in the first place?
 
Back
Top