Intro
I have implemented lots of HID style peripherals in the past, but I have never made a capacitive touch keyboard HID before. The GIGA with its touch display means a touch keyboard can be implemented without any extra hardware, so that is what this demo is all about.
Giga HID Keyboard Image

HID Keyboard in Action
Firmware
/*
HID Keyboard using arduino Giga Touch Display
by Doug Wong
2025
*/
//#include "ArduinoGraphics.h"
#include "PluggableUSBHID.h"
#include "USBKeyboard.h"
#include "Arduino_GigaDisplayTouch.h"
#include "Arduino_GigaDisplay_GFX.h"
#include "incbin.h"
#define BLACK 0x0000
#define WHITE 0xFFFF
#define RED 0xF800
#define YELLOW 0xFFE0
#define PURPLE 0xFB00
#define BLUE 0x001F
USBKeyboard Keyboard;
GigaDisplay_GFX display;
Arduino_GigaDisplayTouch touchDetector;
int ROW;
int COL;
int KEY;
char qwerty [41] = "1234567890QWERTYUIOPASDFGHJKL\nZXCVBNM .\b"; //keyboard characters
void setup() {
display.begin();
display.fillScreen(WHITE);
display.setRotation(1);
display.setTextSize(5);
display.setTextColor(BLUE);
display.setCursor(170, 10);
display.print("GIGA HID KEYBOARD");
display.setTextColor(BLACK);
for (int i = 160; i <= 480; i+= 80) { //draw hoizontal lines
display.fillRect(0, i, 800, 2, BLUE);
}
for (int j = 0; j < 800; j+= 80) { //draw vertical lines and display the keyboard characters
display.fillRect(j, 160, 2, 320, BLUE);
KEY = j / 80;
display.setCursor(j+30, 180);
display.print(qwerty[KEY]);
KEY = j / 80 + 10;
display.setCursor(j+30, 260);
display.print(qwerty[KEY]);
KEY = j / 80 + 20;
display.setCursor(j+30, 340);
display.print(qwerty[KEY]);
KEY = j / 80 + 30;
display.setCursor(j+30, 420);
display.print(qwerty[KEY]);
}
display.setCursor(20, 60); // set up to display which key was touched
display.setTextColor(RED); // red text
touchDetector.begin();
}
void loop() {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points); //read the touch screen
if (contacts > 0) { // figure out the keaboard row that was touched
if (points[0].x < 320) {
if (points[0].x < 80) {
ROW = 3;
} else if (points[0].x < 160) {
ROW = 2;
} else if (points[0].x < 240) {
ROW = 1;
} else {
ROW = 0;
}
if (points[0].y < 80) COL = 0; // figure out the keaboard column that was touched
else if (points[0].y < 160) COL = 1;
else if (points[0].y < 240) COL = 2;
else if (points[0].y < 320) COL = 3;
else if (points[0].y < 400) COL = 4;
else if (points[0].y < 480) COL = 5;
else if (points[0].y < 560) COL = 6;
else if (points[0].y < 640) COL = 7;
else if (points[0].y < 720) COL = 8;
else COL = 9;
KEY = (ROW * 10 + COL); // calculate which key was touched
display.fillRect(0, 30, 100, 80, 0xFFFF);
display.setCursor(20, 60);
display.print(qwerty[KEY]);
char tempCharString[2];
tempCharString[0] = qwerty[KEY];
tempCharString[1] = '\0';
Keyboard.printf("%s", tempCharString);
}
for (int x = 0; x < 10; x++) { //debounce touch
contacts = touchDetector.getTouchPoints(points);
if (contacts > 0) {
x = 0;} //you may want to time out to avoid a potential endless loop
delay(10);
}
delay(100);
contacts = 0;
}
}
Discussion
As mcrocontrollers become more powerful, they increasingly can handle more complex data and peripherals. This HID keyboard capability provides a pretty general purpose user interface which would be unlikely on a simple mcrocontroller because it could be more complex to implement than the actual application. The GIGA and its touch display handle the whole task without even tweaking any hardware. Even the software is easy, with appropriate libraries already available. That isn't to say that I got it working quickly - I went down a few rabbit holes and had a few head scratching episodes, but that is mostly a result of my limited software skills.
This application makes use of the GIGA, its LCD, its touch screen and one of its USB ports.
I did find that I had to implement an enhanced "debouncing" algorithm to prevent extra key presses from being recognized, but in the end it is a pretty robust solution with good sensitivity and the touch area is large enough to make it easy to touch the correct key.
Links
Touch Screen and USB memory demo
GIGA display of an Arducam video camera