adafruit tft display raspberry pi made in china
The Raspberry Pi ecosystem is extremely versatile, with developers finding endless uses for the popular single-board computers (SBCs). One popular use for the Raspberry Pi is turning it into a retro games console, which is where something like the Adafruit Color TFT Bonnet comes in.
The Adafruit 1.3 " Color TFT Bonnet for Raspberry Pi to give it its full name, the extension board feature more than just a 1.3-inch colour IPS display. Adafruit has included a joystick and two pushbuttons too, with latter arranged like those in the Game Boy and Game Boy Color. The Adafruit does not include buttons that could be configured for Start and Select, though.
The IPS panel operates at 240 x 240 and can be controlled over SPI. According to the manufacturer, the board is compatible with all common Raspberry Pi variants, including the Pi Zero. There is also a Qwiic/STEMMA QT connector on the bottom of the board. Adafruit provides a kernel driver and Python library for the ST7789 chipset powering the board too.
The Adafruit 1.3 " Color TFT Bonnet costs US$17.50, with Adafruit offering bulk-buy discounts. The unit is out of stock for the time being, but the company will contact prospective buyers when it has produced another batch.
One thing I’ve learned over and over from working on the Raspberry Pi is that it’s most likely going to take a chunk of time to get things set up just the way you want. And this display is no different.
I’ve written in the past about How to Play HD Video on a Raspberry Pi — so this is a continuation from a Raspbian Linux distribution image already in that state. I was feeling lazy and didn’t want to write this post, but if I ever have to do this again I don’t want to have to google so many steps again. So hopefully you’ll find this useful as well.
First I tried the instructions from here: Adafruit: Detailed Installation before realizing the available manual has an auto-configure option. But I couldn’t get these working at first because the Debian package mirrors wouldn’t work so I had to modify my apt sources list to use some working mirrors. The download of the adafruit-pitft-helper package was still unavailable to me via apt but you can get it from Github.
You need to run this script adafruit-pitft-helper specifically to enable the console on your display. The manual instructions on their website do not tell you how to do this, only for enabling the display for the graphical interface X11. This script does the heavy lifting.
At this point the terminal is all set for your display. Following this I will show you how to enable high definition video playback on your TFT display from the command line. I won’t go into setting up the touchscreen for the X11 desktop, you can refer to the manual for that. Personally I don’t think the Raspberry Pi makes a good desktop system as it’s slow, I much prefer the console.
If you try the omxplayer from the previous blog post you’ll find the video doesn’t show up on the display. The reason is that it’s rendering on frame buffer 0 when the TFT is using frame buffer 1. To get around this you need to use frame buffer copying with the fbcp program. The instructions they provide are close but don’t follow the second modprobe command (as it messed up my display).
Now when you want to play a video you type omx myvideo.mp4 and it switches to frame buffer copying, plays the video given as the first parameter with omxplayer (taking advantage of GPU high speed graphics), after omxplayer exits fbcp is closed out with the killall command, we then clear the display of any visual artifacts left behind and we’re back to where we need to be with a nice looking display!
TheAdafruit Mini PiTFT - 1.3" 240x240 Color TFT Add-on for Raspberry Pi is your little TFT pal, ready to snap onto any and all Raspberry Pi computers, to give you a little display. The Mini PiTFT comes with a full color 240x240 pixel IPS display with great visibility at all angles. The TFT uses only the SPI port so its very fast, and leaves plenty of pins remaining available for buttons, LEDs, sensors, etc. It"s also nice and compact so it will fit into any case.
This display is super small, only about 1.3" diagonal, but since it is an IPS display, it"s very readable with high contrast and visibility. There was a little space on the top-left so Adafruit give you two tactile buttons on GPIO pins so you can create a simple user interface. On the bottom we have a Qwiic/STEMMA QT connector for I2C sensors and device so you can plug and play any of our STEMMA QT devices.
Using the display is very easy, we have a kernel driver and Python library for the ST7789 chipset. You can set it up as a console output so you can have text and user interface through the Raspberry Pi OS or you draw images, text, whatever you like, using the Python imaging library. Adafruits tests showed ~15 FPS update rates so you can do animations or simple video.
Comes completely pre-assembled and tested so you don"t need to do anything but plug it in and install our Python code!Works with any Raspberry Pi computer.
Raspberry Pi OS provides touchscreen drivers with support for ten-finger touch and an on-screen keyboard, giving you full functionality without the need to connect a keyboard or mouse.
The 800 x 480 display connects to Raspberry Pi via an adapter board that handles power and signal conversion. Only two connections to your Raspberry Pi are required: power from the GPIO port, and a ribbon cable that connects to the DSI port on all Raspberry Pi computers except for the Raspberry Pi Zero line.
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.
The error just seems to be with a couple of the Chinese characters used in the comments of the sketch. You can just ignore the error, the sketch will compile correctly in spite of it.
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).
In order to run this sketch, you’ll need to install another library. Install theTjpeg_DecoderLibrary from Library Manager. Once you do, the sketch will compile, and you can upload it to your ESP32.
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.
A parallel RGB interface up to 24 bits is available on all Raspberry Pi boards with the 40-way header (A+, B+, Pi2, Pi3, Zero) and the compute module. This interface allows to connect parallel RGB displays to the Raspberry Pi GPIO either in RGB24 (8 bits for red, green and blue) or RGB666 (6 bits per color) or RGB565 (5 bits red, 6 green and 5 blue).
This mode is accompanied by new overlays, which allow to produce an RGB signal thanks to the VGA666 (get the 666 passive VGA adapter for Raspberry-Pi B+ : code and hardware).
I changed the Adafruit libraries for TFT: GFX , TFTLCD and TouchScreen. I join all in this one library, the library SPFD5408, to avoid problems with duplicate libraries and enables also have the original library Adafruit ready for use in other projects with another TFT hardware.
As a 2inch IPS display module with a resolution of 240 * 320, it uses an SPI interface for communication. The LCD has an internal controller with basic functions, which can be used to draw points, lines, circles, and rectangles, and display English, Chinese as well as pictures.
The 2inch LCD uses the PH2.0 8PIN interface, which can be connected to the Raspberry Pi according to the above table: (Please connect according to the pin definition table. The color of the wiring in the picture is for reference only, and the actual color shall prevail.)
The example we provide is based on STM32F103RBT6, and the connection method provided is also the corresponding pin of STM32F103RBT6. If you need to transplant the program, please connect according to the actual pin.
The LCD supports 12-bit, 16-bit, and 18-bit input color formats per pixel, namely RGB444, RGB565, and RGB666 three color formats, this demo uses RGB565 color format, which is also a commonly used RGB format.
For most LCD controllers, the communication mode of the controller can be configured, usually with an 8080 parallel interface, three-wire SPI, four-wire SPI, and other communication methods. This LCD uses a four-wire SPI communication interface, which can greatly save the GPIO port, and the communication speed will be faster.
Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has 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.
2.We use Dev libraries by default. If you need to change to BCM2835 or WiringPi libraries ,please open RaspberryPi\c\Makefile and modify lines 13-15 as follows:
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.;
Python has an image library PIL official library link, it do not need to write code from the logical layer like C, can directly call to the image library for image processing. The following will take 1.54inch LCD as an example, we provide a brief description for the demo.
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.