3
\$\begingroup\$

My circuit has a digital and an audio part. The audio part is quiet when the uC is connected via USB to a PC, and a bit noisier when they're disconnected. What is the PC doing to reduce the noise, and can I replicate the effect when disconnected? (I've tried using the black (GND) USB wire to ground the uC - that's not it.)

The noise sounds similar to a 12" wooden ruler being twanged on a wooden desk, when about 2" of the ruler is being held onto the desk. It's a rumbley kind of sound. Not sharp.

Here's a photo of the noise when not connected to the PC - each pass across the screen is about half a second.

noisy scope trace

Here's what it looks like when the PC is connected.

quiet scope trace

The digital part has these components:

  • Microcontroller with two true analog outs, which drive
  • Two voltage follower op amps, driving
  • LEDs in two NSL32 photocells, the LDRs of which are part of the audio circuit

The analog circuit has these components:

  • Op amp input buffer
  • Volume attenuation using NSL32s' LDRs to form a potentiometer
  • Op amp output buffer

The Whole thing is supplied by a single-ended 9V supply, smoothed with a 470uF electrolytic capacitor. The supply for the uC is derived using 5V regulator.

The first thing the supply sees is a reverse-voltage protection circuit, then the 470uF.

There's a bit of redundancy built in in case parts aren't available. Also, DGND and GND meet at a single point on the PCB right next to where the 9V supply reaches the board, the idea being that digital ground currents flow directly into the power supply, and don't take a detour around the audio circuit. I'm a complete noob, though, so this measure might only make sense in my imagination.

The power supply is a switched-mode supply (1-Spot CS7), designed for guitar effects, such as my circuit. I don't know the inner workings, but I used my multimeter to establish that there is high resistance between the mains plug's earth pin and the negative of the 9V, which connects directly to GND and DGND.

Things I've tried:

  • Using a power-only USB cable to connect uC to PC. This reduces the noise to the same extent as a data+power USB cable.
  • Using a powerbank instead of the PC. This gives no noise reduction.
  • Placing an extra 470uF across the power terminals of the uC. This gives no noise reduction.
  • Connecting either the black (GND) wire or the shield (I used the metal casing of the USB plug) from a USB cable connected to the PC to the ground plane of the circuit. This made no difference to the noise level.
  • Connecting the uC to the PC using a USB cable that has only two conductors, and is broken in the middle so that I can reconnect the conductors using crocodile clips. When both conductors are connected, the noise is reduced. When only one conductor is connected, the noise level is not reduced.
  • Disconnecting the mains power supply from my PC (it's a laptop) and running it on battery power. This makes no difference to the behaviours above, so I deduce that the earthing of the PC has nothing to do with the noise reduction.

Here's what the two conductor arrangement looks like:

two conductor arrangement

The white USB cable is plugged into a black extension cable which runs inside the enclosure to the uC.

complete circuit diagram

Here's the board layout of the ground planes (blue is copper). The highlighted one is GND, the other being DGND. They are connected at the extreme left end of the GND area, via two header pins which straddle the gap, or via an oval shaped solder bridge just to the right of that. The two audio op amp bits are over on the right hand side where the cluster of vias is.

ground plane layout

\$\endgroup\$
10
  • 3
    \$\begingroup\$ So describe the 9V supply? Is it a switch mode power supply, and does it have 2-prong mains input, so it does not utilize mains earth/ground, or does it have 3-prong earthed/grounded mains input, but connected to 2-prong unearthed/ungrounded mains socket? \$\endgroup\$
    – Justme
    Jan 29 at 6:35
  • \$\begingroup\$ @Justme, I wondered whether the PC might be providing what I think of as a "steadier GND reference" - which might be where your question is leading. But I tried to explore that possibility by connecting the USB's black (GND) wire to the ground of my uC - and it made no difference. I've updated the question to provide more detail on the PSU. \$\endgroup\$ Jan 29 at 6:45
  • \$\begingroup\$ In a PC PSU (ATX PSU) the output negative (0V) is tied to the earth (PE - protective earth). This simply eliminates the common-mode noise. However, for an SMPS, having an output completely isolated from the mains doesn't mean the output will contain common-mode noise because the noise can be still eliminated (not completely but to some extent) by using Y-caps across the output terminals and the PE (i.e. from VO+ to PE and from VO– to PE). \$\endgroup\$ Jan 29 at 8:03
  • 1
    \$\begingroup\$ @RoyC, but that's the opposite of what's happening. The OP reports that their audio circuit gets less noise with USB connected and active, not more noise. \$\endgroup\$
    – TonyM
    Jan 30 at 11:29
  • 1
    \$\begingroup\$ Not your main problem, but decoupling caps on analog parts like op amps are a really good idea. Maybe I'm just missing them, but it doesn't look you have any. Datasheet recommends standard 100nF. \$\endgroup\$ Feb 21 at 1:16

4 Answers 4

4
+200
\$\begingroup\$

enter image description here

You're using unfiltered power supply voltage to set the DC bias of the opamps, which means you're listening to your 9V power supply.

On the first opamp, using a signal source with low impedance would mitigate this, but not on the second opamp as its source is the LDR attenuator.

This type of arrangement is fine in an analog guitar pedal powered by a 9V battery where all the "noise" on the power supply comes from the analog circuit working on the signal, in this case it will simply add a bit of distortion and perhaps participate on the sound character of the device.

But in your case you have a MCU with a display and stuff that creates random current draw on the supply which is completely unrelated to the sound, so when it gets injected into your signal it makes a mess.

-> to confirm, please probe the 9V rail with the scope and check for noise.

enter image description here

You're powering the ItsyBitsy MCU board via its VBAT pin, and the schematic shows it has input diodes which will draw supply current from the highest supply voltage of VBUS (USB) or VBAT. Thus when you give it a USB supply that is slightly higher than the 7805 output, it will use the USB supply instead.

How to fix this: You'd need at least a RC filter on the voltage used for this midsupply reference, with a large low ESR cap. Or you could use a high ripple rejection linear regulator to make a 4.5V voltage reference. The important thing is you need it to be clean.

U1 could perhaps use a little bit of filtering in its supply too.

There may also be ground problems: when the mcu board is powered via USB, its supply current does not flow through the circuit's ground. But when it is powered from the 9V supply, it does. Since supply current of MCUs is quite noisy this could create a voltage drop on ground adding to your signal. Can't say more without seeing the layout.

Personally, I would design the circuit to draw almost constant current on the 9V supply. Thus if someone uses the same 9V power supply for several pedals, they won't have ground loop problems due to noisy current flowing in the ground of the supply wires. This also makes it much less likely to have problems even when the pedal is used alone.

This either requires using a shunt regulator, which wastes power, or cheating with a RC filter on the input to smooth current, followed by a 5V LDO. Plus other noise mitigation measures like using constant current instead of PWM for the LED backlight and other variable brightness LEDs, not using sleep on the MCU, using a constant current scheme to drive the opto LEDs (maybe a LTP), etc.

Second issue:

enter image description here

LEDs are being driven with voltage, which means LED current is not controlled, it will depend a lot on temperature. Fortunately the wimpy output stage of TL072 will give up before the LEDs burn, but this could lead to problems.


Edit - since you have two 470µF caps on the 9V input I'd suggest cutting the trace between them and adding a resistor there. This way most of the AC current for the MCU will be taken from the cap on the right, and the RC filter formed by the resistor and the cap on the left will lower noise on your 9V supply.

enter image description here

\$\endgroup\$
9
  • \$\begingroup\$ I'm thinking about the RC + 5V LDO (I assume you mean a low dropout voltage regulator - sorry, I'm a noob with electronics). I think one advantage of using the voltage divider in the current schematic is that if the user provides, say, 18V, instead of 9V, then the bias moves up to 9V, and so the audio circuit has more headroom. It's something I could sacrifice, though, in the interests of noise reduction. Would the RC filter on the supply be enough by itself? \$\endgroup\$ Feb 22 at 0:42
  • \$\begingroup\$ Also, I assume the RC filter would want to use as low a resistance as possible,. I'm thinking ~20Hz would be a good cutoff point, I have some 470uF electrolytic caps lying around, and 10 Ohm resistors. Would that do the job? \$\endgroup\$ Feb 22 at 0:56
  • \$\begingroup\$ Sorry, I missed your point about the large, low ESR cap. In any case, I don't have a great range of parts handy. I added a 10 Ohm before the 470uF electrolytic, and a ceramic 10uF in parallel with the 470uF. This does reduce the noise a bit. In fact, the 10 Ohm by itself made the difference. Adding the 10uF ceramic didn't seem to improve it any further. This has been the most improvement I've seen so far, though (having tried @Maths's suggestions). \$\endgroup\$ Feb 22 at 6:39
  • \$\begingroup\$ Well the only load on that midsupply reference is the 2.2 Megohm resistors biasing the opamp inputs, thus current will be tiny! So you can use 470µF and 470 ohm or 1kOhm for your RC filter, it will work even better than 10 ohms. Note, high-K ceramics (X7R and the like) are highly microphonic so not suitable for this, nor for any signal/filtering/DC blocking roles. \$\endgroup\$
    – bobflux
    Feb 22 at 8:42
  • \$\begingroup\$ If you switch the display backlight on and off, does that change the noise? \$\endgroup\$
    – bobflux
    Feb 22 at 9:05
1
\$\begingroup\$

Although C10 and C13 provide capacitance between the 9V input and ground, these are (most likely) electrolytic capacitors with high ESR. The 78L05 can oscillate if its input and output are not properly decoupled.

I would add a 330 nF ceramic capacitor very near to the input of the 78L05 and a 10 nF ceramic capacitor near to the output. I would also add a 100 nF ceramic bypass capacitor as near to the power and ground pins of U1 as possible.

\$\endgroup\$
2
  • \$\begingroup\$ The biggest ceramics I have on hand are 100nF. I have 330nF and 100nF film caps. Will it be worth trying the film caps? Should I solder together as many ceramics as possible to approach the values? \$\endgroup\$ Feb 21 at 5:14
  • 2
    \$\begingroup\$ I soldered three 100nFs (C315C104M5U5TA) together, and attached them to the input (9V) and GND pins of my LM78L05. I straddled the U1's Vcc and GND pins with a 100nF. There is already a SMD 10nF in the circuit. Unfortunately, this made no discernable difference to the noise. +1, though, for finding where I hadn't followed the datasheets : ) \$\endgroup\$ Feb 21 at 8:04
1
\$\begingroup\$

You have a power distribution problem. Example 5V source reference is ground but all devices using 5V are referred to DGND. Using a single point ground (I can't find it on the diagram) in this way places trace inductance between the 5V source GND and DGND causing considerable ground bounce. The same is true for the analog ground. You should use a pristine ground plane connecting all grounds to the plane. I'm guessing that the individual current loops are very large thus enhancing interference.

Solving this problem with the information provided cannot be definitive.

Number one rule for board layout is,"Keep the area of all current loops as small as possible."

\$\endgroup\$
2
  • \$\begingroup\$ DGND and GND meet at a single point, right by the place the supply comes onto the board. \$\endgroup\$ Feb 22 at 4:25
  • \$\begingroup\$ I've added a diagram of the ground planes, if that helps. \$\endgroup\$ Feb 22 at 6:32
0
\$\begingroup\$

As far as the source, you need to determine if this is conducted or radiated emissions. Conducted means "through a cable" and this can be caused by ground loops. Radiated means there is some kind of radiation creating a voltage on a conductor and turning it into an antenna. Another problem is ground loops and ground currents, I'll get into that later.

If a powerbank or a laptop powering the device doesn't make the noise go away, then the noise is probably not caused by a ground loop, because you have broken the ground loop with isolation from battery power.

The most likely source of your noise is internal to the project. There are a few things you can do to determine the source of the noise. It could be radiated noise inside of the design or common mode voltage noise (ground bounce).

The first is common mode voltage noise, to check this probe all grounds between PCB's and devices within your project. Turn the DMM to AC voltage mode and check between as many ground points as you can, they should all be below a threshold, say ~10mV, but this varies. If you see a large voltage between grounds, the impedance (resistance+inductance) of the design is too high. This means you need to make a bigger fatter conductor and your ground has too much resistance.

The other problem is radiated noise, this will be harder to diagnose if you don't have the right equipment. You'll need a near field antenna and a spectrum analyzer.

If you don't have a continuous ground plane (especially near your analog signals) is likely that either one of these problems could be an issue.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.