480-503-4295

Configuring Screen Resolution with Raspberry Pi

This application note is part 1 of our 2 part TFT LCD screen series. Part 1 discusses configuring the screen resolution of a TFT with a Raspberry Pi. Part 2 discusses calibrating the touch screen of a TFT. Click here to read part 2.

1. Introduction

This application note discusses how to setup a TFT touch screen display with Raspberry Pi. The display chosen for this project is a 7-inch LCD with a capacitive touch feature. The display has 1024×600 pixels of resolution and when calibrated for the Raspberry Pi can display 16.7M colors. With a few changes to the Raspberry Pi configuration files the dimensions of this display can be matched for perfect resolution. 

The display in this project is easy to interface with the Raspberry Pi because it has an LVDS to HDMI backpack adapter connected. This makes it simple to connect an HDMI cable between the two devices and begin your project. In a few steps any display can be configured for optimal resolution. Additionally, this display has a capacitive touch screen which can be calibrated through Raspberry Pi for accuracy. These features combined with the large size of the display make it a great choice for a variety of Raspberry Pi projects.

The display in this project is E70RA-HW520-C. Here are the details of the display:

Features:

  • 7”, 165.0×100.0mm 
  • 1024(RGB)x600 pixels
  • Controller: EK73215/EK79001
  • 6/8-bit LVDS Interface
  • HDMI connection
  • Capacitive Touch Screen
  • I2C CTP Interface
  • CTP Driver: GT9271

For more information about this display, check out the datasheet.

2. What You’ll Need

A list of the materials used in this project need are detailed below.

 Qty DescriptionNote
 1 Raspberry Pi 3 with USB Power AdapterRaspberry Pi 
 1 7-inch TFT Display Focus LCDs
 1 HDMI Cord 
 2 Micro-USB Cable 
 1 Wireless Mouse and Keyboard 
 1 Ethernet Cable 
 1 32MB MicroSD Card with NOOBS Installed  NOOBS

3. Connecting to the Raspberry Pi

Connecting the TFT to the Raspberry Pi is simple and only requires a few steps. The display has a HDMI connection backpack interfaced with the device so there is no need for soldering or individual pin connections. If you have used Raspberry Pi before, you will notice that the connection to the TFT is standard and straightforward. Before powering the Raspberry Pi you should make all the necessary connections to the screen. Plug in the HDMI. Connect the CTP port with a micro-USB cable. Power the screen with micro-USB cable connected to a USB port on the Raspberry Pi or a power adapter that provides 5V. You only need three connections to the HDMI backpack module on the TFT.

Figure 1: e70ra-hw520-c-hdmi-board

You will need a mouse and keyboard to setup the Raspberry Pi before the touch screen is enabled. You will also need a micro SD card with Noobs loaded onto it before powering. (Installing NOOBS) Lastly you will need an ethernet cable to setup internet to download or update the software. Once you power the Raspberry Pi, Noobs will give you some options of what software platform you want to install. For this project I chose Raspbian (recommended option). (Installing Raspbian) After installation you will likely notice that the graphics are distorted or that the width and height of the screen are not the desired dimensions. This is because Raspberry Pi’s auto-calibrate feature doesn’t recognize this display. So, to get the best picture, we will need to calibrate it manually.

4. Calibrating the Resolution

There are a couple ways to fix the resolution.

If it’s not terrible, and you can still see what you’re doing on the display, you can do this through Terminal. We want to edit the “config.txt” which loads from the boot file. The other option is to remove the SD card and load the file on the computer or setup SSH and edit the file remotely.

First open Terminal and execute the following command to open the config.txt file:

sudo nano /boot/config.txt

Figure 2: sudo-nano-boot

The file will open in a text editor called nano. We need to add the specifics of our display to the file by adding the following commands to the file:

hdmi_force_hotplug=1
hdmi_cvt=1024 576 60 3 1 0 0
hdmi_mode=87
hdmi_group=2
hdmi_drive=2

The hdmi_cvt command creates a custom CVT mode. The input is defined:

hdmi_cvt=

The last three fields of hdmi_cvt can be omitted, and they will refer to the default values. The other commands declare the use of HDMI and create a new mode for the hdmi_cvt specifications. For detailed information on these commands and others that function in the config.txt file refer to the Raspberry Pi documentation website.

Figure 3: hdmi-force-hotplug

Save these changes and reboot the system.

CTRL O (Write Out) → CTRL X (Exit)

sudo reboot

The resolution is now defined for our display once rebooted. 

If the screen is still not perfectly configured for the device, a few other tweaks can be made to the config.txt file. Adjust the overscan parameters to add or remove pixels on the edges. For example, adding 33 pixels to the “overscan_right” parameter corrects overflow of the image on the right side of the screen. This takes a few trial and error attempts to perfect.

disable_overscan=1       #erases default overscan values

overscan_right=33

Figure 4: overscan-right

If you want to power the display through the Raspberry Pi instead of an external power source, you can add the following command:

max_usb_current=1

This sets the output current at 1A from the USB ports on the Raspberry Pi.

5. Troubleshooting

If the display is still not configured correctly there are a few things you may want to check in the config.txt file.

  • hdmi_safe is OFF.

Verify that hdmi_safe is not being used. hdmi_safe=1 should be commented in the file.

→ # hdmi_safe=1

When this command is used it will take precedence over the resolution changes made and revert to the preset HDMI safe mode values and resolution.

  • Display only functions in hdmi_safe mode?

If you notice that turning safe mode off results in a blank screen you could have a bad HDMI connection. First try another HDMI cable. If this does not fix the problem, then we can increase the signal strength of the HDMI by editing the config_hdmi_boost command in the config.txt file. The standard setting in the configuration file is set as:

→ config_hdmi_boost=4

This default value is 2 and can be increased up to 11 if necessary. Try adding this command at increased increments until the issue is solved. You will need to edit the config.txt file on your computer or remotely for this step.

  • Consult Raspberry Pi’s configuration documentation for further information on changes that can be made to the config.txt file. (website)

6. Summary

With only a few changes to the Raspberry Pi’s default configuration file the TFT can become compatible with the Raspberry Pi. This display is a great choice for interfacing with the Raspberry Pi because it has an HDMI connection type which makes for any easy setup. After the resolution and is set to a desired value we can now optimize the touch feature of the display. See here for more information on how to further calibrate this display.

DISCLAIMER

Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”) understand and agree that Designers remain responsible for using their independent analysis, evaluation and judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety of Designers’ applications and compliance of their applications (and of all FocusLCDs products used in or for Designers’ applications) with all applicable regulations, laws and other applicable requirements.

Designer represents that, with respect to their applications, Designer has all the necessary expertise to create and implement safeguards that:

(1)     anticipate dangerous consequences of failures

(2)     monitor failures and their consequences, and

(3)     lessen the likelihood of failures that might cause harm and take appropriate actions.

Designer agrees that prior to using or distributing any applications that include FocusLCDs products, Designer will thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.