Qprox Capacitive Touch Sensors

For those applications where you want to sense a person touching an object, but can’t use a switch or a force-sensitive resistor, charge-transfer touch sensors can often be very useful. The one used in this example is made by Quantum, and it’s very simple to use.

These sensors take advantage of the fact that objects and people always carry an electric charge, and that every object or person has a slightly different charge. When two objects or people touch, they exchange electric charge, so that they end up with an equal charge. Charge-transfer sensors detect that charge as we touch an object to which they’re attached. A conductor is attached to the object or embedded in it, and when a person comes close to the sensor, charge is transferred, and the sensor reads it.
These sensors work best as touch sensors, with the conductor embedded just below the surface of the object — for example, with the sensor underneath a cloth covering, cardboard covering, etc. The closer you can put the conductor to the chip that reads it, the better.
The QT11x family of sensors are all similar in that they require little external circuitry, and put out a digital signal when they detect the presence of a person or object. For this example, I used a QT113, but you can use the QT113H with the same circuit.
Note: Digikey carries these sensors in the US, so there is no need to order directly from England.
The wiring for the QT sensors is as follows:

QT113 schematic

The connecting wire between the sensor and the pin is sensitive to touch as well. To prevent the wire from triggering a reading, a wire with a shield. Coaxial cable or any shielded speaker or video cable will do. Ground the shield to your circuit ground.

The sensor can be attached to pin 6 or 7 of the QT113, it makes no difference.

The option pins (pins 3 and 4) allow you to set the sensor to behave differently, depending on whether they are tied to power or ground. In the configuration above, the QT113H will output high when it detects an object, indefinitely. The QT113 will do the opposite, going low when there’s contact, and high when there’s no contact. For details on other modes of operation, see the data sheet.

The gain pin (pin 5) controls the sensitivity of the sensor. Attach it to power (as above) for high sensitivity, to ground for low sensitivity.

I have had greatest success using a copper mesh screen as a sensor, but many other metal forms could be used. See the data sheet for notes on electrode geometry for more tips on this.
Because the QT sensors put out a digital signal, reading them is just a matter of reading an input pin. On the BX-24, the code would look like this (sensor attached to pin 12):

Sub Main()
   dim qproxVar as byte

   call delay(0.5)
   do
      qproxVar = NOT getPin(12)
      ' use the line below instead of the line above if you're using a QT113H:
      ' qproxVar = getPin(12)
      debug.print "Qprox = "; cstr(qproxVar)
   loop
end sub

On a PIC using PICBasic Pro, the following will work (sensor attached to portb, pin 0):

input portb.0
qproxVar var byte

Main:
  qproxVar = NOT portb.0
  ' use the line below instead of the line above if you're using a QT113H:
  ' qproxVar = portb.0
  serout2 portc.6, 16468, ["qprox = ", DEC qproxVar, 10, 13]
goto main

Here’s an example in the Wiring syntax, tested on an Arduino board:

int QTouchPin = 9;    // connected to the output of the QT113
int LEDPin = 8; 

//Function prototype:
void blink(int howManyTimes);

void setup() {
  pinMode(QTouchPin, INPUT);
  pinMode (LEDPin, OUTPUT);
  blink(3);
}

void loop() {
  // read the Qtouch pin, and set the LED pin to the opposite value:
  digitalWrite(LEDPin, !digitalRead(QTouchPin));
  // for a QT113H, use the following line instead:
  //digitalWrite(LEDPin, digitalRead(QTouchPin));  

} 

// Blink the reset LED:
void blink(int howManyTimes) {
  int i;
  for (i=0; i< howManyTimes; i++) {
    digitalWrite(13, HIGH);
    delay(200);
    digitalWrite(13, LOW);
    delay(200);
  }
}
This entry was posted in arduino/wiring, BX-24, PicBasic Pro. Bookmark the permalink.

Comments are closed.