Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Turn Your Raspberry Pi 2 Into a Tablet

DZone's Guide to

Turn Your Raspberry Pi 2 Into a Tablet

A step-by-step guide on how to add an LCD touchscreen to a Raspberry Pi 2 and install a virtual keyboard.

· IoT Zone
Free Resource

I use my Raspberry Pi’s usually with an external VGA or HDMI monitor. How cool would it be to use a touch LCD screen instead?

Raspberry Pi 2 with 7 Inch Touchscreen

Normally I use an external monitor for my Raspberry Pi projects. But this is rather bulky, and for a home automation project I want to have something smaller.

Raspy with external monitor

Raspy with external monitor

I already use a wireless mini keyboard/touchpad to reduce the space needed:
Raspy with mini keyobard

There are several display solutions on the market for Raspberry Pi today, but what finally convinced me was the Raspberry 7″ Touch Pi Foundation Display (https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-display/) which I have ordered.

The Display board gets attached to the back of the LCD:

Mounted Display Board

Mounted display board

Because the display does not come with a case, I had ordered a display frame from Adafruit (https://www.adafruit.com/products/2033):

Adafruit Display Frame with Cover on

Adafruit display frame with cover on

Three layers of acrylic build up the frame:

Adafruit Acrylic Display Frame

Adafruit acrylic display frame


The Raspberry board gets mounted on top of the LCD board. There are multiple power options for the display, for now I’m using the 5V and GND from the Raspberry board:

Powering Display with Jumper Cables

Powering display with jumper cables

The board itself is behind the frame: 

Raspberry Pi Frame Backside

Raspberry Pi frame backside

Enabling the Display

By default, the Raspy still uses the HDMI output. To install the updates for using the display, I have to use:

sudo apt-get update

Followed by:

sudo apt-get upgrade

Then reboot it:

sudo reboot

Rotating the Display

For me, the display was upside-down  (rotated 180°):

Wrong Display Orientation

Wrong display orientation

To rotate it back, I added the following to /boot/config.txt based on the FAQ:

lcd_rotate=2

Edited config.txt

Edited config.txt

With this, everything was fine after a reboot:

Rotated Raspberry Pi Display

Rotated Raspberry Pi Display

Virtual Keyboard

To be able to enter text on the Pi with the display, I have installed a virtual keyboard. I used:

sudo apt-get install matchbox-keyboard

Then reboot with:

sudo reboot

After reboot I have a virtual keyboard in the Accessories menu:

Raspy Virtual Keyboard

Raspy virtual keyboard

This opens the virtual keyboard layout:

Virtual Keyboard

Virtual keyboard

Screenshot with Virtual Keyboard

Screenshot with virtual keyboard

It works ok for small things, but clearly it does not replace a real keyboard for me.

Switching Back to HDMI Display

With above setup, the Raspberry Pi uses the touch LCD as the default display. But sometimes it is good to have a larger screen. To switch back to the HDMI port by default, I need to edit the following line in /boot/config.txt:

display_default_lcd=0

Dual Display Use

Currently it seems that it is only possible to use a second monitor e.g. to play videos, see “Dual Display Usage” in https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-display/. I have not found a way to have run two displays in true ‘extended’ mode. The latest information I have found on this topic is here: https://www.raspberrypi.org/forums/viewtopic.php?f=108&t=120541

Summary

The 7″ Raspberry Pi foundation touch LCD is a cool extension for the Raspi, turning it into a kind of tablet computer. With the display frame and stand I can have it on my desk and do not need an extra keyboard, mouse and display. Using the Raspy with the touch display works well for larger UI item (buttons, menus), but is hard to use for smaller UI items like to minimize windows. For this, a wireless USB mouse or touch area is better. The virtual keyboard is better than nothing, but again for typing text a real keyboard is better.

I’m not so happy with the "bare" Pi board on the backside of the LCD frame. I wanted to use the acrylic case (see picture at the beginning of this post), but the mounting screws were not long enough, so I first need to buy new mounting screws.

Anyway, I want to use the display to show information and to implement a home automation system. For this, it could be an ideal solution. More to write about that project I guess in a future post. :-)

LINKS

Topics:
iot ,raspberry pi ,microcontroller ,touchscreen

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}