Wiring

It's easy to use display breakouts with Python and the Adafruit CircuitPython RGB Display module.  This module allows you to easily write Python code to control the display.

We'll cover how to wire the display to your Raspberry Pi. First assemble your display.

Since there's dozens of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported

Connect the display as shown below to your Raspberry Pi.

Note this is not a kernel driver that will let you have the console appear on the TFT. However, this is handy when you can't install an fbtft driver, and want to use the TFT purely from 'user Python' code!
You can only use this technique with Linux/computer devices that have hardware SPI support, and not all single board computers have an SPI device so check before continuing

ILI9341 and HX-8357-based Displays

2.2" Display

  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later.
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later as well.
  • Vin connects to the Raspberry Pi's 3V pin
  • GND connects to the Raspberry Pi's ground

2.4", 2.8", 3.2", and 3.5" Displays

These displays are set up to use the 8-bit data lines by default. We want to use them for SPI. To do that, you'll need to either solder bridge some pads on the back or connect the appropriate IM lines to 3.3V with jumper wires. Check the back of your display for the correct solder pads or IM lines to put it in SPI mode.

  • Vin connects to the Raspberry Pi's 3V pin
  • GND connects to the Raspberry Pi's ground
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later.
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later as well.
These larger displays are set to use 8-bit data lines by default and may need to be modified to use SPI.

ST7789 and ST7735-based Displays

1.3", 1.54", and 2.0" IPS TFT Display

  • Vin connects to the Raspberry Pi's 3V pin
  • GND connects to the Raspberry Pi's ground
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.

0.96", 1.14", and 1.44" Displays

  • Vin connects to the Raspberry Pi's 3V pin
  • GND connects to the Raspberry Pi's ground
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.

1.8" Display

  • GND connects to the Raspberry Pi's ground
  • Vin connects to the Raspberry Pi's 3V pin
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • LITE connects to the Raspberry Pi's 3V pin. This can be used to separately control the backlight.

SSD1351-based Displays

1.27" and 1.5" OLED Displays

  • GND connects to the Raspberry Pi's ground
  • Vin connects to the Raspberry Pi's 3V pin
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.

SSD1331-based Display

0.96" OLED Display

  • MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
  • CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
  • D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later.
  • RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later as well.
  • CS connects to our SPI Chip Select pin. We'll be using CE0
  • Vin connects to the Raspberry Pi's 3V pin
  • GND connects to the Raspberry Pi's ground

Setup

You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling SPI on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!

If you have previously installed the Kernel Driver with the PiTFT Easy Setup, you will need to remove it first in order to run this example.

Python Installation of RGB Display Library

Once that's done, from your command line run the following command:

  • sudo pip3 install adafruit-circuitpython-rgb-display

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

If that complains about pip3 not being installed, then run this first to install it:

  • sudo apt-get install python3-pip

DejaVu TTF Font

Raspberry Pi usually comes with the DejaVu font already installed, but in case it didn't, you can run the following to install it:

  • sudo apt-get install ttf-dejavu

Pillow Library

We also need PIL, the Python Imaging Library, to allow graphics and using text with custom fonts. There are several system libraries that PIL relies on, so installing via a package manager is the easiest way to bring in everything:

  • sudo apt-get install python3-pil

That's it. You should be ready to go.

This guide was first published on Aug 29, 2012. It was last updated on Aug 29, 2012.

This page (Python Wiring and Setup) was last updated on Jul 09, 2021.

Text editor powered by tinymce.