Testing the Adafruit PyPortal touchscreen
Display Deluxe
Unlike other displays for the Raspberry Pi, Adafruit's PyPortal touchscreen provides an autonomous environment, including a microprocessor, sound output, and a WiFi connection.
The Raspberry Pi has a hard time with small displays because support from Raspbian is surprisingly poor. Creating and implementing suitable interfaces is difficult with a dearth of off-the-shelf programs for controlling small displays. I'm quietly confident that the PyPortal intelligent touchscreen by Adafruit is a better solution.
PyPortal (Figure 1) is a small 3.2-inch networkable resistive touch display with an integrated microprocessor [1]. At $55 (EUR59), it is not exactly cheap, but considering its components, the price seems reasonable. A correspondingly sized 3.2-inch display plus a Pi Zero W with an SD card, at about the same price, will serve as a comparison with the PyPortal configuration.
PyPortal in Detail
The screen takes up almost all of the real estate on the front, with a mounting frame and a brightness sensor on the right side. Adafruit has cut costs on the display itself. The resolution of 320x240 pixels is more suitable for 2.8-inch devices. Resistive touch technology is also a way of saving cash, but it does mean you need a stable mounting – just touching the screen is not enough, you actually have to press it.
The PyPortal is now available in two other sizes. The PyPortal Pynt for $45 reduces the screen diameter to 2.4 inches with the same number of pixels; the 3.5-inch PyPortal Titano offers a resolution of 320x480 pixels, plus a USB C power connection for $60.
The back of the display (Figure 2) accommodates, among other things, an ATSAMD51J20 CPU by Atmel. It is supported by the far larger ESP32 WiFi coprocessor by Espressif. These popular modules provide WiFi at a low cost. The ESP32 takes on the computationally intensive TLS/SSL encryption protocol, thus reducing the burden on the Atmel CPU. Its Cortex-M4 processor runs at 120MHz and has 1MB of flash memory for program code and 256KB of RAM. Additionally, 8MB of flash memory is available for other resources, such as images or sounds.
In addition to the previously mentioned light sensor, the PyPortal's features include a reset button, a temperature sensor, a miniature speaker with an amplifier, a microSD slot, a neopixel LED, an I2C port, and two ports for additional sensors. The last three ports also provide power and ground.
Mostly because of the extensive equipment, it's not surprising that the intelligent display has been very well received in the maker scene. Adafruit also designs the hardware, so you can adapt it to your own ideas. For example, if you need a better loudspeaker, just interrupt the defined conducting path and connect your own.
Besides the PyPortal, Adafruit also sells a matching minimalist display stand. However, both Adafruit and the community have already designed various cases that are available on popular 3D printing portals. You will find the stand from Figure 1, for example, on Thingiverse [2].
Getting Started
To put the display into operation, all you need to do is connect it to a 5V power supply with a micro-USB plug. CircuitPython runs on the Cortex-M4 processor; Adafruit has implemented a small example program, but it throws errors because the WiFi chip fails to connect to the home network without an SSID and password. Before you adapt the program, though, you will want to update the firmware.
Both firmware updates and program changes are handled over the USB cable, which you connect to a PC instead of a power supply for this purpose. Choose a cable that is not too long and of good quality; in particular, do not use a mere powercable. If you press the reset button once, the PyPortal reboots; if you press it twice, it switches to firmware update mode.
In both operating modes, the display provides its program memory as a drive. In normal operation, it goes by the name CIRCUITPY; in update mode the name is PORTALBOOT. On Linux, the device files known from USB storage media appear with a small difference: In operating mode, PyPortal announces itself as a partitioned mass storage device with the device name /dev/sd<X>1
; in update mode it claims to be an unpartitioned stick named /dev/sd<X>
.
On Linux, first check to see whether the drive has been mounted automatically. If this is the case, eject it and remount it with the command:
$ sudo mount -o sync /dev/sd<X> /mnt
The sync
option ensures that all files are immediately written to the PyPortal. To install the firmware update, first download the current version, and then simply copy the file with the .uf2
suffix to the drive. The board then reboots, the PORTALBOOT drive disappears, and the CIRCUITPY drive appears.
Details of the update and, more specifically, links to the current firmware and how to work with CircuitPython can be found in the Adafruit [3] documentation. At the end of the day, working with the PyPortal is no different from working with other CircuitPython boards.
Figure 3 shows the layout of the files in operation mode. The root directory contains the code.py
file, which contains the Python code of the main program that runs in an infinite loop, and the lib/
subdirectory contains libraries. Other files and directories depend on the application.
Weather Geek
Adafruit's sample program, as supplied with the product, retrieves a saying from a web server at regular intervals and shows it on the display. To log in to your WiFi network, the program needs the access credentials, which you enter in the secrets.py
file. On closer inspection, the program turns out not to be very instructive, because it hides all the magic in the PyPortal
class. This prompted me to develop a project of my own to illustrate how to display images and text.
The PyPortal is best suited for receiving and visualizing data. The program will query the weather from wttr.in. This slightly different kind of weather portal provides an ad-free weather report on the command line and is based on the Go program wego
; fans of ASCII art will definitely get their money's worth. Figure 4 shows a deluxe version of its output. In a terminal window, you can call up this weather forecast for your location by typing curl wttr.in
. Typing curl wttr.in/:help
shows the syntax.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.
-
CachyOS Adds Support for System76's COSMIC Desktop
The August 2024 release of CachyOS includes support for the COSMIC desktop as well as some important bits for video.
-
Linux Foundation Adopts OMI to Foster Ethical LLMs
The Open Model Initiative hopes to create community LLMs that rival proprietary models but avoid restrictive licensing that limits usage.
-
Ubuntu 24.10 to Include the Latest Linux Kernel
Ubuntu users have grown accustomed to their favorite distribution shipping with a kernel that's not quite as up-to-date as other distros but that changes with 24.10.