Mixed Signal Design

Started by Gobotak, May 16, 2024, 03:04:08 PM

Previous topic - Next topic

Gobotak

I've been trying to control a VCA with a microcontroller but haven't solved noise issues yet. I have tried a few different board layouts separating the digital and analog grounds but had no luck with that.  I recently tried using a separate isolated power supplies (one for my audio board and the other for my microcontroller) and the noise went away.  This is great but not practical to have a circuit that requires two power supplies. My initial thought was to try something like this:

I don't think this is the best idea and am guessing the current draw would cause a significant voltage drop.
Does anyone have advice for separating analog/digital sections?

ElectricDruid

What makes you so sure the power supply is causing the noise issues?

Are you filtering the VCA CV from the microcontroller/DAC? If not, or if the cutoff isn't right for the update rate you're using, you're feeeding a signal with gigantic steps in it to the VCA. A VCA is a 2-quadrant multiplier, so all the energy in those steps goes straight into your output signal.
I've been caught out like this in the past. "Oh", I thought, "12-bit DAC! No problem!" but if the output isn't updated often, a 12-bit DAC can give only a few values and you *still* get massive steps. You just get high resolution steps is all!

Post the schematic and give us an idea what the code is doing, how fast the output sample rate is, etc, and we'll take a look and see what we can spot.

Yes, power supplies can cause problems on mixed signal boards, but they're far from the only thing you have to watch out for.

Rob Strand

If the two supplies worked then you might need to work out why it worked.

If you use the two supplies as a starting point then you might consider how to emulate that with a single supply:
- star grounding (separating digital and analog grounds)
- separate supplies in the sense of separate tracks running to the analog and digital.
- separate bypass caps on the analog and digital.
- decouple the supplies with resistor and/or inductors on the supply rail.

There's plenty of "textbook" mixed signal tips on the web.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

m4268588


Gobotak

I have some filtering on the DAC output.  It is an active low pass filter at about 15Khz.  I also tried more filtering but that didn't seem to help.
I thought it might be the power supply because the noise went away when I used two isolated power supplies.  I had a pcb put together with the VCA and microcontroller on the same board using one power supply and was getting noise.  I disconnected the microcontroller from this board and built up the digital section on a breadboard.  I used a separate power supply for this and when I used that for the VCA the noise went away.  I used that same microcontroller, same filtering, and same code which led me to think it might have something to do with the power supply.
I tried to separate the analog and digital sections as much as possible each with their own ground that connected at the power supply.  I also tried two separate boards with one containing the analog section and the other with the digital thinking this would isolate things as much as possible. These boards shared the same 9V supply though and the noise was still present.

When you say decouple the supplies with resistor and/or inductors do you mean like how I have it in the image in my first post or is there a different way of doing this?  I didn't think the RC filter would be the best method due to potentional voltage drop dealing with higher current draws.  I haven't tried using inductors before for filtering so that it something I will be looking into.  I haven't done a ton of reading on LC filters vs RC filters but is there a reason I typically see RC filters more than LC filters on the power supply in?  From the bits of reading I have done it seems that using an LC filter doesn't lead to the voltage drop that RC filters do.

Rob Strand

#5
Quote from: Gobotak on May 16, 2024, 09:23:39 PMWhen you say decouple the supplies with resistor and/or inductors do you mean like how I have it in the image in my first post or is there a different way of doing this?  I didn't think the RC filter would be the best method due to potentional voltage drop dealing with higher current draws.  I haven't tried using inductors before for filtering so that it something I will be looking into.  I haven't done a ton of reading on LC filters vs RC filters but is there a reason I typically see RC filters more than LC filters on the power supply in?  From the bits of reading I have done it seems that using an LC filter doesn't lead to the voltage drop that RC filters do.
Yes that's the idea.

You often don't need a lot of resistance to get the job done maybe even down to 1 ohm or 10 ohm.  If you can get away with 100 ohm for the analog it might be better just the same.    And yes, on the other end of the scale if there's significant DC current you might need to use inductors to prevent excessive DC voltage drops.  That being said, there are cases where separating/filtering only the analog power like that works and just use wires to the digital power.

Some of the more important points would be:
- star grounding
- put bypass caps close to the noisy devices.
  That helps stop noise currents from polluting the ground traces with noise.
  Once the noise gets on there it's very hard if not impossible to remove.

If you have a low-pass  filter on the output of the DAC in most cases it's better if the filter was on the analog ground.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

R.G.

As usual, Rob has some very good points.
It always helped me to think of switching circuits and noise like this. When something switches, it bangs all the way from power supply to ground, or vice versa. This makes for a big - even if very short duration with a capacitive load - pulse of current either from the power supply to the load, or from the load to ground, plus a big, short pulse of current from power to ground through the switching part of the circuit.
The resistive+inductive impedance of >either< the power supply wiring and/or ground wiring all the way back to the power supply turns these current pulses into voltage pulses of very low impedance. Any circuit that shares any of the power supply or ground return wires sees the voltage jumps from the switching.
If it's done properly, decoupling caps keep a big bucket of charge very close to the switching devices. This lets the big pulses be conducted around the loop of power supply>switching device>ground wires>decoupling cap. The decoupling cap then fills back up slowly through the impedances of the power and ground wiring, so the wires back to the power supply see only a time-slowed-down version of the current pulses because the fast edges are eaten by the local decoupling cap. This is why they're called de---coupling caps; they remove some of the power and ground coupling between circuit sections. It's also why you need film or ceramic caps for fast switching or other high frequency circuits - these types have low ESR and ESL. Electrolytics are only good for slower/lower frequencies because of their higher ESR and ESL. You want the spikes and pulses to be resolved as locally to the device making the pulses as you can get them.
Pulses on supply and ground lines have another issue: ringing. The ESL and parasitic capacitance of the wires can make for RF ringing on the wires. You ...CAN... have a resonating ground wire. Try finding that with a DMM.  8-0
Currents will always eventually travel back to the source the current came from. Your experiment with two isolated power supplies is one example. You can choose the exact path the current will take by either star grounding at low frequencies or ground planes at high frequencies. DC currents will always follow the lowest resistance path, AC currents will follow the lowest impedance (R+L+C) path. For DC (and audio might as well be DC for this context), you force isolation of power and ground coupling by where the wires go. Star grounding is the result. For RF, you have to resort to planes because the impedance of even microstripline transmission lines can near the impedance of free space, and that means some of the RF will radiate out of the conductors.  Planes for audio and DC have low resistance, so they work fine (unless they introduce too much parasitic capacitance, another story) and the current will flow in a broad-ish swath in the direction of the power supply.

Here's a thought question: how do you decouple the >>ground<< wire?  8-)
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.

Gobotak

Thanks for the advice and explanations!  Admittedly my knowledge of this topic is still not nearly where I would like it to be so I appreciate the responses to my questions while I'm still trying to aquire a better understanding.
As for more specifics of my last pcb layout I used a four layout board with the inner two layers both being ground pours and the outer two power and signal traces.  I use smd components and vias to connect to ground. I do try to make a habit of including decoupling capacitors on each device.  I also tried to separate the analog and digital sections as much as possible. Each ground layer has two ground pours, one for analog and another for digital and both layers connect to a single point at the power supply.  This is the general idea:

I was following some of the points made in this lecture:  https://www.youtube.com/watch?v=ySuUZEjARPY
One of the things I took away was to always have a ground layer directly under signal traces.  I think  a lot of examples were in reference to high speed signals so maybe it isn't applicable to lower speed audio?

Matthew Sanford

My noob is showing but I'd seen an interesting video explanation for that, where the ground return current wants to return directly under the signal that generated it. If there is a break in the ground it's trying to go across, it will go around but creates currents in different directions, which can cause issues. I think your image is probably best case as long as signals aren't crossing the divide, I was kind of riddling on that for a circuit where the digital part is sending it's signal (LFO) to the analog, haven't made it so not sure if that little bit of crossing would cause much issue, or just force it to go towards the power supply ground instead of following the signal routing to get there...

From RG's explanation on decoupling capacitors I feel it makes the current less drunk, so instead of slamming into the ground it kind of stumbles (smoothly of course) towards it.
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

ElectricDruid

Quote from: Gobotak on May 21, 2024, 12:44:51 PMI think  a lot of examples were in reference to high speed signals so maybe it isn't applicable to lower speed audio?

Certainly analogue audio causes a lot less problems. But it's not necessarily about the overall frequency - one thing that pops up time and again here is ticking coming from LFOs, so the frequency can be <1Hz and *still* cause trouble! In that case it's (often) a combination of a big,fast edge when something switches with a noticeable current. In the case of high-speed digital lines, you've got the fast edges, but often far less current. But it's always sensible to route high-speed digital stuff (SPI comms lines are always the problem for me) away from sensitive analog lines, either audio or CVs.

I think your ground plane design and basic principles look pretty good. Good luck!

Gobotak

#10
I've been working at this but am still struggling with noise.  I think my issue might be that my control voltage for my VCA is noisy.  I don't have an oscilloscope to do measurements but I have been using my audio probe to listen.  My thought is that if I can hear noise at my control voltage, that noise is making it in to my audio path.  Here is what I have been trying lately:




I am using RC filters to the supply pins for my DAC, op amp filter, and 3V3 regulator.  Without the RC supply at the regulator, I get noise when probing at the 9V supply and 3V3 supply.  With the filter the noise is greatly reduced at 9V.  Similarly without the filter at the DAC 3V3 supply I get noise at the DAC supply pin and the DAC output pins.  With the filter the noise is reduced at the supply and output pins.  However when I try the same thing for my op amp filter I get noise even with the filter.      I'm sure it would help if I had a better understanding of what the cause of the noise is but I'm not quite there yet. My guess is that my microcontroller is the culrpit but I don't know why it is the culprit.  All that being said I'm curious if anyone thinks this a a good/not good strategy for minimizing noise?

fryingpan

Question: can using a regulator (even just for the analog side) help?