Optocoupler for audio signal isolation?

Started by mark2, September 04, 2020, 01:42:56 PM

Previous topic - Next topic

mark2

I have an OLED board that uses a microcontroller with an ADC to sample the audio signal and draw related stuff on the screen (VU meter, or freq analyzer, interactive pong game!, moving mouth, etc).

The combination of the IC and the screen introduce terrible noise into the signal, though.

Given that the input signal of the board doesn't need to be perfect for these purposes, is there anything wrong with doing something like the following to isolate the "IN" which comes from the audio signal chain, from the "OUT" which goes to the OLED board?



If this is sane, two questions:

1. How can I avoid this introducing its own noise? On my breadboard it gave its own high level of constant, steady noise

2. How do I decrease its load on the IN?  I notice when it's hooked up, the distortion pedal before it has a far lower output and less gain.

PRR

What does R3 do?

What does R2 do?

What is the LED idle current?

How did you pick the C2 polarity?
  • SUPPORTER

mark2

R1 and R2 are meant to pull the signal up to around 4.5V.

I'm not sure if R3 is necessary, but I put it there for fear of burning up the LED. And on that note, I don't (yet) know what its idle current is.

I was trying to start from a simplified version of the 5.3.4 circuit on this page.

C2 polarity was just blindly copied over from that circuit.

And of course (as always) if there are no simple answers I totally understand since I recognize I'm out of my depth here and may need to fill in more than a few gaps in understanding before tackling something like this.

Sooner Boomer

I'd be willing to bet a shiny penny that this circuit won't solve the problem. Mixed (analog/digital) circuits can be lots of fun to troubleshoot for noise. I'd look at the power rails. Digital circuitry is notorious for injecting noise onto the rails. A fun project I worked on was a weather research balloon instrument. It had analog, digital, AND RF!. We ended up putting ferrite beads on all the leads of the ICs, pus cutting some traces and adding surface mount inductors. The next set of improvements, I added a bunch of shielding made from angle and sheet brass from the model train hobby shop. Got the noise down really low.
Dan of  ̶9̶  only 5 Toes
I'm not getting older, I'm getting "vintage"

ElectricDruid

I agree with Boomer. While something like your circuit would isolate the *input*, the problem you've really got is noise leaking *out*. And it's not doing that by going backwards up the input wire is my bet. Like Boomer said, the rails are a much more likely source. If you can isolate the power and/or ground that the OLED and uP part uses, that should help. It's also possible that noise is radiated - digital circuits do plenty of proper high speed stuff that is basically radio waves, so you can expect nearby bits of circuit (which are basically antennas) to pick it up.

Mixed signal circuits are difficult, but separate power supplies are good start.

mark2

I don't think it's the power based on this: When I disconnect the audio input from the OLED board (or never connect it, since some of the graphics "modules" don't require it) the specific noise is gone. It's a prominent and noticeable difference.

There's a bit of power noise too, but it's far less severe and I seem to mitigate with caps across +/-.

PRR

> R3 is necessary, but I put it there for fear of burning up the LED.

The only paths for burn-up current is through 10k and 100k resistors. Another 1K does hardly anything. In fact I already suspect your problem is too little current.

> a simplified version of the 5.3.4 circuit on this page.

OK; you simplified-out an important detail: the amplifier.


> C2 polarity was just blindly copied over from that circuit.

Internet must have flipped it back.

> I'm out of my depth

Past your comfort-zone, let's say. The LearnAbout circuit looks good.

I AM curious why you are so troubled with "noise", but that's a big subject.

  • SUPPORTER

mark2

Quote from: PRR on September 04, 2020, 04:37:30 PM
The only paths for burn-up current is through 10k and 100k resistors. Another 1K does hardly anything. In fact I already suspect your problem is too little current.

Good point, thanks. I had it in there before adding R4 but it still may not have been necessary at that point since it was just an audio signal.

Quote
OK; you simplified-out an important detail: the amplifier.

I wasn't able to get it working with the opamp. I can see the signal looking good going into and out of the opamp, but nothing coming out of the optocoupler.
With this simplified version I was able to reproduce the audio just fine.

QuoteI AM curious why you are so troubled with "noise", but that's a big subject.
I may be misunderstanding, but to be clear: I don't mind a bit of noise on the "OUT" of this circuit, as it's just going to the IC for sampling.
That part all works great.

The problem is the audio chain connected to "IN" is extremely noisy to the point of being unusable, either
A. from the IC when this isolation circuit isn't present, or...
B. a different type of noise from this circuit. Though it accomplishes the goal of getting rid of the IC and OLED noise.

Sooner Boomer

How does this actually get rid of noise? If there's audio level noise mixed in with the signal, what keeps it from going through the optoisolator like the signal?
Dan of  ̶9̶  only 5 Toes
I'm not getting older, I'm getting "vintage"

mark2

Well, the idea is to reproduce the clean signal on IN over to the OUT side.  The noise-inducing digital stuff is on the "OUT" side, so it keeps it from imparting noise onto the "IN"

Sooner Boomer

Sorry. Sometimes I get too focused on symptoms, I miss solving the cause.

Is it possible to insulate the digital stuff, say by wrapping it in a piece of a plastic bag, and then wrapping it in a piece of aluminum foil? This would create a Faraday cage around the digital stuff, a quick and easy way to try shielding.
Dan of  ̶9̶  only 5 Toes
I'm not getting older, I'm getting "vintage"

r080

Quote from: mark2 on September 04, 2020, 01:42:56 PM
1. How can I avoid this introducing its own noise? On my breadboard it gave its own high level of constant, steady
You mention noise on the breadboard. The article at that link talks about noise on the breadboard, too (see quote below). Do you have the digital stuff and analog stuff on the same breadboard?

Also, this is probably less likely, but is it possible the phototransistor is somehow misbiased such that it is acting more like a switch, and adding switching noise to the rails only when the analog input is connected?

"Noise generated around the optocoupler on the breadboard could be a problem but may be reduced or eliminated by careful PCB design, and extra decoupling of the supply lines close to the ICs."
Rob

bluebunny

Quote from: Sooner Boomer on September 05, 2020, 07:17:52 AM
Is it possible to insulate the digital stuff, say by wrapping it in a piece of a plastic bag, and then wrapping it in a piece of aluminum foil? This would create a Faraday cage around the digital stuff, a quick and easy way to try shielding.

The noise travels down the wires.  A Faraday cage has no effect on wires that protrude from the cage.  You need to decouple the power going to the digital part of your circuit.
  • SUPPORTER
Ohm's Law - much like Coles Law, but with less cabbage...

ElectricDruid

Quote from: mark2 on September 04, 2020, 04:28:32 PM
I don't think it's the power based on this: When I disconnect the audio input from the OLED board (or never connect it, since some of the graphics "modules" don't require it) the specific noise is gone. It's a prominent and noticeable difference.

I'm not sure this is fair test. The OLED board isn't doing anything when there's no audio signal. Presumably it's the processing and OLED data lines that make lots of noise. If the processor is seeing blank data and the OLED is seeing blank data, it's no wonder it doesn't get so noisy.


mark2

Sorry if it wasn't clear but the test was with an animated image that's independent of the audio signal. But the digital circuit and oled behave the same (for that test) with or without the audio signal connected.

Very loud definite noise introduced when it's connected

jfrabat

Mark, 2 things I see here.  (1) If all you want is a VU meter, you do not need a ADC.  I made an OLED VU meter with an Arduino and the OLED screen and nothing else.  (2) If not use a buffer to separate the input and the output?  A unity-gain buffer with a TL071 or similar should work.
I build.  I fix.  I fix again.  And again.  And yet again.  (sometimes again once more).  Then I have something that works! (Most of the time!).

mark2

Well, it's a module that does a huge variety of things (runs many different types of programs), not just VU. The IC is an atmega or attiny, so it's probably using the same on-board ADC you are.

I tried putting a buffer in front of it with no luck, but perhaps I did something wrong so I should give it another try.

jfrabat

Quote from: mark2 on September 05, 2020, 11:46:59 PM
Well, it's a module that does a huge variety of things (runs many different types of programs), not just VU. The IC is an atmega or attiny, so it's probably using the same on-board ADC you are.

I tried putting a buffer in front of it with no luck, but perhaps I did something wrong so I should give it another try.

Ah, OK.  I thought you were using Arduino...  Now it makes more sense.  But the unity gain buffer should work.  And it is a MUCH simpler circuit!0
I build.  I fix.  I fix again.  And again.  And yet again.  (sometimes again once more).  Then I have something that works! (Most of the time!).

ElectricDruid

Quote from: mark2 on September 05, 2020, 09:24:21 PM
Sorry if it wasn't clear but the test was with an animated image that's independent of the audio signal. But the digital circuit and oled behave the same (for that test) with or without the audio signal connected.

Very loud definite noise introduced when it's connected

Ok. Sorry, I hadn't picked that up. That *does* sound like a solid test then.


amptramp

There is a way to linearize an optoisolator with the accuracy of an op amp:



There are two identical optoisolators with the LED's in series so the same current flows through both.  Both phototransistors are connected with the collector to isolated 12 volt supplies and a resistor to ground.  C1 in the schematic is too high for audio so it should be reduced but not eliminated.

The idea here is that the voltage seen on the inverting input on the drive side op amp is faithfully copied on the output side.  The second op amp is just a follower (which may not be necessary) and is only shown so the footnote can be added that it is not operating off the same power supply.