0
\$\begingroup\$

I am using a rotary encoder to control the value of a digital potentiometer, specifically the MCP41HV51. I have a 9V supply feeding a 5V linear regulator. My logic supply for the digit pot is the 5V, and my analog supply (V+) is the 9V (V- is grounded). The encoder goes to a microcontroller which controls the digital pot. I have pull-up resistors on the A and B contacts on the encoder going to 5V. I am using the digital pot as a variable feedback resistor of an op amp used for audio gain control.

I originally thought the noise I was hearing while adjusting the digital pot with the encoder was zipper noise from the digital pot changing values, however I have been able to identify the noise I am hearing is due to the rotary encoder. I have 47uF of capacitance on my 5V supply yet I still hear a popping/zipper noise when moving the encoder. I have been able to verify the sound comes from the encoder by commenting out the code in my microcontroller that sends a new value to the digital potentiometer. I also have a few buttons with pull-ups to 5V that make an audible sound in my gain stage. I'm assuming the popping sound on the 5V supply is making it's way either back to my 9V supply or ground, possibly coupling somehow through the digital pot.

The op amp is a TL072 with V+ at 9V and V- grounded. My reference voltage is 4.5V from a voltage divider.

What should I do to solve this issue? Do I need separate digital and analog grounds? If I do that, how do I couple the grounds together? I'm new to working with both audio and digital in the same circuit.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

This is general: Be sure no digital circuit get its ground side supply current through the same wire which is a part of analog circuit ground wiring. Digital GND and analog GND can meet only in a single point which is the output capacitor of the power supply, C1 in your case.

Also be sure digital circuits cannot pollute your DC voltages in the analog side. You have V3=4V drawn as voltage source. How it's made? Hopefully it has a hefty capacitor to keep it clean. Making it with a voltage divider only can be disastrous.

Finally digital signals can be heard in audio if there's digital and audio signal wires in parallel with too small distance. That happens easily in breadboards and spaghetti wirings.

The previous hints cover only that noise which is caused by digital signals which leak to the audio. Digital (=stepped) volume control has another problem. If the noise can be heard only when the volume is adjusted and there's some sound in the audio, not for ex. a pause between the songs, the noise is the sudden voltage changes in the audio caused by the changes in the gain. It's not a leak from the digital circuits.

The fix is to have a circuit which prevents sharp voltage steps by timing the gain changes to the zero crossings of the audio signal. Your digital potentiometer has that capability. You must insert a zero crossing detector which enables the write latch (WLAT) when the audio is near enough zero. An easy version of it is a window detector made of 2 comparators.

It's essential to have the same zero point reference for the audio and the window detector. Your audio zero point is V3. Make the window tresholds with the same circuit which makes V3, use for ex 4 resistor chain as a voltage divider + capacitors to keep the voltages clean.

\$\endgroup\$
8
  • \$\begingroup\$ Thanks! So a question, I currently have this built up on a breadboard (I plan on printing pcbs in the future). Would it work to keep one ground rail for analog, one ground rail for digital, then tie them together at the output power supply capacitor? Also, I am currently using a voltage divider to feed the DC reference at the op amp (should be 4.5V, typo in schematic). The TL072 has an extra op amp I can use if it would be better for me to feed the voltage divider into a voltage follower. Thoughts? Or should I just find a 4.5V regulator? \$\endgroup\$ Jul 9, 2020 at 15:42
  • \$\begingroup\$ And to note, the 4.5V is made from the 9V supply. \$\endgroup\$ Jul 9, 2020 at 15:49
  • \$\begingroup\$ Your 9V probably has some noise due the current consumption of digital parts. an LC filter towards the analog circuit could be useful. At least have a capacitor which keeps the 4,5V DC offset of your audio amp clean. Separate GND rails for analog and digital is a must. There's no need to have actual whole breadboard long rails, only be sure the current of the digital circuit do not run through your analog GND wiring. Be sure digital signals stay far away from your analog signals. There's plenty of capacitance between the breadboard strips and digital pulses jump over those capacitances. \$\endgroup\$
    – user136077
    Jul 9, 2020 at 16:22
  • \$\begingroup\$ I'll try it out and see if that helps. I'll need to do some rearranging of the breadboard. \$\endgroup\$ Jul 9, 2020 at 16:44
  • \$\begingroup\$ There's still a hitch. If the resistance in the pot is adjusted without worrying the signal values you generate sharp steps to the audio signal. Advanced digitally controlled audio equipment change the analog gain at signal zero crossings or they use motorized continuous potentiometers. \$\endgroup\$
    – user136077
    Jul 9, 2020 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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