In this tutorial, we are going to launch a kind of TFT LCD with St7789 driver, as a result of which we will be able to show an interesting animation that simulates the function of the human eye. Of course, I will teach you how to change the type of eye animation. In this project, we will use the Wemos board with ESP8266 chip to set up the TFT display, the used TFT display with dimensions of 240 x 240, which due to its full color, contributes a lot to the beauty of the project. We will use the TFT-eSPI library to set up and display graphic items, but we will also make changes to the library to make it suitable for ESP8266 use. Visit CiferTech for more tutorials, and be sure to follow my Instagram page to support me. ^-^
In the human eye project, we use TFT LCD, which stands for “Thin Film Transistor”. The color TFT LCD display has transistors made of amorphous silicon thin films deposited on the glass. It acts as a control valve to generate the proper voltage on the liquid crystals for separate sub-pixels. For this reason, the TFT LCD screen is also called the Active Matrix display. The 1.54-inch display has 240×240 pixels, 16-bit full color, and an IPS display, so the color looks great up to 80 degrees from the axis in any direction. This LCD uses the ST7789 driver.
In this project, we use the TFT-eSPI library to set up the monitor. However, in order to be able to connect the monitor to the ESP8266 board, we must make changes in the library by replacing one of the files in the main folder. In this step, follow the steps below for the initial installation of the library. First, we install the TFT-eSPI sensor reference library in Arduino IDE software. Follow these steps:
- Follow this path Sketch> Include Library> Manage Libraries
- Search for the word TFT-eSPI.
- Install the library.
Next, to configure the screen, we need to modify User_Setup.h inside the library.
- Navigate to the library installation path in Documents / Arduino / libraries.
- Download the User_Setup.h file from this link and replace the existing file with the same name.
In this project, we used a TFT LCD or SPI communication protocol that will use pins D0, D1, D5, D7 on the Wemos board, we will also use a light-dependent resistor whose values are determined by analog to digital pins A0 is measured. Make the connections according to the table and schematic below.
- Schematic of TFT LCD monitor connections and Wemos board
Up to this point, we have been able to capture the animation of the eye on the screen. When the light is low, the pupil opens and the pupil becomes smaller when a lot of light is detected. In this added circuit we used two types of resistors, one is a normal resistor and the other is a light dependent resistor or LDR that will be connected to pin A0 on the Wemos board.
In this section, we came to the code of this project, which has several different sections, in fact, it is defined from several different tabs for different functions, which you can see only the first page in this section. Download the full code from my GitHub page at this link.