Cheap TFT display for Raspberry Pi


In one of our recent projects we needed a cheap and small screen for the Raspberry Pi so it could be made portable. I recently stumbled upon the ili9488 by www.mcufriend.com from AliExpress and at only 8$ I just bought one straight away. When the display arrived I realized that I should have done a quick google search on how to get it working with the Pi before buying. It was not straightforward to use!

Several guides shows how to get the display working where you use a custom kernel image or simply flash a modded version of Raspbian.

While this solution works it comes with two critical drawbacks. Firstly, the kernel used is old and does not contain the same drivers as you will find in newer versions of Raspbian, in our case it removed the WiFi Adapter drivers we were using. Secondly, you will not be able to do a system update via sudo apt-get update in the future as this will overwrite the custom image and leave you with a useless screen and a Raspberry Pi with a questionable OS.

So to avoid these issues we set out to find a better, less invasive solution to get the ili9488 working on the Raspberry Pi.

How to get the ili9488 TFT display to work without changing kernel or flashing a custom version of Raspbian.

A lot of credit should go to Notro for creating FBTFT Driver which is the basis for getting the display working.

A note of caution. We have tested this on a Raspberry Pi B+. The trick should work on A and B models as well and might work on Raspberry Pi 2. Please leave a comment if anyone tries this out.

Guide

Start a terminal on your Raspberry Pi and run the following command:

sudo nano /etc/modules

this will open the modules file in an text editor.

Next step is to add the following snippet to the end of the file:

fbtft_device name=flexpfb rotate=180 fps=60 gpios=dc:18,reset:7,wr:17,cs:4,db00:22,db01:23,db02:24,db03:10,db04:25,db05:9,db06:11,db07:8
flexfb width=480 height=320 buswidth=8 init=-1,0xb0,0x0,-1,0x11,-2,120,-1,0x3A,0x55,-1,0xC2,0x33,-1,0xC5,0x00,0x1E,0x80,-1,0x36,0x28,-1,0xB1,0xB0,-1,0xE0,0x00,0x04,0x0E,0x08,0x17,0x0A,0x40,0x79,0x4D,0x07,0x0E,0x0A,0x1A,0x1D,0x0F,-1,0xE1,0x00,0x1B,0x1F,0x02,0x10,0x05,0x32,0x34,0x43,0x02,0x0A,0x09,0x33,0x37,0x0F,-1,0x11,-1,0x29,-3

Exit the editor and save the modules file Open cmdline.txt in the editor by running the following command

sudo nano /boot/cmdline.txt

Now you need to enable the Boot Splash Screen and set the framebuffer environment variable by adding the following snippet before “rootwait” in the cmdline file. It is important that the snippet is added to the same line as the existing commands

fbcon=map:10 fbcon=font:VGA8x8 FRAMEBUFFER=/dev/fb1

Save and exit the file.

Finally you have to install the framebuffer driver by running

sudo apt-get install xserver-xorg-video-fbdev

Then create the file /usr/share/X11/xorg.conf.d/99-fbdev.conf by running:

sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf

This will open the file in an editor and allow you to add the following section to the file.

Section "Device"  
  Identifier "myfb"
  Driver "fbdev"
  Option "fbdev" "/dev/fb1"
EndSection

Save the changes you made to the file and exit the editor

Lastly all you need to do is reboot your PI

sudo reboot

And your done. Now all there is left is to go out and use our new Raspberry display for something fun.

Image of TFT display working on Raspberry Pi

Final notes

This guide shows you how you could use the framebuffer for other things than just showing the xserver https://github.com/notro/fbtft/wiki/Framebuffer-use



By: Tobias Alrøe