I recently bought a 3.5" TFT touchscreen display for my Raspberry Pi. The display connects via the GPIO pins and fits neatly onto the form factor of the Raspberry Pi 3. The idea was to add a GUI application onto the Pi, which had until now been acting as a headless web and application server.

After the screen and case are installed. I still need to take off the protective film.

The installation of the hardware was straightforward, but setting up the Pi to display onto the new LCD didn’t go so well. It turns out this LCD, and many similar ones, ask you to enable the LCD via scripts in the LCD-show project. On my first attempt, I simply ran the relevant script ( LCD35-show ) as requested, but I ended up not being able to connect to my WiFi anymore!

I found out the scripts mess with a number of system files, overwriting configurations that are integral to the operation of the Pi. The overwritten files are based on the ones provided by Raspbian, so ideally not much should be changing. However, the new files are based on older versions of Raspbian. Additionally, the scripts do much more than they need to.

As a second attempt, I read through the script and applied the changes manually based on my understanding of what was needed to enable the LCD. Below are my notes taken during the process.

Enabling the 3.5" display

Each of the following steps is based on a set of commands in the original script. For reference, here’s the LCD35-show script I used, in the state it was in at the time of writing. The files to copy over are in the same repository, so start by cloning the directory onto your Raspberry Pi:



# from Github

git clone

cd LCD-show # If you don't have git, you can download the files directly# from Githubgit clone https://github.com/goodtft/LCD-show.git cd LCD-show

Copy over boot overlays

In the original script, the same file is copied over under two different names. In the next step (“Enable interfaces”), the .dtbo file is referenced, albeit without the file extension, so only that file should be required.

The file does not exist in the /boot/overlays directory, so it's safe to copy it over.

sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/tft35a.dtbo

Enable interfaces

A particular boot config file is copied over. The changes are minimal, and to avoid making unexpected changes, the changes should be made manually.

# Don't run. See notes below to make changes manually.

# sudo cp ./boot/config-35.txt /boot/config.txt

Using raspi-config , enable the following interfaces:

SPI

I²C (may not be needed, see below)

Serial (may not be needed, see below)

Edit: Reddit user farptr points out that SPI is the one used for driving the display, and the I²C interface is used for the touchscreen. I experimented with the interfaces, and in my case, only SPI was required for both the display and touchscreen functionality. I recommend turning these interfaces on one by one in to see which ones your display needs.

Uncomment the line that says:

# uncomment if hdmi display is not detected and composite is being output

#hdmi_force_hotplug=1

Finally, enable the overlay from the previous step by adding the following line at the end. I like to add a comment to remind myself of where the overlay comes from and why it needs to be applied:



# provided by the LCD-show project and must be copied over to the /boot/overlay

# directory.

#

# See:

dtoverlay=tft35a # Enable the TFT LCD by applying the appropriate boot overlay. This overlay is# provided by the LCD-show project and must be copied over to the /boot/overlay# directory.# See: https://github.com/goodtft/LCD-show dtoverlay=tft35a

As a side note, the dtoverlay line can include a rotation parameter. It turns out the default value is 90°, and since I wanted to use display upside down, I changed the rotation to 270°:

dtoverlay=tft35a:rotate=270

At this point, you can verify no further changes need to be made by diffing the now altered config.txt with the reference one that was supposed to be copied over:

diff /boot/config.txt ./boot/config-35.txt

There will still be some differences, but they are only in the ordering of lines and in comments. (And possibly the rotation parameter if you included one.)

Update cmdline.txt

This file is used to pass arguments to the kernel prior to initialization. The original script uses the presence of partition #7 on the SD card ( /dev/mmcblk0p7 ) to determine if we're running NOOBs or not. If we're not, we'd be copying over the standard cmdline.txt file, and if we are, the following section still applies.

# Don't run. See notes below to make changes manually.

# sudo cp ./usr/cmdline.txt /boot/

We don’t actually want all of the changes, so we’ll make the following changes:

Add the following options (all on the same line):

fbcon=map:10 fbcon=font:ProFont6x11

I’m not sure what exactly the first option does, but it’s the main change required to show the console on the LCD. Perhaps the font-related option is not necessary, but again, I don’t know.

In particular, we don’t want to make the following changes:

Leave the console=serial0,115200 option as is. The reference file changes serial0 to ttyAMA0 . The Raspberry PI has two UARTs, and ttyAMA0 refers to one of them. However, the primary UART differs based on the Raspberry Pi model (namely based on if the model comes with built-in Bluetooth and WiFi). serial0 can be used to reference the primary one for the current model.

option as is. The reference file changes to . The Raspberry PI has two UARTs, and refers to one of them. However, the primary UART differs based on the Raspberry Pi model (namely based on if the model comes with built-in Bluetooth and WiFi). can be used to reference the primary one for the current model. Leave the root option as is. The reference file specifies /dev/mmcblk0p2 as the root partition, but newer versions of Raspbian refer to the root partition by a UUID. In fact, this is the difference between the non-NOOBS and NOOBS version of the reference file, so simply avoiding this change means you don’t have to worry about which distribution you’re using.

option as is. The reference file specifies as the root partition, but newer versions of Raspbian refer to the root partition by a UUID. In fact, this is the difference between the non-NOOBS and NOOBS version of the reference file, so simply avoiding this change means you don’t have to worry about which distribution you’re using. Don’t remove the fsck.repair=yes option. This is unrelated to the LCD, which is why we won't bother removing the option.

option. This is unrelated to the LCD, which is why we won't bother removing the option. Don’t add the logo.nologo option. Again, this is unrelated to the LCD, so if you want to keep the default behavior, there’s no need to remove the logo.

Reboot

At this point, the TFT LCD is set up. If you just want a display for the console, you can reboot.