esp8266 tft lcd quotation

// https://www.aliexpress.com/store/product/3-2-TFT-LCD-Display-module-Touch-Screen-Shield-board-onboard-temperature-sensor-w-Touch-Pen/1199788_32755473754.html?spm=2114.12010615.0.0.bXDdc3

esp8266 tft lcd quotation

In the previous article (“WiFi OLED Mini Weather Station with ESP8266“) I have used the OLED kit from https://blog.squix.org. And as promised, this time it is about the “ESP8266 WiFi Color Display Kit”:

I had ordered both because I thought that the Color Display kit is needs the other kit as a base. Well, it turned out that both kits work independently. My bad. Actually this is good, as I have now two independent ESP8266 weather stations :-). An addition to that, they can exchange data (e.g. temperature/humidity) with a server, so that makes them a perfect dual weather station.

Example code is available on GitHub (https://github.com/squix78/esp8266-weather-station-color). The code is very well documented I had no issues to make all the needed configuration (WiFi SSID and connection settings). After a few  hours I had the ESP8266 weather station up and running in the first prototype of the enclosure:

After a few hours, I have now my second ESP8266 WiFi weather station with touch LCD. It is not looking good and I very much enjoy it. The design is available on Thingiverse (https://www.thingiverse.com/thing:2527282).

esp8266 tft lcd quotation

But there is a plot twist. The used microcontroller (ESP8266) can go to sleep for only 3 hours and 25 minutes (according to the Internet --- see IV.Credits --- ). So I decided to wake up the microcontroller after the before mentioned time (3 hours and 25 minutes) and then put it back to sleep. This will be done 7 times (a total of 23 hours). To keep track of the numbers of wake-ups between 2 quotes, I saved a counter in the RTC user memory from the ESP8266 ( --- see IV.Credits --- ). In this way, when the microcontroller goes to sleep the counter will be kept.

This seems to be all, but... IT IS NOT! The RTC from ESP8266, when this microcontroller is in DeepSleepMode, is not very precise ( in my tests it will fall behind with at least 1 hour in 23 hours of DeepSleep ). So to fix this issue, I made the ESP8266 to take the time from an NTP Server, after displaying the quote for an hour, and storing the hours and minutes in the RTC memory. When the 7 cycles of waking-up and going back to sleep, the ESP8266 take again the time from the NTP Server and compare the stored time with the one took seconds ago. If the hour stored is later than the current hour, the ESP8266 will go to DeepSleep for the remaining time between the two intervals of time ( the stored one and the current one ).Else, if the number of minutes stored are greater than the number of current minutes, the ESP8266 will go to LightSleep for the remaining number of minutes between the two intervals of time ( this time, the RTC is precise enough to wake up the ESP8266 at the exact time ).

esp8266 tft lcd quotation

The ILI9341 TFT module contains a display controller with the same name: ILI9341. It’s a color display that uses SPI interface protocol and requires 4 or 5 control pins, it’s low cost and easy to use.

The resolution of this TFT display is 240 x 320 which means it has 76800 pixels. This module works with 3.3V only and it doesn’t support 5V (not 5V tolerant).

The ILI9341 TFT display board which is shown in project circuit diagram has 14 pins, the first 9 pins are for the display and the other 5 pins are for the touch module.

Pins D5 (GPIO14) and D7 (GPIO13) are hardware SPI module pins of the ESP8266EX microcontroller respectively for SCK (serial clock) and MOSI (master-out slave-in).

The first library is a driver for the ILI9341 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “ili9341” and choose the one from Adafruit).

The ILI9341 TFT display is connected to NodeMCU hardware SPI module pins (clock and data), the other pins which are: CS (chip select), RST (reset) and DC (data/command) are defined as shown below:

esp8266 tft lcd quotation

In this Arduino touch screen tutorial we will learn how to use TFT LCD Touch Screen with Arduino. You can watch the following video or read the written tutorial below.

As an example I am using a 3.2” TFT Touch Screen in a combination with a TFT LCD Arduino Mega Shield. We need a shield because the TFT Touch screen works at 3.3V and the Arduino Mega outputs are 5 V. For the first example I have the HC-SR04 ultrasonic sensor, then for the second example an RGB LED with three resistors and a push button for the game example. Also I had to make a custom made pin header like this, by soldering pin headers and bend on of them so I could insert them in between the Arduino Board and the TFT Shield.

Here’s the circuit schematic. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number 14. As the 5V pins are already used by the TFT Screen I will use the pin number 13 as VCC, by setting it right away high in the setup section of code.

I will use the UTFT and URTouch libraries made by Henning Karlsen. Here I would like to say thanks to him for the incredible work he has done. The libraries enable really easy use of the TFT Screens, and they work with many different TFT screens sizes, shields and controllers. You can download these libraries from his website, RinkyDinkElectronics.com and also find a lot of demo examples and detailed documentation of how to use them.

After we include the libraries we need to create UTFT and URTouch objects. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries.

So now I will explain how we can make the home screen of the program. With the setBackColor() function we need to set the background color of the text, black one in our case. Then we need to set the color to white, set the big font and using the print() function, we will print the string “Arduino TFT Tutorial” at the center of the screen and 10 pixels  down the Y – Axis of the screen. Next we will set the color to red and draw the red line below the text. After that we need to set the color back to white, and print the two other strings, “by HowToMechatronics.com” using the small font and “Select Example” using the big font.

esp8266 tft lcd quotation

The Wemos is a fully functional D1 Mini Pro and has 16mb! That gives you tons of creative room for enhancements! I planned to rewrite everything to meet the needs of my project, that needed a touch screen and to be wifi connected so I was pleased with the processing power. If I had a complaint, it would be that the only pins left after interfacing with the TFT, is the serial pins, an analog pin (A0), and a digital pin (D0). That does not leave much room for expansion to sensors, etc. Not a design flaw though, just a limitation and workable. So long as I can attach an interrupt to D0 status change, I’m good. I have not tested that yet.

I cannot speak for the seller, but I do not believe this kit was meant to be a 100% out of the box working project for weather. Rather, it is a fully functional Wemos ESP8266 controlled touch TFT display. And for that, it does it very well, with smart components selected! And at a very reasonable price! I am very impressed and happy with this purchase!! I just scratched the surface on what is possible with this gear through my sketches or modifications and it is a great building base for that geek that envisions touch control panels and wireless connectivity for all their embedded projects. INVENT! ENJOY!

esp8266 tft lcd quotation

//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)

esp8266 tft lcd quotation

The ST7789 TFT module contains a display controller with the same name: ST7789. It’s a color display that uses SPI interface protocol and requires 3, 4 or 5 control pins, it’s low cost and easy to use.

Pins D5 (GPIO14) and D7 (GPIO13) are hardware SPI module pins of the ESP8266EX microcontroller respectively for SCK (serial clock) and MOSI (master-out slave-in).

The first library is a driver for the ST7789 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7789” and install the one from Adafruit).

esp8266 tft lcd quotation

As you all know the are a few variants of the 1.8" TFT on the internet. With the genuine Adafruit lcd-s there are usually no problems. But when using fake ones(usually from Aliexpress) you have to make some adjustments.

Bodmers TFT_eSPI library is very awsome and rich funcionality. And the best part is that he made it to handle the pixel offsets depending on wich kind of 1.8" TFT you are using.

Then uncomment the tft height an width. And then in my case(REDTAB) uncomment for eg: #define ST7735_REDTAB. After this save it for the moment and compile sketch and upload to board. To be sure i have defined the parameters in the sketch too.This is a bit long procedure, cause you have to compile and upload the sketch every time to board untill the offset is gone, but it is worth the experimenting. For editing the h. files i strongly suggest Wordpad. Images included.

esp8266 tft lcd quotation

NodeMCU is a low-cost open source IoT platform.firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which was based on the ESP-12 module.ESP32 32-bit MCU was added.

The firmware uses the Lua scripting language. The firmware is based on the eLua project, and built on the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such as lua-cjsonSPIFFS.ESP32 has also been implemented.

The prototyping hardware typically used is a circuit board functioning as a dual in-line package (DIP) which integrates a USB controller with a smaller surface-mounted board containing the MCU and antenna. The choice of the DIP format allows for easy prototyping on breadboards. The design was initially based on the ESP-12 module of the ESP8266, which is a Wi-Fi SoC integrated with a Tensilica Xtensa LX106 core, widely used in IoT applications (see related projects).

NodeMCU was created shortly after the ESP8266 came out. On December 30, 2013, Espressif Systemsgerber file of an ESP8266 board, named devkit v0.9.MQTT client library from Contiki to the ESP8266 SoC platform,

As Arduino.cc began developing new MCU boards based on non-AVR processors like the ARM/SAM MCU used in the Arduino Due, they needed to modify the Arduino IDE so it would be relatively easy to change the IDE to support alternate toolchains to allow Arduino C/C++ to be compiled for these new processors. They did this with the introduction of the Board Manager and the SAM Core. A "core" is the collection of software components required by the Board Manager and the Arduino IDE to compile an Arduino C/C++ source file for the target MCU"s machine language. Some ESP8266 enthusiasts developed an Arduino core for the ESP8266 WiFi SoC, popularly called the "ESP8266 Core for the Arduino IDE".