element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Review Blogs Arduino GIGA Touch Display HID Keyboard
  • Blogs
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RoadTests & Reviews to participate - click to join for free!
  • Share
  • More
  • Cancel
  • Author Author: dougw
  • Date Created: 17 Nov 2025 2:39 AM Date Created
  • Views 55 views
  • Likes 7 likes
  • Comments 1 comment
Related
Recommended
  • dougw
  • GIGA HID Touch Keyboard

Arduino GIGA Touch Display HID Keyboard

dougw
dougw
17 Nov 2025

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

image

HID Keyboard in Action

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

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

Unboxing and display demo

Touch Screen and USB memory demo

GIGA display of an Arducam video camera

GIGA VU Meter and Spectrum Analyzer

GIGA WAV Player

GIGA HID Touch Keyboard

Giga R1 Road Test page

  • Sign in to reply
  • DAB
    DAB 1 day ago

    Nice update Douglas.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube