Create an information center with the Raspberry Pi Pico W and Python
Pocket Sized
You don't need much to create a smart home information center – just a Raspberry Pi Pico, an ePaper panel, a battery, and some Python.
People want a variety of information presented in the same place. On the road, a smartphone plays a central role for most. At home, you might have legacy displays for heating control, an alarm system, a weather station, and so on. A common display is useful for grouping data from different sources without the need to call up different apps or read the data in different places. A Raspberry Pi Pico W lets you build your own model.
A home automation solution already collects many useful values. For this sample project, I added news and a weather forecast through a connection to the Internet. To make the device compact and mobile, it has a battery. The display and controller need to be frugal in terms of power consumption, which is where the Pico W comes in handy. It connects to the WiFi network, collects the information, and displays it on a small screen (Figure 1).
I deliberately kept the controls as simple as possible. Three screens show the news, weather, and home temperatures; where needed, screens branch out into submenus. I did not want to switch the various actuators of the home automation system – simply display their status.
I specifically prioritized minimal power consumption, which is why I chose the Waveshare 2.9-inch CapTouch ePaper display module for the Raspberry Pi Pico [1]. It has a slot for the Pico at the back, which in turn supports touch operation, and as with the Pico, you can switch the miniscreen to sleep mode. The complete circuit can be disconnected from the battery during extended periods of disuse. So I wouldn't need to change the battery, I used a lithium-ion polymer (LiPo) battery and charging electronics, which meant I was able to charge the device with a power supply unit over USB when required.
Pico W
The basis of the project is the Raspberry Pi Pico W and its Python firmware. Unlike the single-board computers (SBCs) in the Raspberry Pi family, the microcontroller requires very little preparation. To program the microcontroller unit (MCU), you just need to connect it to a computer over USB. In the development phase, the controller can be fed external commands in an integrated development environment (IDE) such as Thonny. You only transfer the finished code to the module at the end.
One advantage of microcontrollers over computers is their robustness. You don't run the risk of damaging a storage medium by turning it off abruptly; this feature is useful for the current project.
Layout
The Pico W slots in at the back of the ePaper panel. The protruding front of the touch variant of the 2.9-inch panel (Figure 2) proves to be useful for the construction, removing the need for an additional covering frame. Slotted into a recess in the case, everything looks neat from the front. During the installation, you need to work quite precisely to use the narrow adhesive border: Take care not to damage the delicate connections from the printed circuit board (PCB) to the display panel.
The goal of the build was to keep the case as flat as possible, so it can be used as a tabletop variant and as a wall unit. The Pi Pico's slot at the back of the ePaper doesn't prove to be conducive to a low build height; therefore, it makes sense to position the LiPo battery at the side. You can choose flatter batteries that involve some sacrifices in terms of capacity, but they are still powerful enough for a few days of runtime. LiPo batteries are compact and lightweight and will survive many hundreds of charge cycles – ideal for this small device.
The number of components is manageable (see the "Parts List" box). You also need to assign some space for the charging electronics, which incidentally also act as a DC/DC converter for converting the LiPo battery's 3.7V to 5V operating voltage. I also integrated a separate on-off switch. I did not want to use the buttons on the ePaper module; instead, the device is controlled by touch input only during operation. In the end, I only had to provide an opening for the USB charging port.
Parts List
- Raspberry Pi Pico W
- ePaper panel (Waveshare Pico CapTouch ePaper 2.9)
- LiPo battery (1000mAh)
- Pimoroni LiPo shim for Pico charging electronics
- Alternative 5V power supply
- Case
- Push-button switch
- Wiring, installation material
Control
The circuitry is controlled by a script on the Pico. As usual, before applying the supply voltage, pressing the BOOTSEL button of the Pico opens a window in the file manager where you place your program text. This operation works smoothly in both Linux and Windows environments. The Python firmware expects a file named main.py
, which in this case already contains all the libraries needed.
If you do not want to switch manually between mass storage and programming mode every time, you will appreciate a development environment such as Thonny (Figure 3). At first glance it seems relatively simple, but turns out to be extremely convenient when integrating various Python interpreters. On the Pico, it is absolutely my favorite tool.
The project requires Internet access for the display. After the first start-up, registering the display (or the Pico) as a supported device on the WiFi network in the settings of the home router and assigning it a permanent local IP address and unique name is recommended. In the test phase, a USB connection from the PC to the Pico is sufficient and supplies the attached display with power, as well.
The script [2] shows three screens from different sources. NEWS lists headlines from national news providers, WEATHER uses weather data from the weather service. HOME presents values from the home server.
For further processing, you need to import data in XML and JSON formats for the news and the weather forecast. In the Python script, you can do this easily without having to include additional classes with elaborate import filters. Of course, if the provider changes, this means making adjustments to match.
For the values around the house (e.g., the temperatures of the individual rooms, the outdoor area, or the aquarium), my home automation solution provides its data as files that have been prepared on my own server for the sake of simplicity. I just need to read the files.
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
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.