2.8 inch capacitive touch PiTFT display

Adafruit's 2.8 inch capacitive touch screen is used on the Geiger Counter and the Alarm Clock Radio.

Equipment:

  • Raspberry Pi 3 running raspbian

    • set to boot to desktop

    • with hostname set to ♣hostname♣

  • 2.8 inch capacitive touch PiTFT display

  • 16 male to female jumper cables

Step 1. Setup Raspberry Pi

Step 2. Power down Raspberry Pi

Power down the Raspberry Pi

$ sudo shutdown now

Wait (about 30 seconds) for the lights on the Raspberry Pi 3 to stop blinking and then unplug the power from the wall

Remove the power plug. I unplug power from the wall or USB-A side rather then from the Raspberry Pi or HiFiBerry AMP 2 to lessen wear and tear on those components.

Remove the HDMI cable.

Step 3. Mount PiTFT on Raspberry Pi 3

For the Geiger Counter, follow the Easy Install Instructions

For the Alarm Clock Radio, follow these instructions:

The HiFiBerry AMP 2 does not allow for the PiTFT to be mounted on the Raspberry Pi. So, instead jumper male to female jumper cables will be used from HiFiBerry AMP2 to the PiTFT.

The HiFiBerry AMP 2 pins are not really pins, but a much cheaper version (i.e., they aren't square but flat). When attaching the female jumpers, rotate until it makes a solid contact.

Jumper cables allow better positioning for the Alarm Clock Radio.

Note: With the PiTFT face down and the GPIO pins facing up, the PiTFT pins are flipped (left-to-right) when compared to the Raspberry Pi 3. So, RPi3 has 2-1 at bottom, but PiTFT has 1-2 at the bottom.

Start with the Ground pin first

16 male-female jumpers are required. The Raspberry Pi 3 pins used by the PiTFT are:

Pin 3 I2C1 SDA

Pin 5 I2C1 SCL

Pin 11 GPIO #17 - tactile button

Pin 13 GPIO #27 - tactile button

Pin 15 GPIO #23 - tactile button

Pin 17 3.3V

Pin 19 GPIO #10 SPI MOSI

Pin 21 GPIO #9 SPI MISO

Pin 23 GPIO #11 SPI CLK

Pin 25 Ground

Pin 4 5V

Pin 12 GPIO #18

Pin 16 GPIO #23 - tactile button

Pin 18 GPIO #24 RT_INT

Pin 22 GPIO #25

Pin 24 GPIO #8 SPI CE0

Pin 26 RT_CS_3V

Pin 32 GPIO #12 goes to PiTFT pin 12

Once the pins are connected, restore power to the RPi3.

Step 4. Easy Install

Open a terminal window on a MacBook and ssh into the Raspberry Pi

$ ssh pi@♣hostname♣

Follow the Easy Install instructions for AdaFruit's 2.8 inch capacitive touch PiTFT display: AdaFruit's easy install instructions

These are the commands to run in the MacBook's terminal window:

$ cd ~

$ wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh

$ chmod +x adafruit-pitft.sh

$ sudo ./adafruit-pitft.sh

When the script starts, here are my selections:

3. PiTFT 2.8" capacitive touch (240x320)

1. 90 degrees (landscape)

Would you like the console to appear on the PiTFT display? [y/n] n

Would you like the HDMI display to mirror to the PiTFT display? [y/n] y

REBOOT NOW? [y/N] y

During development, it is a bit easier see the 2.8in display is mirrored to a larger monitor

Step 5. Four tactile buttons

Pin 12 (GPIO 18) is used by the HiFiBerry AMP 2 and so it cannot be used by the PiTFT. However, the PiTFT uses GPIO 18 as the control over the backlight display. So, instead use pin 32 (GPIO 12) on the HiFiBerry AMP 2 and Raspberry Pi by connecting it to pin 12 on the PiTFT.

Login to the Raspberry Pi and open a terminal window, and then run the command to download a script to demonstrate the buttons:

$ wget "https://raw.githubusercontent.com/dumbo25/tkinter-alarm-clock-radio-gui/master/pitft_buttons.py"