Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
Posts: 4
Joined: Fri Sep 28, 2018 9:34 pm


Post by luigibyte » Fri Jun 28, 2019 5:41 am

Hi guys.

I am looking for a micropython library to use an XPT2046 touch screen.

I am working on an ESP8266.

I have a tft module that has that touch controller and the pins that I have available are:

thanks in advance :)
IMG_4898.jpg (162.32 KiB) Viewed 291 times

User avatar
Posts: 3656
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: xpt2046

Post by pythoncoder » Fri Jun 28, 2019 7:35 am

See https://github.com/robert-hh/XPT2046-to ... or-PyBoard from @robert-hh. touch.py is written for the Pyboard and would require some adaptation for different targets.
Peter Hinch

User avatar
Posts: 1701
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: xpt2046

Post by Roberthh » Fri Jun 28, 2019 10:23 am

I made a driver once for PyBoard, and now took your question to adapt & test it on ESP8266. Since it uses SPI for communication, it should be possible to adapt it. You can ignore T_RQ and pull TCS low. Then you need only TCLK = CLK, TDIN = MOSI, and TDO = MISO.
Location: https://github.com/robert-hh/XPT2046-touch-pad-driver
The file for the ESP8266 are xpt2046_syn.py and xpttest as simple test script. It is still relatively large. If that is a problem, it can be tailored small. The minimum is __init__ (some of it), raw_touch() and touch_talk().
@pythoncoder: I'll re-do the asynchronous code. Just for the esp8266 I removed it to keep it as small as possible.

Post Reply