Home Hardware Arduino TouchKeyUSB shield example

Arduino TouchKeyUSB shield example

by shedboy71

The latest shield that has come into my posession is called the TouchKeyUSB shield, it looks a bit like this


Here is a description of its usage

Simulating a keyboard by microcontroller, leads a few keys, and using the touch form instead of switches. Now we can also use an Arduino board and a touch key USB shield to achieve this effect.

The input method of touch key USB shield is touch, using dual contacts touch switch, to lead the touch terminal and the ground terminal connected to the two electrodes touch. When human touch the two pole, because of the body resistance, a touch electrode between the two current flows, by detecting this current size of the touch event can be detected.

Basically you need to attach a crocodile clip or similar to the GND, you then connect  crocodile clips or similar to the terminals marked from A0 to A5. You then attach the other end of the AO to A5 crocodile clips to a coin. When you have uploaded the test sketch below and touch the GND and the coin an LED on the shield lights. At its most basic you are basically putting a high resistance (you) between one of the analog pins and GND.



This is the code example I tested with – download link for the library and examples

As you can see the USB keyboard usage is commented out, you are supposed to be able to send keystrokes to a PC with this

[codesyntax lang=”cpp”]

// #include "UsbKeyboard.h"
int InData1 = 0, InData2 = 0, InData3 = 0, InData4 = 0, InData5 = 0, InData0 = 0;
int TouchSensitivity = 30;
void setup()
  for(int i = A0; i <= A5; i++)
      pinMode(i, INPUT);
  for(int i = 6; i <= 12; i++)
      pinMode(i, OUTPUT); 
  TIMSK0 &= !(1 << TOIE0);
void loop()
//  UsbKeyboard.update();
  InData0 = 1024 - analogRead(A0);                
  InData1 = 1024 - analogRead(A1);
  InData2 = 1024 - analogRead(A2);
  InData3 = 1024 - analogRead(A3);
  InData4 = 1024 - analogRead(A4);
  InData5 = 1024 - analogRead(A5);

  if(InData0 >= TouchSensitivity)
    digitalWrite(6, HIGH);             
//    UsbKeyboard.sendKeyStroke(79); //right
   else digitalWrite(6, LOW);
  if(InData1 >= TouchSensitivity)
    digitalWrite(7, HIGH); 
//    UsbKeyboard.sendKeyStroke(80);  //left
     else digitalWrite(7, LOW);
  if(InData2 >= TouchSensitivity)
    digitalWrite(8, HIGH); 
//    UsbKeyboard.sendKeyStroke(81);  //down
     else digitalWrite(8, LOW);
  if(InData3 >= TouchSensitivity)
    digitalWrite(9, HIGH); 
//    UsbKeyboard.sendKeyStroke(82);  //up
     else digitalWrite(9, LOW);
  if(InData4 >= TouchSensitivity)
    digitalWrite(10, HIGH); 
//    UsbKeyboard.sendKeyStroke(KEY_SPACE);
      else digitalWrite(10, LOW);
  if(InData5 >= TouchSensitivity)
    digitalWrite(11, HIGH); 
//    UsbKeyboard.sendKeyStroke(KEY_ENTER);
      else digitalWrite(11, LOW);




New Makey Makey touch key USB shield analog touch keyboard for arduino


You may also like

Leave a Comment