multiple SPI & SPI noise on pick-up mic

Status
Not open for further replies.
Hi all

I made an assembly with a teensy LC, 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 have a 'small click noise' when I change the level/Value of the pot, at each step of the pot. If I don’t send any value to the pot, sound is clear and I haven’t any noise, but while I change the pot value ‘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 could have make wrong things on the code that create mistake on the transfer...
I also feel that the LC going more warm than usual… the board is not burning !
I also used the Teensy to power both the MCP and the Wiz850io, maybe too much and need an external PSU?
here the code I use :
Code:
// Teensy LC + Wiz850io + MCP42xxx
#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() {
  //Serial.begin(9600);
      
// 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:
  Ethernet.begin(mac,ip);
  Udp.begin(InPort); 
}

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

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

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

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

//if there is 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
  SPI.transfer(val);
  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...
}

- does that ‘clicking noise’ are ‘normal’ and I need to make a filtering !? if yes, how !? ferrite bead !?

thanks for your feedback and advice !
best
0-0
 
Status
Not open for further replies.
Back
Top