This is only a preview of the August 2016 issue of Silicon Chip. You can view 42 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Touchscreen-Controlled Energy Meter, Pt.1":
Items relevant to "Compact 8-Digit Auto-Ranging Frequency Meter":
Items relevant to "Micromite Plus & The Explore 64 Module":
Purchase a printed copy of this issue for $10.00. |
Add a 7-inch
touchscreen to
your Raspberry Pi
By Greg Swain
If you want to turn your Raspberry Pi (RPi) into a completely selfcontained unit, then this 7-inch (18cm) Touchscreen Display is
the answer. It’s a cinch to hook-up and get going, has a bright 800
x 480 pixel display and includes a mounting kit so that you can
attach the RPi module to the display’s metal back-plate.
Y
OU MIGHT think that adding a
touchscreen display to your Raspberry Pi (RPi) would be complicated
but it’s not. Basically, it’s just a matter
of plugging two captive flat-ribbon cables from the display into the supplied
adaptor board, connecting a separate
flat ribbon cable between the adaptor
board and the RPi’s DSI (digital serial
interface) socket, adding a couple of
power supply leads and that’s it.
There’s no software (apart from operating system updates) to add and it
80 Silicon Chip
should all start working the moment
you apply power to boot the RPi. You
can add a virtual keyboard if you wish
but more on that later.
What’s in the kit
As well as the 7-inch Touchscreen
Display and the aforementioned adaptor (or driver) board, the kit includes
the DSI ribbon cable, four M2 x 12mm
spacers, four M2 screws and four
jumper wires. Only two jumper wires
(for the power supply) are required
for later RPi models (Model A+, B+,
RPi2 & RP3) but the early Model A and
Model B boards require the remaining
two jumpers to be added (see below).
No instructions are supplied with
the kit but there’s lots of assembly
information online, including on
the element14 website – see www.
element14.com/community/docs/
DOC-78156/l/raspberry-pi-7-touch
screen-display
There’s also an excellent video of the
assembly process here: https://www.
siliconchip.com.au
The first step in the assembly is to lay the adaptor PCB and the display panel
upside down and connect the wide ribbon cable from the panel to the Panel 2
socket. The narrow ribbon cable is then connected to the Panel 1 socket on the
other side and the adaptor PCB attached to the back of the display.
raspberrypi.org/blog/the-eagerlyawaited-raspberry-pi-display/
Update the software
The latest versions of Raspbian
include all the software and drivers
necessary to operate the Touchscreen
Display. For this reason, it’s a good idea
to update your RPi’s operating system
before attaching the unit.
To do this, make sure your RPi is
connected to the internet, then SSH or
VNC into your RPi (or connect it to a
keyboard, mouse and monitor), open
a command window and type:
sudo apt-get update
Once the updates have downloaded,
do the following:
sudo apt-get upgrade
sudo reboot
This will install all the latest drivers
and software necessary to support the
7-Inch Touchscreen Display.
While you are at it, you may as well
install the virtual keyboard, as follows:
sudo apt-get install matchbox-keyboard
sudo reboot
Hardware assembly
The first step in the assembly is to lay
both the adaptor board and the display
upside down and plug the wide ribbon
cable from the display into the Panel 2
socket. For the uninitiated, it’s not just
a matter of pushing the cable into the
socket though. Instead, you first have
to release the little plastic locking bar
siliconchip.com.au
and that’s done by gently pulling on it
to slide it out. The cable is then pushed
into the socket and secured by sliding
the locking bar back in.
Once that’s done, the adaptor board
is flipped over, laid on the back of the
display and the narrow ribbon cable
plugged into the Panel 1 socket. As before, it’s secured using a locking bar after making sure that the cable has been
pushed all the way into the socket.
By the way, the touchscreen LCD is
supplied with a protective plastic film.
This should be left in place during the
assembly to prevent scratches.
The next step is to attach the adaptor
board to the back of the display using
the four M2 x 12mm spacers. The DSI
cable is then plugged into its socket
(silver contacts facing up) and the red
and black jumper cables plugged into
the +5V and GND pins on the adjacent
connector (see photo).
After that, it’s just a matter of securing the RPi module to the spacers
using the four M2 screws, connecting
the DSI cable (silver contacts facing
inwards) to its DSI socket and plugging in the red & black supply cables
into pin 2 (+5V) and pin 6 (GND) on
the RPi’s GPIO port.
RPi Models A & B
RPi Model A/B modules don’t have
the required I2C outputs on the DSI
bus to communicate with the driver
board. The way around this is to use
the two extra jumper wires provided to
connect the SDA and SCL pins on the
adaptor board’s GPIO header to SDA
(pin 3) and SCL (pin 5) respectively
on the RPi’s GPIO header.
Use the green wire to connect from
The 15-way DSI cable is plugged into
its socket on the driver PCB with its
contacts facing up. This close-up view
also shows the 5V supply output leads
which run to pins 2 & 6 on the RPi’s
GPIO header.
SDA on the adaptor board to pin 3 on
the RPi’s GPIO header. The yellow
wire is then connected from SCL on
the adaptor board to pin 5 on the RPi’s
GPIO header. Note that these connections are NOT required on later model
RPi modules (A+, B+ Pi2 or Pi3).
There’s one more step here: by default, DSI display detection is disabled
on early A/B RPi boards, so it has to be
enabled at boot time. To do this, SSH
or VNC into your RPi and add the following line to /boot/config.txt:
ignore_lcd=0
Power supply
You need to use a 5V DC plugpack
rated at 2A to power both the display
August 2016 81
The RPi module mounts on top of the spacers and the DSI cable and supply leads connected
to complete the assembly. Note that the supply cables have been left disconnected here so that
the adaptor board and the RPi module could be powered from separate plugpacks – see text.
and the RPi. This should be plugged
into the PWR IN micro-USB socket on
the adaptor board. DO NOT use the
RPi’s micro-USB port; the display consumes around 400mA and you could
exceed the maximum current rating
of the RPi’s polyfuse if you do.
The adaptor board supplies 5V
power to the RPi via the jumper cables plugged into the latter’s GPIO port
(pins 2 & 6). Alternatively, you can de-
lete these jumper wires and connect a
USB-to-micro-USB cable between the
adaptor board’s PWR OUT socket and
the RPi’s PWR IN socket.
Yet another possibility is to power
the display and the RPi from two separate plugpacks (ie, delete the jumper
wires or USB cable).
Booting up
When you boot the RPi, it will au-
tomatically detect the Touchscreen
Display and use that as the default.
The display should begin working as
soon as power is applied and once the
RPi has booted, you should have full
touchscreen operation.
If it doesn’t work, check that all
the cables have been properly seated
in their sockets. Check also that the
power supply is rated at 2A if using it
to power both the display and the RPi.
Default monitor
Because the Touchscreen Display is
now the default, this his means that if
a monitor is also plugged into the RPi’s
HDMI port, it will be ignored. If you
want to keep an HDMI monitor as the
default, just add
display_default_lcd=0
to the /boot/config.txt file. It’s also
possible to use both display outputs
at the same time – see https://www.
raspberrypi.org/blog/the-eagerlyawaited-raspberry-pi-display/
Using the virtual keyboard
The virtual keyboard is easy to install (see text) and is accessed by tapping Menu
–> Accessories –> Keyboard. It makes it easy to enter web addresses and to edit
files, etc without having to connect an external keyboard or to access the RPi via
VNC from another computer.
82 Silicon Chip
Touching Menu –> Accessories –>
Keyboard brings up the virtual keyboard as shown in the screen grab at
left. You can elect to always have this
keyboard above other open windows
by clicking on the keyboard symbol at
siliconchip.com.au
Compatibility Issues
Between Raspberry Pi
Touchscreen & GPIO port
When testing this screen, we discovered that the Raspberry Pi has
some problems accessing the GPIO
pins while the touchscreen is plugged
in. Pins 3 & 5 on the GPIO port are
shared with pins 13 & 14 on the display connector. These pins form an
I2C serial bus and are labelled SDA0
and SCL0.
Basically, this means that if you
try to use pins 3 & 5 on the GPIO
connector for any other purpose, the
touchscreen will go blank and refuse
to work. Unfortunately, the software
that we used to set up outputs #1 and
#2 for the “4-Input Temperature Sensor PCB For The Raspberry Pi” (May
2016) did just that.
In order to get the screen to work,
we had to delete (or rename) the dtblob.bin file that’s installed in the
RPi’s /boot folder, as described in
May 2016. In addition, we had to comment out the line that we had added
to /etc/rc.local (ie, the line beginning
with “python”).
As a result, you will no longer be
able to set outputs #1 and #2 at boot,
although outputs #3 and #4 can still be
used, as described in the May 2016
issue. The DS18B20 temperature sensors can also still be used as normal
with the touchscreen connected, as
described in SILICON CHIP for March
& May 2016.
Updated software scripts archived
in RPiTempMonV2.zip are available on
the SILICON CHIP website. Do not install dt-blob.bin but edit /etc/.rc.local
as before.
top, left of the keyboard window, then
selecting Layer –> Always On Top.
Display stand
To be of real use, the assembly needs
some kind of case or stand and there
are several that can be purchased online. For example, element14 have a
full enclosure at http://au.element14.
com/multicomp/cbrpp-ts-blk-wht/
raspberry-pi-touchscreen-enclosure/
dp/2494691 Another case and stand is
at www.modmypi.com/raspberry-pi/
cases/7-touchscreen-cases/raspberrypi-7-touchscreen-case-plus-stand
Alternatively, take a look at the
siliconchip.com.au
The virtual keyboard can be resized and can also be configured so that it always
sits on top of other open windows (just click the keyboard symbol at top left of
its window and select Layer –> Always On Top).
A variety of stands for the completed
assembly are available from various
sources on the internet.
Pimoroni website at https://shop.
pimoroni.com/products/raspberrypi-7-touchscreen-display-with-frame
They have a very attractive transparent acrylic stand which is available
in six different shades: orange, red,
green, blue, purple and black. A Pimoroni case is also available from Core
Electronics – see http://core-electronics.com.au/pimoroni-raspberry-pi7-touchscreen-display-case-noir.html
Yet another very attractive stand
is at https://www.adafruit.com/product/2033 It’s just $US14.95 (plus shipping).
Rotating the display
Depending on the stand or enclo-
sure that’s chosen, you might find that
the display is upside-down when the
panel is in position. If so, simply add
lcd_rotate=2
to /boot/config.txt then reboot the RPi
and you won’t have to stand on your
SC
head any longer.
Where To Buy The
Touchscreen Display
The RPi 7-Inch Touchscreen Display
can be purchased from Altronics,
Wiltronics Research and element14.
Check their respective websites for
further details.
August 2016 83
|