Multiple SPI & SPI noise on pick-up mic

Hi all

I made an assembly with a UNO, Wiz850io and a digital potentiometer MCP42xxx.
I am used to using the Wiz850io but the use of the digital potentiometer and SPI code is new to me.
The project is to send OSC messages using the UDP protocol, these messages controls the resistors levels of the digit Pot connect to a custom 'amplifier board'... which changes the level of a magnetic microphone (guitar pick-up) send to a mixer.
I manage a basic code… the pick-up level change (the sound on speakers moving up/down related to the OSC value)… but I can ear on the speakers a 'small audio click noise' when I change the level/Value of the pot, at each step of the pot. If I don’t change/send a value to the pot, sound is clear and I haven’t any noise, but while I change the pot level ‘click noise’ appear. So, it’s clearly coming from there !

  • the Input connector of the pick-up is close/side to the pot input connector. could it be residual/field noise going thru the wire? As pick-up mic are coil and sensitive to magnetic field. Move the input connector of the pick-up other side of the PCB could fix it !?

  • As I say, manage SPI is new to me and I could have make wrong things on the code that create mistake on the transfer...
    I also feel that the UNO going more warm than usual…
    I used the UNO to power both the MCP and the Wiz850io, maybe too much and need an external PSU?
    here the code I use :

#include <SPI.h>        
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <OSCMessage.h>
#include <OSCBoards.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 75); //ip of the arduino / ip to send On // change it on new card
unsigned int InPort = 8888;      // port to send on

EthernetUDP Udp; // An EthernetUDP instance to let us send and receive packets over UDP

const int Sel_Pot_0 = 0x11; // pot0 Address
const int Sel_Pot_1 = 0x12; // pot1 Address

const int Eth_CS_Pin = 10; // CS pin for Wiznet
const int DPot_CS_Pin = 9; // CS pin for Dpot

//================================================================ SETUP =================================
void setup() {
// set the Slave Select Pins as outputs:
  pinMode (Eth_CS_Pin, OUTPUT);
  pinMode (DPot_CS_Pin, OUTPUT);
  SPI.begin(); // initialize SPI:
 // start the Ethernet and UDP:

// ============================================================== OSC ====================================
void manageOSCMess_Pot0(OSCMessage &msg, int addrOffset ){
            DigitalPotWrite(Sel_Pot_0, msg.getInt(0));   //set the resistance of POT0

void manageOSCMess_Pot1(OSCMessage &msg, int addrOffset ){
            DigitalPotWrite(Sel_Pot_1, msg.getInt(0));   //set the resistance of POT1

// ============================================================== LOOP ====================================
void loop() {

OSCMessage messageIN;
   int size;
   if((size = Udp.parsePacket())>0){
       if(!messageIN.hasError()) { 
       messageIN.route("/Pot_0", manageOSCMess_Pot0);
       messageIN.route("/Pot_1", manageOSCMess_Pot1);

//if there's data to send to the Dgpot... otherwise SPI talk/listen with the Wiz... 
void DigitalPotWrite(int address, int val){
  digitalWrite(Eth_CS_Pin, HIGH); // close the Eth CS_Pin : stop communicate to the Wiz
  val = constrain(val, 0, 255); // constrain input value within 0 - 255
  digitalWrite(DPot_CS_Pin, LOW); // set the CS_DPot pin to low to select the DgPot...
  SPI.transfer(address); // send the command and value via SPI
  digitalWrite(DPot_CS_Pin, HIGH); // Set the CS pot pin high to close the command
  digitalWrite(Eth_CS_Pin, LOW); // Open back the Eth Cmd : restart communicate...

thanks for your feedback and advice !

That is due to the step output changing at any time during the sound’s waveform. This is normal with digital pots unless you take precautions to only change it when the sound waveform is at a zero crossing point.

So when you detect a change in your pot that will trigger a change in your digital pot you must wait until the next zero point crossing before you send the new value to the digital pot.

One way to do this is to amplify the sound with an op amp to turn it into a square wave and apply it to a digital pin. Then when you need to send your pot update, just wait until this pin changes level before updating your digital pot.

Some digital pot chips automatically defer changes to the next zero crossing - can't recall the part numbers though. This will make a huge difference.

Thanks for your reply !
Damn !!!
Could it be a way to 'smooth' the pot step, smooth the passing between resistance value ? Do a small capacitor could help ? that will add a 'delay' on the response but goal is more about the sound result than the faster...


No that would affect the audio signal and passing the signal through a resistor is not going to do anything for you. A series inductor might help but that would also screw up the phase of the signal.

Thing is that part is not designed for audio, there are chips that are, mainly in the automotive sound system field.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.