E-paper screens are a thing of beauty. They require no power unless changing states, and they can be read, no matter how much sunlight enters a room. Blacks appear black and there is no backlight bleed. In my opinion, this makes them much more suited for at-a-glance screens than the LCDs found on Google Home and Amazon Alexa devices.
Developer ofilis on GitHub wanted to pack as much information on their 4.2″ e-paper screen from Waveshare as possible, and was kind enough to share their code and designs with the rest of us. In this article, I will be taking a look at the project, and introducing you to perhaps your next ESPHome project.
Table of Contents
- A Waveshare e-paper display powered by ESPHome
- What the Waveshare e-paper displays using ESPHome
- A 3D-printed case for a Waveshare e-paper display and ESP32
- Code for the ESPHome-powered e-paper display
A Waveshare e-paper display powered by ESPHome
At the heart of this project is an e-paper display from Waveshare, who sells models from 1.54″ up to 7.50″. The 4.20″ model used in this project has a resolution of 400×300 pixels. With 119 ppi, this model becomes a retina display at a distance of 74 cm, meaning that you will barely be able to see individual pixels if it's sitting on your desk at arm's reach.
[amazon box="B075GKHSPQ" title="Waveshare 4.2″ raw e-paper display " template="vertical" button_detail="https://s.click.aliexpress.com/e/_9A2zzC" button_detail_text="AliExpress"][/amazon]
[amazon box="B075XRVNYZ" title="Universal e-paper raw panel driver HAT" template="vertical" button_detail="https://s.click.aliexpress.com/e/_9zfrHs" button_detail_text="AliExpress"][/amazon]
Powering the e-paper display is an ESP32, though this project should also be possible using an ESP8266. Only the largest Waveshare e-paper displays require the more powerful microcontroller due to its expanded RAM. To be able to drive the display, a universal e-paper raw panel driver HAT, also from Waveshare, is required. This is down to the display used for this project. Waveshare sells both display modules and raw displays. The latter do not include any panel drivers, whilst the modules do. Using the separate driver HAT does give you more flexibility, as it is attached to the screen using a ribbon cable.
What the Waveshare e-paper displays using ESPHome
Front and centre of this information display is the current weather, date, and time. The weather is simplified using a large icon alongside the current outdoor temperature and chance of rain. Below the current weather is the forecast for the next three days.
To the weather's left are various sensor readings, such as the temperature of individual rooms, and current status of the printer ink. To the weather's right are the times for sunrise and sunset, alongside the wind strength and rain precipitation.
To wards the bottom of the e-paper display, the status of two presence sensors and three door/window sensor displayed. Icons are once again used to make these readable at a glance.
A 3D-printed case for a Waveshare e-paper display and ESP32
To complete the project, and hide its nerdiness, the creator decided to 3D-print a case into which all the components can be placed. To not have to design their own, they went with a model that is freely available on Thingiverse. The only downside of this model is that it is meant for battery-powered projects and as such is bigger than need be. Perhaps the creator intends to add batteries later on. After all, one of the advantages of e-paper displays is their low power-draw.
If you fancy a different design but can't be bothered with creating it yourself, there are many options available on 3D-model sharing sites. One example is this more compact case I also found on Thingiverse.
Code for the ESPHome-powered e-paper display
There are two components to this project's code and, thankfully, the creator has published both. The first includes the Home Assistant configuration and the second is the code for ESPHome, which is used to pipe sensor data to ESPHome and subsequently to the display.
Home Assistant configuration for the e-paper screen
To replicate this project, you will need to have set up both the
time_date platforms in Home Assistant. Additionally, you will need to have a weather integration set up. Based on these two platforms, over 25 template sensors are created, such as extracting the temperature, precipitation, wind strength, and more in to individual sensors. When looking at the code, keep in mind that the creator uses the Turkish language, and you might need the help of a translation app to understand everything.
ESPHome configuration for the e-paper screen
If you have ever worked with screens in ESPHome, you will know that you need to add any fonts you wish to use manually. The creator of this project went with Google Sans (bold and medium) and also the Material Design Web Icons.
It is the ESPHome YAML, though, were the fun starts. Even if you aren't planning on replicating this project, there is much to be learnt here. The individual sensors previously created in Home Assistant are all configure and made ready to be displayed.
Next, the display configuration is where the complexity starts. Each state, such as whether the weather component is cloudy, foggy, snowy, etc. needs to be set up individually. There are also a handful of presence and door/window sensors included, which need an individual configuration, dependent on their state. This is one of the best examples of how to configure a Waveshare e-paper display in ESPHome, I have found so far.