Create an information center with the Raspberry Pi Pico W and Python

Pocket Sized

© Lead Image © donatas1205, 123RF.com

© Lead Image © donatas1205, 123RF.com

Article from Issue 277/2023
Author(s):

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).

Figure 1: A lean, mobile information display fits anywhere and is frugal in terms of resources.

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.

Figure 2: Thanks to the protruding front on the panel, you can do without a separate cover frame.

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.

Figure 3: The Thonny IDE is ideally suited for integrating various Python interpreters.

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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Recycled E-Ink

    Combining open firmware with recycled hardware, Inkplate launches a crowdfunding campaign for an open source e-paper display.

  • Pico Sleep Mode

    The Raspberry Pi Pico's high-performance chip is trimmed for I/O and does not try to save power. However, a few tricks in battery mode can keep it running longer.

  • Greenhouse Control

    You can safely assign some greenhouse tasks to a Raspberry Pi Pico W, such as controlling ventilation, automating a heater, and opening and closing windows.

  • enTourage eDGe combines Netbook with E-Reader

    Why should you buy a Netbook and a Kindle when you can buy a device that combines the two? According to the company enTourage, you can easily do just that for $500 with their new eDGe, which even comes with Linux.

  • Light Painting

    In the photographic method of light painting, you expose a subject over an extended period of time while moving the light sources. With a little technical support from a Raspberry Pi Pico, you can achieve sophisticated results.

comments powered by Disqus
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.

Learn More

News