Control Your Displays with the Arduino_GFX Library

The Arduino_GFX library is a versatile option that works with a wide range of displays and Arduino-compatible boards.

Cameron Coward
a year agoDisplays

Adding a display to your microcontroller project is a great way to show logged data, a device's status, and much more. There are a lot of affordable displays on the market that connect to development boards, including those made by Arduino. Those displays most often connect through an SPI, I2C, or parallel data connection. But microcontrollers don't have plug-and-play display drivers like a computer; you have to program the microcontroller with exactly what bits and bytes to send to the display to draw the desired pixels. That isn't a trivial undertaking, but libraries can help. The Arduino_GFX library is a versatile option that works with a wide range of displays and Arduino-compatible boards.

The Arduino_GFX library takes chunks of code from several others popular libraries, including Adafruit_GFX, LovyanGFX, TFT_eSPI, Ucglib, and others. SPI connections should work with most Arduino-compatible microcontroller development board that have hardware SPI support and parallel connections should work several other Arduino-compatible, AVR-based boards that have enough available pins. Tested boards include the Arduino Nano, Arduino Pro Micro, ESP8266-based boards, ESP32-based boards, and the new Raspberry Pi Pico. There are a huge range of supported displays, including those with popular driver chips like the ILI9341, SSD1351, and ST7789. Arduino_GFX currently supports 8-bit SPI, 9-bit SPI, 8-bit parallel, and 16-bit parallel.

As with the Adafruit_GFX library, you can use Arduino_GFX to draw text, individual pixels, lines, rectangles, triangles, circles, and arcs. The idea is that you combine those shapes to create the graphics that you need. Bitmaps and other images are not supported. There are two reasons you might want to use Arduino_GFX over other libraries: it is easier to use and it is faster. You don't have to mess with header files at all, just declare your data bus and your display. Then you can use a series of simple functions to draw whatever you want. This library also performs well, because it doesn't read from the display's memory. In the creator's tests, Arduino_GFX was much faster than Adafruit_GFX — in some cases it took fewer than half the number of cycles to draw a shape.

If you want to use Arduino_GFX, the library is available on GitHub or through the Arduino IDE's Library Manager. A tutorial is available to walk you through the basics of working with the library.

Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles