Introduction: ILI9341 Touch Shield for Wemos D1 Mini
Hi Makers!
I made an ILI9341 shield for Wemos D1 mini series. Using this shield I can use all functions of the 2.8" TFT. It works as a screen (of course), additionally I can harness the touch function and the SD socket also.
This instructable is inspired by this acticle of Nailbuster Inc.
In the next some steps I will show how can you make your own shield.
Step 1: Components You Need
- ILI9341 2.8" tft with touch chip
- Wemos D1 mini (or mini Pro)
- strip board (min. 36colsx35rows)
- L7805 voltage regulator IC + heatsink
- 5.5x2.1 power socket
- 330nF capacitor
- 100nF capacitor
- full size SD card (or micro SD with adapter)
- single row male and female header
- wires
- micro USB cable for program download
- 6-12V power supply (optionally)
If you would like to use the touch function of the TFT, you have to buy one with touch chip.
Step 2: Add the SD Function
As you can see the Nailbuster's circuit determines the main part of the pin connection. We have only one thing to do, to connect the SD pins to the MCU.
Each part of the TFT communicates with the MCU through SPI bus. So we have to connect three SD pins to the common SPI pins.
- SD_MOSI to the MOSI pin of the MCU
- SD_MISO to the MISO pin of the MCU
- SD_SCK to the SCK pin of the MCU.
Only the SD_CS (slave select or SS) has to be unique. I use the D3 pin as SD_CS.
Of course you have to solder a four pin long male pin header to the SD connections.
More info about the SPI bus on the Wikipedia.
Step 3: Making the PCB
- The PCB dimension I use is 36 colons by 35 rows. At first I place the main components and define the final dimensions of the PCB. After that I cut it to the final dimensions.
- Make four holes into the four corners through which you can fix the PCB.
- Enlarge the holes through which you can insert the power socket.
- Cut the female headers and solder them into the PCB. You need
- 8 pin long x2 for the Wemos board
- 14 pin long x1 and
- 4 pin long x1 for the TFT
- Solder
- the power socket
- the capacitors
- the voltage regulator
- the wires.
- After that you have to cut some of the PCB strips to eliminate shorts. (See the diagram above.)
- In the next step I suggest to take a multimeter and check the connections. Doing this step you can eliminate some smoke and burning components. :-)
- Finally insert the Wemos board and the TFT into the shield.
To cut the PCB strips there is a very easy way. Use a drill bit with 3.5 mm diameter. Align it into a hole and turn it between your fingers.
To save your circuit from shortcuts you may assemble it on a plastic sheet using some spacers and screws.
Step 4: Sample Program
At first you have to download and install the next libraries:
- Adafruit GFX graphics core library and the
- Arduino library for XPT2046 from the Github.
Then download the attached four sketches.
- Make the "button_SD_test_03" folder and put the four files into it.
- Open the "button_SD_test_03.ino" by the Arduino IDE and upload the program to the MCU.
In the attached programs you will find samples which will guide you to use the shield.
As you will see the screen calibration of the portrait screen is not so good. If you have better calibration parameters please share them with us.
There are some remaining pins which can be used to connect your shield to sensors or other devices.
- D0 - digital I/O or SS an additional SPI device
- A0 - alalog input
- RST
- TX, RX - serial communication, I2C or SS an additional SPI devices
Of course you can communicate with other devices or grab any data from the Internet through WiFi also. To do it see my previous instructables.