Display tiny movies on your Pi

Lead Image © Dietmar H pfl, 123RF.com

Show Time

Get a tiny color display working on a Raspberry Pi, so you can show your own movies.

In a recent Raspberry Pi Geek article [1], I showed how to make short videos for small, portable Raspberry Pi-powered devices, such as my fourth-generation Steampunk conference badge (Figure 1).

Figure 1: Steampunk conference badge.

This time, I'll explain how to get that little 1.8-inch TFT color display [2] working on a Raspberry Pi, so you can show your own movies. Maybe you'd like to build your own conference badge, a video picture frame, or a small animated sign. The Rasp Pi is definitely fast enough to run videos at 30 frames per second on the little screen.

Parts of the System

My conference badge runs on a Raspberry Pi 2 (RPi2) Model B [3]. Fortunately, you can successfully use small TFT displays with the earlier Raspberry Pi 1 (RPi1) model B+, as well, by simply moving the microSD card, keyboard, mouse, and cables over to the RPi1 and then restarting everything. There's no lag or problems running videos with either model.

Prototyping was done on Raspbian Wheezy [4]. The build is very straightforward, and I've had great results. I'll cover that in a minute.

You might want to consider not moving up to the latest Raspbian Jessie release, because the application that plays a movie – MPlayer [5] – has been swapped out for the now unsupported MPlayer2. At the time of writing, the required FBDev modules for MPlayer2 were not installed in the release, so the application refused to play a movie on a tiny display using the framebuffer. It works fine for an HDMI-attached big screen in an X window-based desktop, just not on a small LCD running as a framebuffer.

I spent considerable time trying to troubleshoot the problem and was unable to find a way to get MPlayer2 to work. Even worse, the regular MPlayer application isn't offered as an option in Jessie. As a result, when working with the small LCD displays connected to the GPIO pins, you should stick with Wheezy until the problem has been sorted out. Using Wheezy is a practical solution, and it's absolutely capable of providing a great wearable-device experience, especially on the quad-core, 1GB RAM-equipped RPi2.

With the general software strategy defined, you'll next need to build a cable to connect the Pi to the TFT display.

I built my cable from an old 40-pin PC IDE hard drive ribbon connector, some repurposed 22-gauge wire from a Category 5 (CAT5) cable, and a 10-pin female connector. Take the retainer off the ribbon connector and gently remove the ribbon cable from the pins. I then soldered the CAT5 wires to the tiny pins using a 25-watt soldering iron. A "helping hand" device was instrumental in lining the tiny wires up to the tiny connector pins.

The plastic around the pins and wire insulation melt quickly, so use as little heat as possible when making the connections. A traditional magnifying work light is also invaluable for getting the right wire on the right connector. Figure 2 shows a close-up view of the connector that attaches to the Pi.

Figure 2: A close-up view of the connector.

Being able to swap parts around quickly is important, because I have a number of different projects in the works at any one time, and I usually don't have boxes of extra TFT displays and other components just lying around. Using parts in multiple projects is a fact of my technology writing life. Happily, connectors are cheap, and I go to the little extra effort of using them on everything to facilitate rapid prototyping of my mix-and-match tech project schemes.

You'll need 10 wires going from the Pi 40-pin connector to the TFT display's 10-pin terminator (Figures 3 and 4). I split a couple of CAT5 cables and extracted the pairs, covered one end with tape, and snaked them through a length of 3/8-inch thick woven paracord, with the inner core removed. The covering gives an antique Steampunk look to the cord on my conference badge. I lightly melted the ends of the cover, to keep it from unraveling. Some tightly wound wire kept the ends from bunching toward the center of the cable.

Figure 3: The 10-pin connector end and how it attaches to the TFT display.
Figure 4: How to wire the cable (see also Table 1).

Table 1

Wiring Connections

>Wire Color

10-pin Connector #

LCD Breakout Pin

Rasp Pi Pin #

Rasp Pi Pin Name





GPIO 18 (GPIO-Gen 1)

























Not used





GPIO24 (GPIO_Gen 5)





GPIO25 (GPIO_Gen 6)





3.3V (DC Power)






Rapid Wheezy Hacking for Framebuffer Videos

I started with a clean build of Raspbian Wheezy on a 32GB Samsung EVO+ microSD card. To begin, you should download the image and expand it in its own directory and then copy the image over to the microSD card [6].

Insert the card in the slot and mount the device on the desktop, then use the df command in a terminal to get the device name. You should see something like what is shown in Listing 1, with the /dev/mmcblk0p2 (or similar) being the operative entry.

Listing 1

Output of df Command

rob % df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        92G   14G   74G  16% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            2.0G  4.0K  2.0G   1% /dev
tmpfs           396M  816K  395M   1% /run
/dev/sda6       129G   60M  122G   1% /disk6
/dev/sda7        92G   60M   87G   1% /disk7
/dev/mmcblk0p2  7.3G  5.0G  2.0G  72% /media/rob/13d368bf

Create a new directory and copy the downloaded TAR file to that directory:

mkdir raspbian
cd raspbian

The file is around 1GB in size, so be sure to download it with a fast Internet connection. Next, expand the .zip file into an image that you'll burn on the SD card:

unzip 2015-05-05-raspbian-wheezy.zip

The result will be a .img file of a little more than 3GB in size.

It's important to copy the image over to the proper partition on the SD card. Make sure you use the bootable partition and not put it somewhere else. In the example df result (Listing 1), that would just be the /dev/mmcblk0 part, not including the p0 part, which represents another non-bootable partition. Also, make sure to unmount the card before proceeding. Go onto the Linux desktop, right-click on the card icon and select unmount.

Next, image the card:

sudo dd bs=4M if=2015-05-05-raspbian-wheezy.img of=/dev/mmcblk0

Copying the image onto the card should take about three to five minutes. When completed remove the card from the Linux notebook and insert it into the Raspberry Pi's card slot. Apply power, and you'll immediately go into the raspi-config app.

Table 2 shows the settings I changed while in raspi-config. Pay particular attention to expanding the filesystem, enabling SSH, and enabling/loading the SPI drivers. If you forget to expand the filesystem, installing the display drivers from the rpi-update process will fail with an out-of-disk-space error.

Table 2

Configuration Settings in raspi-config




Expand the filesystem



Change user password


<Your new password>


Change Keyboard Layout


Keyboard Model

Logitech Generic


Keyboard Layout

English (US)



Use default



No compose key


Ctrl+Alt+Backspace to kill X?




Set to Pi2

Advanced Options











SPI enabled at reboot?





Enabling SSH lets you log into and control the RPi2 remotely without a monitor, such as in a wearable conference badge situation. Once the Rasp Pi reboots, log in to the command line in a terminal.

The kernel drivers included in Raspbian Wheezy must be installed before they'll work, which is accomplished with an rpi-update to the firmware. Make sure you have connectivity to the Internet; otherwise, the update will fail here, as well. Fortunately, Raspbian uses the wired Ethernet connection, out of the box, so this shouldn't be a problem if you can connect a cable to the Rasp Pi and the router. Alternately, you'll have to log in to the Pi while hooked up to a monitor to set your access point and WiFi passcode.

Running rpi-update is straightforward:

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update

You'll also have to reboot for the firmware updates to take effect:

sudo shutdown -r now

Once you log back in, start the TFT framebuffer:

sudo modprobe fbtft_device name=adafruit18

Keep an eye on the LCD screen, and you should see the backlight come on after a short period. If you have a 2.2-inch display, use adafruit22 as the device name. Other displays have similar designations.

The next step installs MPlayer:

sudo apt-get install mplayer

You'll also need a short video file to display on the color LCD. I had some on my Linux notebook, in my drtorq directory and copied them over to the Raspberry Pi:

cd drtorq
rcp nano-video.mp4 pi@

To run the video on the display, the magic formula is:

mplayer -nosound -loop 0 -vo fbdev2:/dev/fb1 -x 160 -y \
  128 -zoom -flip -vf rotate 1 /home/pi/nano-video.mp4

I didn't really care too much about audio on the movie, thus the -nosound option. To make the video loop indefinitely, set the loop option to 0; otherwise, use a number or exclude the option for a single pass. The zoom, flip, and rotate options configure the screen for proper viewing orientation, as do the -x and -y size values.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content