未加星标

Tutorial 7: ESP8266 and ILI9341 TFT LCD

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

In tutorial 3 , we discussed how to use an SSD1306-driven I2C OLED screen with EasyESP-1 for displaying basic text and graphics. We useda 0.96″ (along the diagonal) 128×64 monochrome pixels OLED display for illustration. Despite its small size, the readability was pretty good due to its high contrast, which makes it a very good, compact size display for general applications. The excitement of having a display screen in an ESP8266 project can be further enhanced by upgrading the choice of display to colorful TFT LCD. One such screen that is readily available in the market at affordable price is ILI9341 based TFT LCDs. This tutorial describes the method to connectsuch displays with ESP8266 using Arduino IDE.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Interfacing an ILI9341 TFT LCD

Hardware

The datasheet of ILI9341 driver chip states:

ILI9341 is a 262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution of 240RGBx320 dots, comprising a 720-channel source driver, a 320-channel gate driver, 172,800 bytes GRAM for graphic display data of 240RGBx320 dots, and power supply circuit. ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, 6-/16-/18-bit data bus RGB interface and 3-/4-line serial peripheral interface (SPI). The moving picture area can be specified in internal GRAM by window address function. The specified window area can be updated selectively, so that moving picture can be displayed simultaneously independent of still picture area.

You can find ILI9341-based TFT displays in various sizes on eBay andAliexpress. The one I chose for this tutorial is 2.2″ length along the diagonal, 240×320 pixels resolution, supports SPI interface, and can be purchased for less than $10.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

2.2″ TFT LCD used in this tutorial is bought from a Chinese store on Aliexpress

The connections between the TFT display and EasyESP-1 pins are as follows.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Connections between ILI9341 SPI TFT module and EasyESP-1

Note that we will be using the hardware SPI module of the ESP8266 to drive the TFT LCD. The SPI communication pins are multiplexed with I/O pins D5 (SCK), D6 (MISO), and D7 (MOSI). The chip select (CS) and Data/Command (DC) signal lines are configurable through software.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Complete setup of LCD on the EasyESP-1 breadboard

Software

For ILI9341-based TFT displays, there are someoptions for choosing the library for your application. The most common one is using Adafruit’s library for ILI9341 display. You will also need their GFX-library with this. There’s another one that I recently discovered named TFT ILI9341 ESP , and is more versatile than the Adafruit’s library. This is shared on github by Bodmer . We will use this library in this tutorial. So go ahead and download the TFT ILI9341 ESP library, and install it in your Arduino/libraries folder.

About this library (in Author’s words):

An Arduino IDE compatible graphics and fonts library for ESP8266 processors with a driver for the ILI9341 based TFT displays.

The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. The library has been tested with the NodeMCU (ESP8266 based).

The library is based on the Adafruit GFX and Adafruit ILI9341 libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for ESP8266 processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are a significant number of example sketches to demonstrate the different features.

Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder. Fonts and features can easily be disabled by commenting out lines.

As mentioned by the author, you need to open the User_Setup.h file inside the main library folder and modify the following two lines to match with our setup.

#define TFT_CS D2 // Chip select control pin

#define TFT_DC D1 // Data Command control pin

Now you are all set to try out tons ofreally cool built-in examples that come with the library. The following output corresponds to the TFT_Pie_Chart example.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Drawing a colorful Pi Chart on TFT screen

There is an example (TFT_Rainbow_one_lib.ino) for showing different size text fonts with rainbow colors in the background that looks pretty cool.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Rainbow colors demo


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Another example of printing texts with different font sizes and colors

My favorite example is TFT terminal, which implements a simple “Arduino IDE Serial Monitor” like serial receive terminal for monitoring debugging messages from another Arduino or ESP8266 board.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

Serial receive terminal example

Buy EasyESP-1 board

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: ArduinoCUeBay
分页:12
转载请注明
本文标题:Tutorial 7: ESP8266 and ILI9341 TFT LCD
本站链接:http://www.codesec.net/view/531201.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(35)