Midi Control Surface - ANALOG_FILTER_SHIFT_FACTOR

Hi there,
I'm working on a control surface and I'm having problems with PitchBend Potentiometer: the first half of the rotation seems ok whilst the second half is very noisy.
I tried changing the ANALOG_FILTER_SHIFT_FACTOR in the AH/SETTING/Settings.hpp but it barely affects the behaviour. Am I missing something? Could you please help?
Thanks a lot

That can be a pain. Can you post your annotated schematic that shows exactly how it is wired. Links to the hardware would also be helpful.

Hi @gilshultz and thanks for your reply.

Here's the sketch:


#include <Control_Surface.h>
#include <Encoder.h>

#define ADC_RESOLUTION = 10;
const int ANALOG_PIN = A0;
const int ANALOG_PIN1 = A1;

FilteredAnalog<> analog[2] = {A0, A1};

USBMIDI_Interface midi;

using namespace MIDI_Notes;


NoteButton button1 = {2,{note(D, 0), CHANNEL_1},};

CCRotaryEncoder enc1 = {{4, 3}, MCU::V_POT_1, 1,};
 
PBPotentiometer vol1 {A0,CHANNEL_1,};

NoteButton button2 = {5, {note(Eb, 0), CHANNEL_1},};

CCRotaryEncoder enc2 = {{7, 6}, MCU::V_POT_2, 1,};
 
PBPotentiometer vol2 {A1, CHANNEL_2,};

void setup() {

  FilteredAnalog<>::getMaxRawValue();
  RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
  Control_Surface.begin();
}
void loop() {


  Control_Surface.loop();
   for (int i=0; i<2; i++)
  {
    analog[i].update();
    Serial.print(analog[i].getRawValue() / 16.f);
    Serial.print("\t");
    Serial.print(analog[1].getValue());
    Serial.println();
  
    analog[i].update();
    Serial.print(analog[i].getRawValue() / 16.f);
    Serial.print("\t");
    Serial.print(analog[2].getValue());
    Serial.println();
  }

}

Let me know your thoughts
Thanks!

Hi again,
I just noticed that the filter works well if I use a Pro Micro board from a different maker, meaning that the sketch is correct.
I also noticed that the defective board works fine if I use "Upload Using Programmer" on IDE, but just during the loading process. It seems that it works well if there is a input coming from the USB socket. As soon as I quit IDE, the board starts to malfunction again.
I'm puzzled but at least I know that I can make it work with a different board.
Thanks

That sounds like a loose connection or a flakey ground. You did confirm what I wanted from the schematic is the pot was connected correctly as it works. Be sure all grounds are connected. If you are using any buck/boost converters be sure they pass the ground through and control the high side. There were a few that controlled the ground and connecting grounds would fry hardware. Good Luck

Hi @gilshultz,
that's a good hint! I'll check the if the grounds are connected.

cheers