Skip to content

Georodin/xpt2046-touchcontroller-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

xpt2046-touchcontroller-py

A simple touch controller compatible with the fbcp-ili9341 display driver, designed for Raspberry Pi and tested with the 4.0inch SPI Module ST7796 and Raspberry Pi Zero W. This controller utilizes the auxiliary SPI wiring of the Raspberry Pi. You will need a touch screen with a xpt2046 chipset.

How to Use

  1. To also enable the auxiliary SPI device (three slave selects) add the line dtoverlay=spi1-3cs to /boot/config.txt.
  2. Ensure fbcp-ili9341 is set up and running with a compatible display.
  3. Modify the screen size in calibrate.py (line 14) to match your display: surfaceSize = (480, 320).
  4. Modify the screen size in demo.py (line 18) to match your display: surfaceSize = (480, 320).
  5. Run the calibration script: python3 calibrate.py
    • Press each circle for two seconds to register the location.
  6. Enjoy by running the demo script: python3 demo.py

Wiring

Connect the Raspberry Pi to the XPT2046 as follows:

Raspberry Pi XPT2046
SCLK_1 (GPIO21) CLK
CE_1 (GPIO17) CS
MOSI_1 (GPIO20) DIN
MISO_1 (GPIO19) DO
GPIO26 IRQ

Missing Features

  • A deadzone feature to exclude ghost touch at the border of the touchscreen.
  • Clean code improvements are welcome.

Contributions to improve the project are highly appreciated. Please feel free to contribute and improve.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages