Using a round GC9A01 240×240 TFT display
I bought this little round 240×240 pixel TFT display from AliExpress:
Now all I needed to do was to figure out how to drive it using an Arduino MCU. This job was made much simpler thanks to a marvellous DroneBot Workshop article that described how to use a similar display.
Pinout
The display uses the SPI protocol (don't let the presence of SDA and SCL pins make you think it's I²C!). From left to right the pins have the following meaning:
Pin | Purpose |
---|---|
RST | Reset |
CS | SPI Chip Select |
DC | Sets the display into either Data or Command mode |
SDA | SPI COPI (Controller Out, Peripheral In) aka MOSI |
SCL | SPI Serial Clock |
GND | Ground |
VCC | Power supply: 3.3V |
Note that there is no SPI Controller In, Peripheral Out (CIPO aka MISO) pin since the SPI traffic is all from the controller to the display. In addition to the SPI connections there are also two control pins: RST & DC.
Test Circuit
The following breadboard wiring diagram shows how to connect the display to an Arduino Uno.
The Uno is powered via its USB connection. An external 3.3V power source is provided for the display. It might be possible to power the display from the Uno's 3.3V output, but I prefer not to use the Uno to supply power.
Because the Uno is 5V and the display is 3.3V, a logic level converter is required to convert the Uno's 5V signals to 3.3V for the display. Here a TXS0108E 8 channel logic level converter is used. The "A" side must be used as the 3.3V side and the "B" side must be used as the 5V side.
Here is a picture of the circuit as built and operating:
Source Code
The demostration code was compiled and uploaded using the Arduino IDE v2.
The code is a slightly modified copy of that provided with the Adafruit GC9A01A library. This idea came from the DroneBot Workshop article mentioned above. There are six steps to get the code running:
-
Ensure the Adafruit GC9A01A library, and all its dependencies are installed in the Arduino IDE.
-
Load the
graphicstest
example sketch from the IDE's File | Examples | Adafruit GC9A01A | graphicstest menu option. -
Look just below the line:
#else // ALL OTHER BOARDS - EDIT AS NEEDED
to locate the line that begins:
#define TFT_DC
and ensure that
TFT_DC
is defined to be the Arduino pin that is connected to the display's DC pin. In our case we need pin 7:#define TFT_DC 7
-
Turn on the 3.3V power supply.
-
Connect the Uno to a USB port on the computer that is running the Arduino IDE.
-
Compile and upload the sketch to Uno.
The Adafruit demo should now run. Some of the output will be truncated because the code was written for a square display and so some of the display is off screen on the circular display.