Touch Sensors interference

The project is already installed and working in Escape Room for 2 month.
But there is a problem with the touch sensors interference that happen in 1 of 8 games.
One of the touch sensors (left on the pic) begins to flicker because of some interference that disturbs the input signal to Arduino UNO and the porp become non functional. The only way to fix is to cut off the power supply (sometimes didn’t work ether).

I’m using 2 SparkFun Capacitive Touch Breakout - AT42QT1010. and 1 sensor CJMCU-0101.

A wire from the sensors touch pad goes to an external object made of metal. between them there is a 100K and 50K resistor, per sensor.
The input form the touch sensors are handled like a regular button.
RAW CODE that i used and modified to my porpuse. credit to laxap.

#define BUTTON1_PIN               2  // Button 1
#define BUTTON2_PIN               3  // Button 2

#define DEFAULT_LONGPRESS_LEN    25  // Min nr of loops for a long press
#define DELAY                    20  // Delay per loop in ms



// Class definition

class ButtonHandler {
    // Constructor
    ButtonHandler(int pin, int longpress_len=DEFAULT_LONGPRESS_LEN);

    // Initialization done after construction, to permit static instances
    void init();

    // Handler, to be called in the loop()
    int handle();

    boolean was_pressed;     // previous state
    int pressed_counter;     // press running duration
    const int pin;           // pin to which button is connected
    const int longpress_len; // longpress duration

ButtonHandler::ButtonHandler(int p, int lp)
: pin(p), longpress_len(lp)

void ButtonHandler::init()
  pinMode(pin, INPUT);
  digitalWrite(pin, HIGH); // pull-up
  was_pressed = false;
  pressed_counter = 0;

int ButtonHandler::handle()
  int event;
  int now_pressed = !digitalRead(pin);

  if (!now_pressed && was_pressed) {
    // handle release event
    if (pressed_counter < longpress_len)
      event = EV_SHORTPRESS;
      event = EV_LONGPRESS;
    event = EV_NONE;

  // update press running duration
  if (now_pressed)
    pressed_counter = 0;

  // remember state, and we're done
  was_pressed = now_pressed;
  return event;


// Instantiate button objects
ButtonHandler button1(BUTTON1_PIN);
ButtonHandler button2(BUTTON2_PIN, DEFAULT_LONGPRESS_LEN*2);

void setup()

  // init buttons pins; I suppose it's best to do here

void print_event(const char* button_name, int event)
  if (event)

void loop()
  // handle button
  int event1 = button1.handle();
  int event2 = button2.handle();

  // do other things
  print_event("1", event1);
  print_event("2", event2);

  // add newline sometimes
  static int counter = 0;
  if ((++counter & 0x1f) == 0)


I’m in need of suggestions and tips how to make the prop more resistant to external interference and how fix the issue. Thanks.

Seems like its time to break out the multimeter. Did you try measuring the circuitry? If only the far left button has issues their may be a faulty wire or loose connection. Also you could play around with the size of the capacitive sensor.