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.
simulate this circuit – Schematic created using CircuitLab