Ks0210 keyestudio RPI TTP229L 16-key Capacitive Touch Keypad

From Keyestudio Wiki
Jump to navigation Jump to search

keyestudio RPI TTP229L 16-key Capacitive Touch Keypad


thumb

Introduction

This keypad is designed for Raspberry Pi and supplies your Pi with 16 keys. It has an I2C communication mode and uses 3.3 V supply voltage with a power indicator. We provide you with installation package, source codes and a document to help you complete your programs.

Specification

  • Chip: TTP229-LSF
  • Supply Voltage: 3.3V
  • Interface: I2C
  • Size: 85x56x19.3 mm

Connection Diagram

Plug it directly into Raspberry Pi to start your works as shown in below figure. After power-on have about 0.5sec stable-time. During the time do not touch the key pad, and all functions are disabled.
thumb

Sample Code

 #include <bcm2835.h>  
    #include <stdio.h>
    #include <unistd.h>
    unsigned char WriteBuf;
    unsigned char WriteBuf1;  
    unsigned int ReadBuf0;  

    int main(int argc, char **argv)  
    {  
        if (!bcm2835_init())  
        return 1;  
        bcm2835_i2c_begin();  
        bcm2835_i2c_setSlaveAddress(0x57);  
        bcm2835_i2c_set_baudrate(10000);  
        printf("start..........\n"); 

        while(1)  
        {  
		WriteBuf = 0x00;  
		bcm2835_i2c_write_read_rs(&WriteBuf,2,&WriteBuf1,2);  
		bcm2835_i2c_read (&ReadBuf0,2);        
		printf("TTP229:%d\n",ReadBuf0);
		printf ("\r");
		fflush (stdout);
		bcm2835_delay(100);  
        }  
         
        bcm2835_i2c_end();  
        bcm2835_close();  
      
        return 0;  
} 


Program Writing

1.Installing bcm-2835 Library

Here is the tutorial for installing bcm-2835 library in Raspberry Pi. To install bcm-2835, first we need to download bcm2835 library. So we will provide an installation package or click its official web http://www.airspayce.com/mikem/bcm2835/ to download it.
Step1:- Now after downloading library, copy it in any folder of your raspberry pi by winSCP(we provide its installation package, but please refer to usage by yourselves).
Step2:- Now it’s time to extract the library, so open terminal of raspberry pi and go to the folder where you have copied your library and type this command: tar zxvf bcm2835-1.26.tar.gz
Step3:- Now to into library folder, type this command: cd bcm2835-1.26
Step4:- Now, we are ready to install bcm2835 library, so to start installation type this command: ./configure
Step5:- then type this command: make
Step6:- then this: sudo make check
Step7:- and finally this: sudo make install
Congrats your library is installed. Now use “#include <bcm2835.h>” in your program to use bcm2835 library.

2.Programming

Now its time to write a program. If you need to create a new directory within raspberry pi, you can use the ‘mkdir’ command. So type at your terminal: mkdir rpi_shield then copy the file rpi_TTP229L provided by us and put it into the directory rpi_shield through winSCP. Next , type this command: cd rpi_TTP229L to go inside the rpi_TTP229L folder. Then type this command: make to make an executable file, This means this is the file we run to launch the program as shown in below figure.
thumb
Finally type this: sudo ./TTP229 to launch the program.

Result

Touch the keys, and corresponding value is printed on the terminal as shown in below figure. Use Ctrl+C to exit the processing program.
thumb
sudo ./TTP229 to running program
thumb
Touching different keys to print various value

Documents

PDF File:

https://drive.google.com/open?id=1GpCS5u584dze9oL2H59eQN4ECBozHBMK

Libraries:

https://drive.google.com/open?id=1YiotA1_YywxBC6e-vhe5NqDApinmMwxX

Code:

https://drive.google.com/open?id=16er-T8rqGNWJlm12jUkCXNjcSPyysc5e

Installation Tool:

https://drive.google.com/open?id=1Gb_QSIF88zyKsN_UNwtbo0URfmBoP-F-

Get One Now

http://www.keyestudio.com/keyestudio-rpi-ttp229l-16-key-capacitive-touch-keypad.html