Use ESP12F to drive TFT screen display. There are two USB to serial port chips in the schematic diagram. It is recommended to choose CH340C. It can be downloaded automatically. If the smallest size is required, CH340E can be used. I put two displays, one is 1.8 inches, and the other is 2.4 inches, you can choose it yourself. The package modifies itself.
TFT_eSPI library user manual
1. TFT_eSPI configuration
1. Download the tft_espi library
https://github.com/Bodmer/TFT_eSPI
It is strongly recommended to use the older version, around 2.0. The new version will have problems such as display inversion.
2. Unzip and import it into the libraries in the root directory of arduino.
(You can also install it directly using the arduino compiler. The path is in the computer's Quick Access->Documentation->Arduino->libraries)
3. Open the file User_Setup.h (it is recommended to open it with notepad++, it is more powerful and can open many types of files). It can be seen from the file name that this file needs to be modified by the user himself.
1. Open the file User_Setup.h and modify the parameters according to your own screen information.
2. Select the driver chip of the screen. Here is ST7735 as an example. Just remove the "//" in front of it.
3. Select the screen pixel (I use a 128*160 screen, just remove "//")
4. Select pins according to your own schematic diagram
If the screen reset RST is introduced and connected to the ESP8266,
Just remove the "//" before //#define TFT_RST -1, and block the previous statement at the same time.
The picture below is the pin correspondence diagram of ESP8266
5. Adjust SPI speed
The default is 270000000, here I set it to 40000000.
At this point you can use the routine test screen that comes with TFT_eSPI
The routine is here
At this point, the TFT_eSPI library is configured.
2. TFT_eSPI library tutorial
1. Color adjustment
For example: tft.alphaBlend(20, TFT_RED, TFT_WHILE);
2. Set font
The number range is 1, 2, 4, 6, 7, 8. Different numbers represent different fonts. Different fonts have different basic sizes due to different resolutions.
If you want to learn the custom font library, please refer to ArduinolibrariesTFT_eSPIexamples320 x 240TFT_Custom_Fonts
3. Related APIs
1. tft.init(); //Initialize the initialization screen. If it is ST7735, you can pass a parameter into it. You will see when it is used.
2. tft.fillScreen(TFT_BLACK); //Fill the full screen
3. Screen rotation
//Set the rotation angle of the screen display. The parameters are: 0, 1, 2, and 3 respectively represent 0°, 90°, 180°, and 270°.
void setRotation(uint8_t r);
4. Screen color inversion
//Invert the display color i = 1 is inverted, i = 0 is normal
tft.invertDisplay(bool i);
4. Display text
1. tft.setCursor(20, 10, 4); //Set the typing starting coordinate position and font size
2. tft.setTextColor(TFT_BLACK); //Set font color
3. tft.setTextSize(2); //Set the font size (range 1~7)
4. tft.print("Hello World!"); // Display font
5. Draw characters
1. Draw a string (left)
2. Draw string (centered)
3. Draw a string (right)
4. Draw characters
5. Draw floating point numbers
6. Draw numbers
6. Draw geometric figures
1. Draw dots
2. Draw lines
3. Draw horizontal lines (quick)
4. Draw vertical lines (quick)
5. Draw a hollow circle
6. Draw a solid circle
7. Draw a hollow ellipse
8. Draw a solid ellipse
9. Draw a hollow rectangle
10. Draw a solid rectangle
11. Draw a hollow rounded rectangle
12. Draw a solid rounded rectangle
13. Draw a hollow triangle
14. Draw a solid triangle
7. Display pictures
Displaying images requires the mold taking software lcd-image-converter
Adjust the pixel size of the image to not exceed the screen size -> Click File->Open->Select the image->Options->Conversion...->Set as shown in the interface->Shoe Preview->Copy the array
The mold taking is now complete.
Create a new jpg.h file, and save the array just copied moduloly within the braces of the const unsigned short bmp[] PROGMEM={}; statement.
Routine:
#include<jpg.h>
#include<TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
tft.init();
tft.pushImage(0,0,128,160,bmp);
}
void loop() {
}
This will display the picture.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet