Setup Raspberry Pi With AdaFruit's PiTFT Display
by jeff.cartwright.562 in Circuits > Raspberry Pi
11247 Views, 30 Favorites, 0 Comments
Setup Raspberry Pi With AdaFruit's PiTFT Display

NOTE: Because it is out-of-date, this instructable should not be used. Please use AdaFruit's Easy Install.
Setup Raspberry Pi to work with Adafruit's PiTFT display.
This instructable uses a MacBook Pro and specialized USB cable instead of a monitor, keyboard and mouse to set up a Raspberry Pi.
I am very excited by the PiTFT display and want to add it to many of my home automation projects. The first step is to get it running so I can add it to other projects.
Project Goals:
- Set up Adafruit's PiTFT display to run on the Raspberry Pi
Notes:
- text enclosed in spades, like this ♣replace-this♣ should be replaced with an actual value
- I’ve attempted to credit every source used. My apologies for any omissions.
- $ indicates a command executed in a terminal window on the MacBook and usually is being executed on the Raspberry Pi
- I tried unsuccessfully to get PiTFT to run on Diet-Pi
Gather Parts
I have found the parts below perform best in my applications. These parts are more expensive than contained in the usual starter kit.
Get parts and tools (prices in USD):
- MacBook Pro (a PC can be used)
- Ethernet cable, router, wireless access point and internet connection
- Raspberry Pi 2 Model B Element14 $35
- Panda 300n WiFi Adapter Amazon $16.99
- 5.2V 2.1A USB Power Adapter from Amazon $5.99
- Micro USB to USB cable 3ft from Amazon $4.69
- FTDI TTL-232R-RPI Serial to USB cable from Mouser $15
- SanDisk Ultra 16 GB microSDHC Class 10 with Adapter (SDSQUAN-016G-G4A) from Amazon $8.99
- PiTFT - Assembled 320x240 2.8" TFT+Touchscreen for Raspberry Pi Adafruit $34.95
Download Adafruit's Version of Raspbian With PiTFT Support
Download Adafruit's Raspian with PiTFT support:
- Download latest version of Adafruit's raspbian with PiTFT into your MacBook's download directory
- When this instructable was written the latest version was: 24 September, 2015 jessie
- Move image 2015-09-24-raspbian-jessie-pitft28r.img from downloads to a directory where you store images:
♣your-macbook-image-directory♣
For example, I use:
$ cd "/Users/♣my_macbook_name♣/Desktop/wifiEnabledHome/Raspberry Pi setup/raspbian images"
Burn Raspbian Image to Micro SD Card
IMPORTANT: make sure you type in the correct disk number – if you enter the wrong disk number, you will wipe out your hard disk!
Insert a micro SD card into SD Adapter, and then insert the SD adapter into MacBook.
On MacBook use these instructions from Raspberry Pi. Summarized here:
- Open MacBook terminal window
- Change to directory containing raspbian image
$ cd ♣your-macbook-image-directory♣
- Identify the disk (not partition) of your SD card
- In this case, disk2 (not disk2s1) or disk# = 2
- To identify your micro SD card, run the command:
$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *160.0 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS ♣my_macbook♣ 159.2 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *2.5 GB disk1 1: Apple_partition_map 1.5 KB disk1s1 2: Apple_HFS ♣my_dvd♣ 2.5 GB disk1s2 /dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *15.5 GB disk2 1: Windows_FAT_32 NO NAME 15.5 GB disk2s1
- From the above, my SD micro card is disk# 2
- Unmount your SD card by using:
$ diskutil unmountDisk /dev/disk♣micro-SD-card-disk#♣
- Copy the image to your SD card. Ensure the image name and disk # are correct.
$ sudo dd bs=4m if=2015-09-24-raspbian-jessie-pitft28r.img of=/dev/rdisk ♣micro-SD-card-disk#♣
- CTRL-t to see the status of the copying.
- If there are errors, try different values for bs option, such as, 1m, 4m, or 1M. Larger Block Sizes (bs) are required for larger drives. Lowercase m seems to be preferred by MacBook.
- When complete, unmount the SD Card:
$ diskutil unmountDisk /dev/disk♣micro-SD-card-disk#♣
- Remove SD adapter from MacBook and remove micro SD card from adapter
- Insert micro SD Card in Raspberry Pi
Raspberry Pi Connections

Insert these into Raspberry Pi
- Micro SD card
- Ethernet cable
- Wi-Fi dongle
- USB serial I/O cable (see images above)
- Ground = Black wire, pin 06 on RPi
- Tx = Yellow wire, pin 08
- Rx = Red wire, pin10
Once the above are complete:
- Insert power cable
Insert USB/Serial cable into MacBook USB port
Downloads
Determine USB Port
Determine USB Port being used by USB-Serial adapter. My MacBook uses a chip from FTDI.
Open terminal window
There are a lot of devices in /dev. Use this command to identify the device:
$ ls /dev/tty.* /dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-FT9314WH
Here is an alternate way to discover:
$ ls /dev | grep FT | grep tty tty.usbserial-FT9314WH
If neither of the above work, then try this:
Insert USB cable into MacBook, and run:
$ ls /dev | grep tty
Unplug USB cable, wait a few seconds and run:
$ ls /dev | grep tty
Identify the differences
Open Terminal Window and Connect to Raspberry Pi
Connect MacBook to Raspberry Pi using USB serial cable.
Open terminal window. See the image above and set up the terminal window preferences.
- Terminal, select Preferences, click Advanced tab
- xterm and vt100 work, but ansi works better when using nano
- Set Western ASCII instead of unicode (UTF-8))
In a terminal window enter:
$ screen /dev/tty.usbserial-FT9314WH 115200
Using terminal window on MacBook, login in to RPi: username = pi password = raspberry
Note: the USB-serial cable can drop characters. If characters are dropped you may not get a prompt, press Return or enter username and press Enter.
If recovery mode appears, then micro SD card is not set up correctly. Start over.
- The prompt for recovery mode is #
- Raspbian's normal prompt is $.
- NOOBS recovery login and password is: root and raspberry
Setup Raspberry Pi
Setup raspbian using raspi-config
$ sudo raspi-config
- Expand Filesystem
- And reboot (tab to Finish and hit Enter) and reboot
$ sudo raspi-config
Change user password to ♣your_new_password♣
Internalisation Options (I live in Central US time zone - change to suit your requirements)
- * indicates selected
- Use spacebar to toggle *
- For the US, change locale unclick GB (using space bar) and click US English UTF 8 (en_US.UTF-8 UTF-8)
- Click OK, select UTF and click OK
$ sudo reboot
When the MacBook terminal window gets messed up:
- Close the terminal window (close all terminal windows and exit terminal app)
- Unplug the USB cable from MacBook
- Wait a few seconds and plug the USB cable back in
- Start a new terminal window and login
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get auto remove $ sudo reboot
Continue to setup raspbian
$ sudo raspi-config
Internalisation Options
- Change time zone US and Central
- Tab to Finish and reboot
$ sudo reboot $ sudo raspi-config
Advanced Options
- Change hostname to ♣your_hostname♣
- Enable SSH
- Finish
- Reboot
Setup Raspberry Pi WiFi
Run the command:
$ sudo nano /etc/network/interfaces
and edit to contain only :
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid "♣your-ssid♣" wpa-psk "♣your-pass-phrase<♣"
CTRL-o to write file
ENTER to confirm write
CTRL-x to exit nano editor
Run the command:
$ sudo reboot
Setup Gmail
Mail is very useful for receiving notifications and alerts about issues on the Raspberry Pi.
Ensure repositories are up-to-date. Run the command:
$ sudo apt-get update
Install SSMTP and mail utilities:
$ sudo apt-get install ssmtp $ sudo apt-get install mailutils
Edit the SSMTP configuration file:
$ sudo nano /etc/ssmtp/ssmtp.conf
as follows:
root=♣your-gmail-account♣@gmail.com mailhub=smtp.gmail.com:587 hostname=♣your-hostname♣ AuthUser=♣your-gmail-account♣@gmail.com AuthPass=♣your-gmail-password♣ UseSTARTTLS=YES
Edit the SSMTP aliases file:
$ sudo nano /etc/ssmtp/revaliases
Create one line for each user in your system that will be able to send emails. For example:
root:♣your-gmail-account♣@gmail.com:smtp.gmail.com:587
Set the permissions of the SSMTP configuration file:
$ sudo chmod 664 /etc/ssmtp/ssmtp.conf
Connect PiTFT Display to Raspberry Pi
Run the command
$ sudo shutdown -h 0
Remove ethernet cable
Remove USB cable connectors from Raspberry Pi and from MacBook
Remove power supply
Attach PiTFT display to Raspberry Pi
Restore power supply
When the Raspberry Pi reboots, the display should work. You can stop now.
Backup the Micro SD Card
When Raspberry Pi is setup, then back up the image. Use this image to create the next project.
Also, backup the project when it is complete. If anything goes wrong with the SD card, then it is easy to restore it.
Shutdown the Raspberry Pi
$ sudo shutdown –h 0
Wait until the card has shutdown, and then remove the power supply, and then remove micro SD Card
Insert micro SD card into SD Adapter, and then insert the SD adapter into MacBook
On MacBook use these instructions from The Pi Hut with modifications as follows:
Open terminal window
Change to directory containing raspbian image
$ cd ♣your-macbook-image-directory♣
Identify the disk (not partition) of your SD card e.g. disk4 (not disk4s1). From diskutil output, = 4
$ diskutil list
IMPORTANT: make sure you use the correct – if you enter the wrong , you will end up wiping out your hard disk!
Copy the image from your SD card. Ensure the image name and are correct:
$ sudo dd if=/dev/disk♣micro-SD-card-disk#♣ of=♣your-macbook-image-directory♣/SDCardBackup♣description♣.dmg
CTRL-t to see the status of the copying.
When complete, unmount the SD Card:
$ diskutil unmountDisk /dev/disk♣micro-SD-card-disk#♣
Remove SD adapter from MacBook and remove micro SD card from adapter
Insert micro SD Card in Raspberry Pi
On the next project, use this image and skip many the steps in this instructable.
And you are done!