micropython tft display made in china

So you have a nifty display like a bright TFT LCD, Charlieplex LED or NeoPixel matrix powered by MicroPython, but what if you want to draw shapes and graphics on it? Most MicroPython display modules only give you basic pixel drawing commands so it"s difficult to draw graphics yourself pixel by pixel. Luckily there"s a handy new MicroPython graphics module you can use to draw basic shapes and graphics on any pixel-based display! This module shows some of the power of MicroPython--a single module can work with any pixel display because of MicroPython"s dynamic language features. In this guide you"ll learn how to use a MicroPython graphics module to draw basic line, rectangle, circle, and triangle shapes on pixel-based displays like the ILI9341 TFT FeatherWing.

For this guide there"s no special hardware you need to draw graphics on a display. However you do need to have a pixel-based display of some sort (LED, TFT, NeoPixel--anything!) connected to your MicroPython board. Check out the following guides for details on how to use a few pixel displays with MicroPython:

First make sure you are running the latest version of MicroPython for your board. If you"re using the ESP8266 MicroPython port you must be running version

If your board supports USB mass storage, like the SAMD21 MicroPython port, then simply drag the .mpy and other files to the board"s file system (eject the drive and reset the board to make sure it is picked up by MicroPython).

The following section will show how to draw shapes on a ILI9341 TFT display like the TFT FeatherWing. You"ll see how the module can be adpated to draw on any pixel-based display by plugging in a new pixel drawing function too.

Next you"ll need to initialize your display so that you can draw pixels on it. Consult the MicroPython display guides for details on initializing displays.

To use the graphics and shape rendering module you"ll need to import its module and create an instance of the GFX class inside it. For example, to create a graphics renderer for the TFT FeatherWing above you would run:

A pixel drawing function to call when the GFX class needs to write a pixel. For this example the TFT display classpixelfunction is specified. It"s important to note that to use the graphics class youmusthave a function it can call to draw pixels! This function can live anywhere, like as a global function or on a class instance. The function needs to take at least a pixel x position and pixel y position parameter (in that order), and any number of other positional and keyword parameters after them (like color, intensity, etc.).

There are two optional parameters you can specify as keyword arguments too. They aren"t shown in this guide but see how the ILI9341 display example code uses them:

hline- Optionally set hline to a fast horizontal line drawing function for your display. This will improve the speed of drawing certain shapes. The function should take as parameters an x position and y position of the line start, then width of the line in pixels. Any number of optional color or other parameters can follow. If you don"t provide a hline function a slow default implementation that draws pixel by pixel will be used.

vline - Optionally set vline to a fast vertical line drawing function for your display. This will improve the speed of drawing certain shapes, especially filled shapes. The function should take as parameters an x position, y position of the line start, then height of the line in pixels. Any number of optional color or other parameters can follow. If you don"t provide a vline function a slow default implementation that draws pixel by pixel will be used.

Now the fun begins! After creating the GFX class you can call functions to draw shapes on the display. For example, draw a simple line across the entire display with the line function:

That"s all there is to basic shape drawing with the Adafruit MicroPython GFX module! With these basic shape primitives you can start to create interesting graphic projects, like a pong or breakout game using filled rectangles and circles. You can add text with the Adafruit MicroPython bitmap font module too!

Remember any pixel-based display can be used with this library, for example, an OLED display or NeoPixel, Charlieplex LED, or simple LED backpack matrix are great targets to use with the library. Just plug in each module"s pixel function and you"ll be drawing shapes in no time!

micropython tft display made in china

Note the video above was made showing the MicroPython version of this library. Follow the guide to see both CircuitPython and MicroPython versions of the ILI9341 library.

Small TFT displays are a great way to add graphics to your projects. These are like tiny little LCD monitors that you can drive with a simple SPI serial interface. You can even use these displays in CircuitPython and MicroPython using a module from Adafruit! This module allows you to do basic drawing like putting pixels and filling rectangles on TFT displays like the TFT FeatherWing. You can start to explore a fun world of Python and graphical TFT displays!

This guide explores how to use ILI9341/ILI9340 TFT displays with CircuitPython and MicroPython. Note that right now drawing support for these displays is limited to basic pixel and rectangle drawing commands. You can use another library to draw basic graphics or to draw text. In addition, the touchscreens commonly found on these small TFT displays are not currently supported by the Python module. In the future, a touchscreen module might be available, but for now these displays are only for viewing graphics.

If you"re using a Feather the TFT FeatherWing is the perfect option that easily connects to the Feather. For other boards, you"ll need an ILI9341 or ILI9340 display breakout, like this large 2.8" TFT display breakout. ILI9340 displays like the 2.2" TFT breakout or 2.4" TFT breakout should work too. Make sure the display you"re using has the ILI9341 or ILI9340 driver chip!

If you"re using a TFT FeatherWing and Feather just slide the wing onto the Feather board and you"re all set! The FeatherWing will automatically be connected to the board using its SPI connection.

If you"re using a TFT display breakout you"ll need to connect its power, ground, and SPI connections to the board. For example, the wiring for a 2.8" TFT breakout to Feather HUZZAH ESP8266 might look like:

Display 3.3V output to IM3, IM2, and IM1 (but not IM0!) pins. This configures the breakout to use its SPI interface. See the breakout guide for details on soldering closed these connections to make the SPI interface the default.

To use the TFT display with your Adafruit CircuitPython board you"ll need to install the Adafruit_CircuitPython_RGB_Display module on your board. Remember this module is for Adafruit CircuitPython firmware and not MicroPython.org firmware!

For express boards that have extra flash storage, like the Feather/Metro M0 express and Circuit Playground express, you can easily install the necessary libraries with Adafruit"s CircuitPython bundle. This is an all-in-one package that includes the necessary libraries to use the ILI9341 display with CircuitPython. To install the bundle follow the steps in your board"s guide.

Before continuing, make sure your board"s root filesystem has the adafruit_rgb_display, adafruit_bus_device, and adafruit_register folders/modules copied over.

The following section will show how to control the LED backpack from the board"s Python prompt / REPL. You"ll walk through how to control the TFT display and learn how to use the CircuitPython module built for the display. As a reference, be sure to see the micropython-adafruit-rgb-display module documentation too.

On CircuitPython the SPI bus must be initialized before the display can be used by your code. Run the following code to import the necessary modules and initialize the SPI bus:

These lines create the SPI bus interface and two digital inputs/outputs for the chip select and data/command lines connected to the display. Notice that the pin numbers might be different depending on your board and how it"s wired. Read the comments above and pick the correct two cs and dc lines to run for your setup.

When creating the display instance of the ILI9341 class you"ll need to know which pins are connected to the display"s CS, DC, and optionally RST or reset line. For the TFT FeatherWing see its guide for details on these pin connections.

Once the display is initialized you"re ready to perform basic fill and pixel drawing. First to fill the display with a solid color use the fill function:

Notice how the color565 function is called to get a color that"s passed to the fill function. This color565 function takes in the red, green, and blue color component values which should range from 0 (lowest intensity) to 255 (highest intensity). Try filling the display with different color values!

That"s all there is to drawing on the ILI9341 display with CircuitPython! Right now, only basic fill, pixel, and filled rectangle drawing commands are supported. However, since this is a pixel-based display you can also draw text with the bitmap font library. There"s even a basic graphics library to draw lines and other shapes!

Note this page describes how to use a MicroPython.org version of this library with MicroPython boards. Skip back to the previous page if you"re using a CircuitPython board like the Feather M0 express!

In addition to CircuitPython, there"s an older MicroPython version of the TFT library that you can use with some MicroPython boards. Before you get started it will help to be familiar with these guides for working with MicroPython:

To use the TFT display with your MicroPython board you"ll need to install the micropython-adafruit-rgb-display MicroPython module on your board. Remember this module is for MicroPython.org firmware and not Adafruit CircuitPython!

First make sure you are running the latest version of MicroPython for your board. If you"re using the ESP8266 MicroPython port you must be running version 1.8.5 or higher as earlier versions do not support using .mpy modules as shown in this guide.

The following section will show how to control the ILI9341 display from the board"s Python prompt / REPL. First connect to the board"s serial REPL so you are at the MicroPython >>> prompt.

On MicroPython.org firmware which uses the machine API you can initialize SPI like the MicroPython SPI guide mentions. For example, on the ESP8266 with TFT FeatherWing you can run:

Notice how the baudrate is specifying the SPI bus clock speed at 32mhz. This means pixel data will be sent very quickly to the display--much quicker than a software SPI interface. These displays can actually run up to about 64mhz but the ESP8266 SPI hardware can"t support that fast of a speed!

When creating the display instance of the ILI9341 class you"ll need to know which pins are connected to the display"s CS, DC, and optionally RST or reset line. For the TFT FeatherWing see its guide for details on these pin connections.

After initializing SPI and the display you"re ready to start drawing on it. The usage of the drawing library is exactly the same as with CircuitPython so check out the CircuitPython drawing information--the same code will work on MicroPython too!

micropython tft display made in china

Timing the display.clear() function gets a time of about 1100ms to write a completely black screen. Results are worse when looking at displaying an image. I am taking one of the RAW images from the repo which are preconverted pngs and so there shouldn"t be any conversion needed at write time. When writing one to fill the screen I get a write time of 2680ms, over 2.5 seconds, which is a far cry from the 40ms you get, even allowing for the factor of a larger display.

I am very new to working with SPI displays so could be completely missing something but I appreciate the help you are offereing. How much work has to go into each of the drivers / would it be feasable for me to work on creating a driver to work with your GUI with some learning?

micropython tft display made in china

As a 2.4inch TFT display module with a resolution of 240 * 320, it uses the SPI interface for communication. LCD has an internal controller with basic functions, which can be used to draw points, lines, circles, and rectangles, and can display English, Chinese as well as pictures.

Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has a display requirement.

Framebuffer uses a video output device to drive a video display device from a memory buffer containing complete frame data. Simply put, a memory area is used to store the display content, and the display content can be changed by changing the data in the memory.

If you need to draw pictures, or display Chinese and English characters, we provide some basic functions here about some graphics processing in the directory RaspberryPi\c\lib\GUI\GUI_Paint.c(.h).

Set points of the display position and color in the buffer: here is the core GUI function, processing points display position and color in the buffer.

The fill color of a certain window in the image buffer: the image buffer part of the window filled with a certain color, usually used to fresh the screen into blank, often used for time display, fresh the last second of the screen.

Display time: in the image buffer,use (Xstart Ystart) as the left vertex, display time,you can choose Ascii visual character font, font foreground color, font background color.;

Note: Each character library contains different characters; If some characters cannot be displayed, it is recommended that you can refer to the encoding set ro used.

micropython tft display made in china

Nextion is a Human Machine Interface (HMI) solution combining an onboard processor and memory touch display with Nextion Editor software for HMI GUI project development.

Using the Nextion Editor software, you can quickly develop the HMI GUI by drag-and-drop components (graphics, text, button, slider, etc.) and ASCII text-based instructions for coding how components interact on the display side.

Nextion HMI display connects to peripheral MCU via TTL Serial (5V, TX, RX, GND) to provide event notifications that peripheral MCU can act on, the peripheral MCU can easily update progress, and status back to Nextion display utilizing simple ASCII text-based instructions.

micropython tft display made in china

This ST7735S 1.8" TFT Display features a resolution of 128×160 and SPI (4-wire) communication. Integrated with an SD card slot, it allows to easily read full-color bitmaps from the SD card. The module provides users with two wiring methods: pin header wiring and GDI (General Display interface). You can directly use an FPC cable to connect the display to any controller with GDI interface like FireBeetle-M0. Plug and play, easy to wire. Besides, the display supports low refresh rate and offers good display effect and strong versatility. It can be used in applications like sensor monitoring and alarm, Arduino temperature monitor, fan controller, etc.

This product is a breakout module that features SPI communication mode and onboard GDI interface, which could reduce the complexity of wiring. It can easily display the read content from the SD card.

The BasicTest.ino code shows us the basic display functions of the screen: text display, number display, drawing lines, drawing rectangles and other demos.

micropython tft display made in china

Checking a TFT lcd driver is very messy thing especially if its a Chinese manufactured TFT. TFT’s that are supplied by Chinese manufactures are cheap and every body loves to purchase them since they are cheap,but people are unaware of the problems that comes in future when finding the datasheet or specs of the particular TFT they purchased. Chinese manufactures did not supply datasheet of TFT or its driver. The only thing they do is writes about the TFT driver their lcd’s are using on their websites. I also get in trouble when i started with TFT’s because i also purchased a cheap one from aliexpress.com. After so many trials i succeeded in identifying the driver and initializing it. Now i though to write a routine that can identify the driver.

I wrote a simple Arduino Sketch that can easily and correctly identify the TFT Lcd driver. I checked it on 2.4, 3.2 and 3.8 inch 8-bit TFT lcd and it is identifying the drivers correctly. The drivers which i successfully recognized are ILI9325, ILI9328, ILI9341, ILI9335, ST7783, ST7781 and ST7787. It can also recognize other drivers such as ML9863A, ML9480 and ML9445 but i don’t have tft’s that are using this drivers.

The basic idea behind reading the driver is reading the device ID. Since all the drivers have their ID’s present in their register no 0x00, so what i do is read this register and identify which driver tft is using. Reading the register is also a complex task, but i have gone through it many times and i am well aware of how to read register. A simple timing diagram from ST7781 driver explains all. I am using tft in 8-bit interface so i uploaded timing diagram of 8-bit parallel interface. The diagram below is taken from datasheet of ST7781 tft lcd driver.

The most complex tft i came across is from a Chinese manufacturer “mcufriend”. mcufriend website says that they use ILI9341 and ILI9325 drivers for their tft’s. But what i found is strange their tft’s are using ST7781 driver(Device ID=7783). This is really a mesh. I have their 2.4 inch tft which according to their website is using ILI9341 driver but i found ST7783 driver(Device ID=7783). The tft i have is shown below.

Note:On serial monitor driver number will be displayed like if your lcd is using ST7783 controller than on serial monitor 7783 will be displayed or if tft is using ILI9341 than on 9341 will be displayed.

The code works on Arduino uno perfectly but if you are using any other board, than just change the pin numbers according to the board that you are using also check out for the Ports D and B. TFT Data Pin D0 is connected to Port-B Pin#0 and D1 is connected to Port-B Pin#1. TFT Data Pins D2 to D7 are connected to Port-D Pins 2,3,4,5,6,7. So if you are using Arduino mega than check for the Ports D and B and Make connections according to them. Arduino mega is working on ATmega2560 or ATmega1280 Microcontroller and Arduino uno is working on ATmega328p Microcontroller so both platforms have ports on different locations on arduino board so first check them and then make connections. The same process applies to all Arduino boards.

micropython tft display made in china

You haven"t mentioned/linked to the library you are using which might help people answer. First of all, check if the library you are using has the ability to control display layout - it might already and you won"t need the following:

Somewhere in your library"s display initialisation function it will write the value 0x36 followed by another byte. The 0x36 is the MADCTL command and the following byte is the parameter that controls the display layout. You can change this value to get the effect you want. I"d suggest changing one bit at a time - it helps keep track of which bit has what effect.

micropython tft display made in china

We have used Liquid Crystal Displays in the DroneBot Workshop many times before, but the one we are working with today has a bit of a twist – it’s a circle!  Perfect for creating electronic gauges and special effects.

LCD, or Liquid Crystal Displays, are great choices for many applications. They aren’t that power-hungry, they are available in monochrome or full-color models, and they are available in all shapes and sizes.

Today we will see how to use this display with both an Arduino and an ESP32. We will also use a pair of them to make some rather spooky animated eyeballs!

There are also some additional connections to the display. One of them, DC, sets the display into either Data or Command mode. Another, BL, is a control for the display’s backlight.

The above illustration shows the connections to the display.  The Waveshare display can be used with either 3.3 or 5-volt logic, the power supply voltage should match the logic level (although you CAN use a 5-volt supply with 3.3-volt logic).

Another difference is simply with the labeling on the display. There are two pins, one labeled SDA and the other labeled SCL. At a glance, you would assume that this is an I2C device, but it isn’t, it’s SPI just like the Waveshare device.

This display can be used for the experiments we will be doing with the ESP32, as that is a 3.3-volt logic microcontroller. You would need to use a voltage level converter if you wanted to use one of these with an Arduino Uno.

The Waveshare device comes with a cable for use with the display. Unfortunately, it only has female ends, which would be excellent for a Raspberry Pi (which is also supported) but not too handy for an Arduino Uno. I used short breadboard jumper wires to convert the ends into male ones suitable for the Arduino.

Once you have everything hooked up, you can start coding for the display. There are a few ways to do this, one of them is to grab the sample code thatWaveshare provides on their Wiki.

The Waveshare Wiki does provide some information about the display and a bit of sample code for a few common controllers. It’s a reasonable support page, unfortunately, it is the only support that Waveshare provides(I would have liked to see more examples and a tutorial, but I guess I’m spoiled by Adafruit and Sparkfun LOL).

Open the Arduino folder. Inside you’ll find quite a few folders, one for each display size that Waveshare supports. As I’m using the 1.28-inch model, I selected theLCD_1inch28folder.

You can see from the code that after loading some libraries we initialize the display, set its backlight level (you can use PWM on the BL pin to set the level), and paint a new image. We then proceed to draw lines and strings onto the display.

After uploading the code, you will see the display show a fake “clock”. It’s a static display, but it does illustrate how you can use this with the Waveshare code.

This library is an extension of the Adafruit GFX library, which itself is one of the most popular display libraries around. Because of this, there isextensive documentation for this libraryavailable from Adafruit.  This makes the library an excellent choice for those who want to write their own applications.

As with the Waveshare sample, this file just prints shapes and text to the display. It is quite an easy sketch to understand, especially with the Adafruit documentation.

The sketch finishes by printing some bizarre text on the display. The text is an excerpt from The Hitchhiker’s Guide to the Galaxy by Douglas Adams, and it’s a sample of Vogon poetry, which is considered to be the third-worst in the Galaxy!

Here is the hookup for the ESP32 and the GC9A01 display.  As with most ESP32 hookup diagrams, it is important to use the correct GPIO numbers instead of physical pins. The diagram shows the WROVER, so if you are using a different module you’ll need to consult its documentation to ensure that you hook it up properly.

The TFT_eSPI library is ideal for this, and several other, displays. You can install it through your Arduino IDE Library Manager, just search for “TFT_eSPI”.

There is a lot of demo code included with the library. Some of it is intended for other display sizes, but there are a few that you can use with your circular display.

To test out the display, you can use theColour_Test sketch, found inside the Test and Diagnostic menu item inside the library samples.  While this sketch was not made for this display, it is a good way to confirm that you have everything hooked up and configured properly.

A great demo code sample is theAnimated_dialsketch, which is found inside theSpritesmenu item.  This demonstration code will produce a “dial” indicator on the display, along with some simulated “data” (really just a random number generator).

One of my favorite sketches is the Animated Eyes sketch, which displays a pair of very convincing eyeballs that move. Although it will work on a single display, it is more effective if you use two.

The first thing we need to do is to hook up a second display. To do this, you connect every wire in parallel with the first display, except for the CS (chip select) line.

The Animated Eyes sketch can be found within the sample files for the TFT_eSPI library, under the “generic” folder.  Assuming that you have wired up the second GC9A01 display, you’ll want to use theAnimated_Eyes_2sketch.

The GC9A01 LCD module is a 1.28-inch round display that is useful for instrumentation and other similar projects. Today we will learn how to use this display with an Arduino Uno and an ESP32.

micropython tft display made in china

The ESP32 touch sensor development kit, ESP32-Sense Kit, is used for evaluating and developing ESP32 touch sensor system. ESP32-Sense Kit consists of one motherboard and multiple daughterboards. The motherboard contains a display unit, a main control unit and a debug unit. The daughterboards have touch electrodes in different combinations or shapes, such as linear slider, wheel slider, matrix buttons and spring buttons, depending on the application scenarios. Users can design and add their own daughterboards for special usage cases.

ESP-WROOM-32 based development board with SH1106 OLED display (128×64 pixels), RJ-45 Ethernet connector, CAN-bus connector, Micro USB connector, USB-to-UART bridge, LiPo battery connector and charging circuit.

ESP32 development board with ePaper display, TI PCM5102A DAC, ICS43434 MEMS Microphone, CP2102N USB-to-UART bridge, microSD card slot, and LiPo charger.

micropython tft display made in china

In this project, we will make few video games using ESP32 & 3.5 inch ILI9488 TFT Touch Screen Display. The customized board is designed and manufactured by

But in this project, we will not be using the Camera or the SD Card slot. Rather we will use the ESP32 & ILI9488 TFT Touch Screen Display and write the Arduino Code for video game support. The board can be programmed with the Arduino Code or Micropython code. But this section explains the use of Arduino Code to make video games.

This is a beautiful 3.5" TFT touchscreen display, based on ESP32-WROVER chip, with a built-in 2M pixel OV2640 camera. The combination of all these gives a perfect platform for ESP32 Application like Video Games.

The TFT LCD driver is basically ILI9488 & has a dimension of 3.5″ with 320x480 screen resolution. The ILI9488 LCD uses SPI for communication with the ESP32 chip. The SPI main clock could be up to 60M~80M, make the display smooth enough for videos. The camera module on this board is an OV2640 Camera with a 2MP resolution.

With this camera, you can make applications such as remote photography, face recognition & security system projects. While the camera is not used, you can freely use all these pins with the breakout connectors. You can then connect the ESP32 display with sensors or modules & use it for any IoT applications. The ESP32 chip support Arduino or MicroPython programming.

There are two versions of ESP32 3.5″ TFT Touch Screen with Camera. One is the Capacitive Type and the other the resistive type. You can use any of the display that you want. The purchase Link for both the display is given below.

LovyanGFX Library is a library for LCD Graphics driver with touch for ESP32 and SAMD51. It supports the TFT Touch Screen Display like ILI9163, ILI9342, ILI9341, ILI9486, ILI9488, ST7735, ST7789, ST7796, SSD1351. Download and add this library to the Arduino IDE:

The given link contains the code/program folder for ESP32 TFT Touch Screen Display based 2048 video game. You can download the code and extract it. The select the ESP32 Board & upload the code to the ESP32 Board:

The given link contains the code/program folder for ESP32 ILI9488 TFT Touch Screen Display based Flappy Bird Video Game. You can download the code and extract it. The select the ESP32 Board & upload the code to the ESP32 Board: Source Code.