Skip to content

Technik Blog

Programmieren | Arduino | ESP32 | MicroPython | Python | Raspberry Pi | Raspberry Pi Pico

Menu
  • About me
  • Contact
  • Deutsch
  • English
Menu

KS0260 type touch keypad at Arduino

Posted on 13. January 202310. March 2024 by Stefan Draeger

In this post, I would like to show you how to program the KS0260 from Keyestudio type touch keypad with 16 buttons on the Arduino.

KS0260 type touch keypad at Arduino
KS0260 type touch keypad at Arduino

The touch keypad comes pre-assembled in a small box, so all you really need is 4 breadboard cables and a microcontroller.

packing KS0260
packing KS0260
packing KS0260 (backsite with QR-Code)
packing KS0260 (backsite with QR-Code)

  • Obtaining the touch keypad
  • Assembly
  • Connection to the microcontroller
  • Connection & Programming
  • Programming
    • Using the library
  • Example

Obtaining the touch keypad

The model I have was purchased on ebay.de for about €4.7 plus shipping costs*.

Note from me: The links marked with an asterisk (*) are affiliate links. If you make a purchase through these links, I will receive a small commission to help support this blog. The price for you remains unchanged. Thank you for your support!

Assembly

The KS0260 touch keypad is connected via I2C, which results in 4 pins that need to be connected to the microcontroller.

Frontside- KS0260
Frontside- KS0260
Backside- KS0260
Backside- KS0260

Connection to the microcontroller

Pins from Touch Keypad KS0260 from Keyestudio
Pins from Touch Keypad KS0260 from Keyestudio

As seen in the above image, the module has an I2C interface, which results in the following connection plan:

KS0260Arduino Microcontroller
3V33.3V
SDAanalog pin A4
SCLanalog pin A5
GNDGND

For this post, I am using the Funduino UNO, which is very similar to the Arduino UNO.

Microcontroller Funduino UNO with Touch Keypad KS0260 from Keyestudio
Microcontroller Funduino UNO with Touch Keypad KS0260 from Keyestudio

Connection & Programming

In the following YouTube video, I will show you how to connect the Keyestudio KS0260 touch keypad to the Funduino UNO and program it.

Keyestudio Touch Keypad KS0260 am Arduino UNO programmieren
Watch this video on YouTube.

Programming

In order to program the KS0260 type touch keypad, we need a library, which can be downloaded from the Ks0260 keyestudio TTP229L 16-key Touch Sensor Wiki page as a RAR file, including an example.

However, since the example provided by the manufacturer generates unnecessary output on the serial interface and the buttons are not described there, I took the time to expand the library.

You can download this library from the link below and install it as a ZIP library in the Arduino IDE (which is not possible with the RAR file).

Touch Keypad KS0260Herunterladen

Using the library

As mentioned earlier, the ZIP file can be imported as a library into the Arduino IDE, and it also contains a small example.

The 16 buttons now have a name and can be accessed through it. To get these names, we just need to initialize the KS0260Button class and then access the constants.

Constants for the keys on the KS0260 module from Keyestudio
Constants for the keys on the KS0260 module from Keyestudio

Now, it is quite easy to check with an if-statement whether the pressed button corresponds to one of the buttons.

data = TTP229_i2c_read();
if (data != 2 && data != 0) {
   String button = "-undefine-";
   switch (data) {
      case btns.button_power:
         button = "Power";
         break;
     }
}

In the code snippet, I have left out the values 2 & 0, as they are alternately output, even if no button is pressed.

Example

Here is the example that I have attached to the ZIP file.

#include "TTP229L_I2C.h"

unsigned int data;

#define debugKs0260 false

KS0260Buttons btns = KS0260Buttons();
btns.button_

void setup() {
  Serial.begin(9600);
}

void loop() {
  data = TTP229_i2c_read();
  if (data != 2 && data != 0) {
    String button = "-undefine-";
    switch (data) {
      case btns.button_power:
        button = "Power";
        break;
      case btns.button_raspberry:
        button = "Raspberry";
        break;
      case btns.button_up:
        button = "Up";
        break;
      case btns.button_down:
        button = "Down";
        break;
      case btns.button_left:
        button = "Left";
        break;
      case btns.button_right:
        button = "Right";
        break;
      case btns.button_home:
        button = "Home";
        break;
      case btns.button_triangle:
        button = "Triangle";
        break;
      case btns.button_quare:
        button = "Quare";
        break;
      case btns.button_circle:
        button = "Circle";
        break;
      case btns.button_cross:
        button = "Cross";
        break;
      case btns.button_l:
        button = "L";
        break;
      case btns.button_minus:
        button = "Minus (-)";
        break;
      case btns.button_plus:
        button = "Plus (+)";
        break;
      case btns.button_r:
        button = "R";
        break;
      default:
        Serial.println("Unknown Code[" + String(data, DEC) + "] found!");
    }
    Serial.println(button);
  }
}

If you upload this code to the microcontroller and press buttons on the touch keypad, the respective text will be output on the serial interface.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Fragen oder Feedback?

Du hast eine Idee, brauchst Hilfe oder möchtest Feedback loswerden?
Support-Ticket erstellen

Newsletter abonnieren

Bleib auf dem Laufenden: Erhalte regelmäßig Updates zu neuen Projekten, Tutorials und Tipps rund um Arduino, ESP32 und mehr – direkt in dein Postfach.

Jetzt Newsletter abonnieren

Unterstütze meinen Blog

Wenn dir meine Inhalte gefallen, freue ich mich über deine Unterstützung auf Tipeee.
So hilfst du mit, den Blog am Leben zu halten und neue Beiträge zu ermöglichen.

draeger-it.blog auf Tipeee unterstützen

Vielen Dank für deinen Support!
– Stefan Draeger

Categories

Links

Blogverzeichnis Bloggerei.de TopBlogs.de das Original - Blogverzeichnis | Blog Top Liste Blogverzeichnis trusted-blogs.com

Stefan Draeger
Königsberger Str. 13
38364 Schöningen

Tel.: 01778501273
E-Mail: info@draeger-it.blog

Folge mir auf

  • Impressum
  • Datenschutzerklärung
  • Disclaimer
  • Cookie-Richtlinie (EU)
©2025 Technik Blog | Built using WordPress and Responsive Blogily theme by Superb
Cookie-Zustimmung verwalten
Wir verwenden Cookies, um unsere Website und unseren Service zu optimieren.
Funktional Always active
Die technische Speicherung oder der Zugang ist unbedingt erforderlich für den rechtmäßigen Zweck, die Nutzung eines bestimmten Dienstes zu ermöglichen, der vom Teilnehmer oder Nutzer ausdrücklich gewünscht wird, oder für den alleinigen Zweck, die Übertragung einer Nachricht über ein elektronisches Kommunikationsnetz durchzuführen.
Vorlieben
Die technische Speicherung oder der Zugriff ist für den rechtmäßigen Zweck der Speicherung von Präferenzen erforderlich, die nicht vom Abonnenten oder Benutzer angefordert wurden.
Statistiken
Die technische Speicherung oder der Zugriff, der ausschließlich zu statistischen Zwecken erfolgt. Die technische Speicherung oder der Zugriff, der ausschließlich zu anonymen statistischen Zwecken verwendet wird. Ohne eine Vorladung, die freiwillige Zustimmung deines Internetdienstanbieters oder zusätzliche Aufzeichnungen von Dritten können die zu diesem Zweck gespeicherten oder abgerufenen Informationen allein in der Regel nicht dazu verwendet werden, dich zu identifizieren.
Marketing
Die technische Speicherung oder der Zugriff ist erforderlich, um Nutzerprofile zu erstellen, um Werbung zu versenden oder um den Nutzer auf einer Website oder über mehrere Websites hinweg zu ähnlichen Marketingzwecken zu verfolgen.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Einstellungen anzeigen
{title} {title} {title}