Arduino Micro + Capacitive touch sensors

Hi,

I am working on a project where I have:

9 Touch sensors boards ( capacitive touch, similar to The Adafruit At42qt1012), each with an extension wire soldered to a copper foil. 1 Arduino Micro I am using as HID USB keyboard 1 Brightsign Media player.

The sensors (foil) are under about 6mm of plexiglass (2x 3mm with a printed sheet of paper sandwiched in between). The sensor act as a menu selection for 9 different Videos.

The Idea is that when someone touches a region of the plexiglass, a sensor is activated, which generate a keyboard input ( a letter) which in turn goes to my media player and plays the corresponding video.

My code is posted bellow.

My problem:

I either have too much sensitivity ( "letters" are generated by themselves without touch) or not enough sensitivity ( no reaction when the touch region are activated)

I tried with a 10KOhm and 1MOhm resistor between signal and ground... does not solve my problem.

does anyone have an idea what I am doing wrong?

thanks in advance

    #include "Keyboard.h"
    
    void setup() {
      Serial.begin(9600);
  pinMode(10, INPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
    }



void loop() {
  if (digitalRead(10) == HIGH)
  {
    writeOne();
  }
if (digitalRead(2) == HIGH)
  {
    writeTwo();
  }
  if (digitalRead(3) == HIGH)
  {
    writeThree();
  }
  if (digitalRead(4) == HIGH)
  {
    writeFour();
  }
  if (digitalRead(5) == HIGH)
  {
    writeFive();
  }
  if (digitalRead(6) == HIGH)
  {
    writeSix();
  }
  if (digitalRead(7) == HIGH)
  {
    writeSeven();
  }
  if (digitalRead(8) == HIGH)
  {
    writeEight();
  }
  if (digitalRead(9) == HIGH)
  {
    writeNine();
  }
}

void writeOne() {
    Keyboard.begin();
    Keyboard.print('a');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeTwo() {
    Keyboard.begin();
    Keyboard.print('b');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeThree() {
    Keyboard.begin();
    Keyboard.print('c');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeFour() {
    Keyboard.begin();
    Keyboard.print('d');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeFive() {
    Keyboard.begin();
    Keyboard.print('e');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeSix() {
    Keyboard.begin();
    Keyboard.print('f');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeSeven() {
    Keyboard.begin();
    Keyboard.print('g');
    delay(1000);
    Keyboard.end();
      delay(250);  
}void writeEight() {
    Keyboard.begin();
    Keyboard.print('h');
    delay(1000);
    Keyboard.end();
      delay(250);  
}
void writeNine() {
    Keyboard.begin();
    Keyboard.print('i');
    delay(1000);
    Keyboard.end();
      delay(250);  
}

beninflux: The sensors (foil) are under about 6mm of plexiglass (2x 3mm with a printed sheet of paper sandwiched in between).

[...]

does anyone have an idea what I am doing wrong?

Probably that. Too thick plexiglass, too small sensors. Get much thinner plexiglass. I've had success with 3 mm thickness, but only barely, using TTP221 based sensors. Those sensors are about 10x10 mm each.

Thanks for your answer

Thing is it work ok with one or two sensors.. with 9 is when it acts up.

3mm plexi is not an option. I need to sandwich a printed sheet of paper in between.

In the image the small box in the front is my “sensors”. Touching one of the images activates the video in the background. ( and a light within the vitrine, but there it works just fine).

I thought the whole thing with capacitive sensors is that they can work at a distance ( and have used a dedicated electronic tool, “the human detector”, to safeguard paintings or sculptures in a museum context.

here the image I could previously uploading

If two sensors work but 9 not: that's obviously a case of interference.

Space them further apart, make sure the wires leading to the foil aren't interfering with one another either. Maybe you should use shielded wires (the shield connected to GND on one end).

Keep the actual sensor boards (which are sensitive by themselves) properly spaced and oriented, so that they do not affect each other either. Orientation matters when you're talking about capacitive sensors!

Be aware that you're using them as proximity sensors, rather than as touch sensors. You don't actually touch the sensor's surface, let alone create an electrical connection with the touch plate.

Why even using that extension cord & foil, instead of attaching the original sensor right where you want it? Saves a lot of hassle.

Alternative solution: a grid of break beam sensors in front of the images. That way you can also tell there's a finger touching the spot. Multi-touch gets a lot harder, though.

I have built these capacitive touch sensor in museum environment. http://www.heddier.com/electronic/Player-components/Sensors-optionals/Capacitive-touch-sensor-Mirrormaid::332.html?MODsid=c45e88b6bfe6c0d70be8f8aa3b1033c6 There were 29 sensors. Also with foil and through 8 mm plexi. However at 36€ a piece + breakout board, they were too expensive for my application here.

I made an holder for each sensor so that they are held upright on the plexi and the wire is as small as possible, without touching anything else. The sensors are approximatively 5-6cm apart. The foil itself is about 2cmx2cm.

Even a few cm apart those wires may affect one another seriously. It all depends on your physical layout. Again, why don't you just place the original sensors against the glass instead of using the external foil piece? That would do away with all the cable interference for starters. This assuming the sensors can read through 6 mm of plexiglass.

Some more detailed photos of your actual setup may be very enlightening.

You could try using an MPR121 board instead of nine touch sensor boards: https://www.adafruit.com/product/1982. Datasheet: https://cdn-shop.adafruit.com/datasheets/MPR121.pdf. It's a sophisticated chip with "autocalibration" and "autoconfiguration". The "13th simulated electrode" is supposed to give you "greater near proximity detection distance and an increased sensing detecting area", so that may help.

You could also try putting earthed foil between the electrodes.

Using the MPR121, I have stuck paper onto brass sheets (choosing brass so I can solder wire or brass screws to it). You could then put protective 3mm acrylic sheet ("Plexiglass" or "Perspex") on top giving only 3.1mm between fingers and electrodes.

I am happy to report that Archibald's suggestion worked wonders. Thank you! I like the ability to add another 3 boards, as I will be doing so very shortly.