Printed Circuit board for ESP32 with Touchscreen
This is the next logical step after the “older and solder” touchscreens I have been using for years. ESP32 is a logical upgrade: more power, more GPIO and much simpler HTTPS capabilities. Furthermore several libraries have better versions.
PCB production
Everyone likes soldering, but a few of these onto veroboard is tough.
I decided to draw up a PCB using Fritzing (because I had it) and the last time I made a PCB, it was hand drawn and acid etched in the laundry in 1979. This worked out very well. I simply went to the PCBWay website, filled out a form, uploaded the Gerber files, paid $5 for 10 boards and then a MUCH larger sum for postage!
PCBWay have a kind of real-time monitor where you can “check” on the processes that your boards are going through. This is very entertaining and goes for 24hours.
– Then they post the PCBs to you.
– Then FOUR days later the boards arrive.. in Australia, and they are of a brilliant quality. Uploaded Sunday, and the boards arrived Friday morning. This is a very impressive service!

![]() | ![]() |
Electrical
The prototype uses an ESP32 Lolin Lite. This doesn’t have _all_ the GPIO pins but still plenty, but the real advantage is the onboard battery management. It includes a PH2.0 socket so that a typical LiPo 3.7 battery can be used and also charged through the micro USB port.
NB The polarity of this socket is not standard on the ones I have seen. Be careful.
With only 4Mb of memory, it’s still useful and a big sketch can be uploaded with room for OTA updating.

I wire the boards to an ILI9341 2.4″ touch screen as follows.
| ESP32 Lolin Lite GPIO | ILI9341 -Screen | ILI9341 -Touch | ILI9341 -SDCard |
| 3.3v | Vcc | ||
| Gnd | Gnd | ||
| 27 | CS | ||
| 26 | Reset | ||
| 14 | DC | ||
| 23 | MOSI | T_DIN | SD_MOSI |
| 18 | SCK | SD_SCK | |
| 13 | LED * | ||
| 19 | MISO | T_DO | SD_MISO |
| 18 | SCK | T_CLK | |
| 15 | T_CS | ||
| 5 | SD_CS |
*LED usually connected to Vcc. (I use 13)
User_Setup.h in the TFT_eSPI library can use the standard ILI9341.
You may need to add TOUCH_CS 15
// TFT_eSPI User_Setup for ESP32 Lolin lite and ILI9341 remotes #define ILI9341_DRIVER / #define TFT_CS 27 #define TFT_DC 14 #define TFT_RST 26 #define TOUCH_CS 15 #define LOAD_GLCD #define LOAD_FONT2 #define LOAD_FONT4 #define LOAD_FONT6 #define LOAD_FONT7 #define LOAD_FONT8 / //#define LOAD_FONT8N #define LOAD_GFXFF #define SMOOTH_FONT #define SPI_FREQUENCY 27000000 #define SPI_READ_FREQUENCY 20000000 #define SPI_TOUCH_FREQUENCY 2500000
Note that the ILI9341 LED is connected to GPIO 13 in my example. This is so that the screen can be turned off and on in software.
pinMode(13 , OUTPUT); // The pin needs to set to Output digitalWrite(13, HIGH); // HIGH - LED/Screen is on
Once again I am using Bodmer’s TFT_eSPI libraries and the TJPGDec.h to display detailed graphics. Not much has changed apart from from obvious inclusions.
#include "SPI.h" #include "TFT_eSPI.h" TFT_eSPI tft = TFT_eSPI(); #include <TJpg_Decoder.h> #include "LittleFS.h" // LittleFS is declared #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager #include <ESPmDNS.h> #include <ESPAsyncWebServer.h> #include <HTTPClient.h> #include <ESP32httpUpdate.h> #include <PubSubClient.h> #include <Preferences.h> #include <ArduinoJson.h> #include "Free_Fonts.h" #include <elapsedMillis.h> #include <AsyncElegantOTA.h> #include "SdFat.h"
Note some useful additions:
| LittleFS | Save and load files to the LittleFS (formerly SPIFFS) memory. |
| ESPAsynchWebServer | A much more effective webserver for managing files, serving data etc. |
| SDFat.h | |
| HTTPClient | Especially for calling Homeassistant or PhP scripts to drive devices around the house. |
| ESP32httpUpdate | Enable OTA firmware updates |
| AsyncElegantOTA | OTA firmware update interface |
| PubSubClient | Attach to MQTT server to publish but espcially to get data from sensors, Solar inverter, Air monitors etc. |
| ArduinoJson | Decode JSON strings from servers |
Sample code
For a code example see my post: Coding a Touchscreen Menu !
![]() | ![]() |

