Electronics Home Automation

Home Assistant remote ESP32 ePaper Display

Making a remote display using an ESP32 eInk ePaper module to show data from our Home Assistant system

Our Home Assistant setup now has over 340 sensor devices and entities and while the main user interface is very useful to view all the data, we would like to be able to have a smaller display in the house to show just two or three sensor values and have this accessible away from the desktop computers and tablets.

We wanted to show the Solar PV input in watts, the daily generation total and the temperature of the hot water cylinder. The display will be going into the kitchen so we can easily see if there is hot water available for cleaning or if we need to boil a kettle.

The remote display needed to have the following features:

  • Compact Size
  • Low Power Consumption
  • Battery Powered
  • WiFi
  • Use REST or MQTT for data
  • Black and White display
  • Refreshed every few minutes

An ePaper or eInk display module meets all these requirements and the modules are available with ESP32 WiFi microcontrollers and battery management built into the single circuit board.

After looking at various ePaper dispay modules we decided to order a DollaTek T5 V1.3 ESP32 2.9 inch EPaper Plus electronic ink screen development board from Amazon https://www.amazon.co.uk/gp/product/B07RXRX7V5/ which is a 2.9" e-paper module 296 x 128 pixels and runs on a ESP32 MCU.

ePaper Display Module
ePaper Display Module
ePaper Display Module with battery holder
ePaper Display Module with battery holder

The DollaTek T5 V1.3 is a rebranded Xinyuan LilyGO T5 2.9", version 2.2 display and this project is based on code and setup instructions from https://github.com/Xinyuan-LilyGO/LilyGo-T5-Epaper-Series and battery display from https://github.com/CybDis/Lilygo-T5-47-HomeAssistant-Dashboard/

The data for the display is fetched from Home Assistant https://www.home-assistant.io/ via the REST Api https://developers.home-assistant.io/docs/api/rest/ and displays sensor data on the epaper display.

Getting Started

The code for this project is available to download from github at https://github.com/briandorey/Home-Assistant-eink-remote-display.

  1. Install the following dependencies
  2. Copy all the folders in the lib directory to "C:\User\<YourName>\Documents\Arduino\libraries"
  3. In Arduino IDE, select ESP32 Dev Module in the development board, and keep the other options as default
  4. If you do not find the ESP32 series in the development board, then you should see the following installation method How to install ESP32 in ArduinoIDE
  5. In your Home Assistant install, select the profile page and generate a new Long-Lived Access Tokens

Configuration

In epaperdisplay/epaperdisplay.ino update the following lines to your wifi and network settings.

// Network Settings
const char* ssid = "YOURWIFISSID";
const char* password = "YOURWIFIPASSWORD";
/* Put StaticIP Address details */
IPAddress local_ip(192.168.1.1); // Set static IP
IPAddress gateway(192.168.1.1); // Set network Gateway IP
IPAddress subnet(255, 255, 255, 0); // Set static IP
IPAddress primaryDNS(8, 8, 8, 8);   //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

Enter your Home Assistant IP address and access token.

// Home Assistant IP and token key
const char* ha_ip = "192.168.1.10";
uint16_t ha_port = 8123; // Could be 443 is using SSL
const char* ha_pwd = "YOURTOKEN";  //long-lived password. On HA, Profile > Long-Lived Access Tokens > Create Token

Set your sleep period in minutes between the display updates

// deep sleep configurations
long SleepDuration   = 1; // Sleep time in minutes

Overnight sleep mode (optional)

The DoNightSleep() function allows you to sleep the display for a selected number of hours, line 137 sets the number of minutes to sleep, the code is set ass 540 which is 9 hours.

 SleepTimer = (540 * 60);

Lines 173 to 176 allow you to set the time that NightSleep is enabled with the hour being obtained from a time sensor in Home Assistant called: sensor.date_time_iso

 if (timevar[11] == '2' && timevar[12] == '2') {
   TRACE("night sleep");
    //DoNightSleep();
        }

The sensors which are shown on the display are set with:

float fltHotWater = ParseSensorJsonData( ha.sendGetHA("/api/states/sensor.hot_water_top"));
  //String val = ha.sendGetHA("/api/states/sensor.hot_water_top");
  TRACE("Hot Water Top: ");
  TRACE(fltHotWater);

  float fltSolarPVWatts = ParseSensorJsonData( ha.sendGetHA("/api/states/sensor.solarpv_total_meter_gridpower"));
  TRACE("Solar PV Watts: ");
  TRACE(fltSolarPVWatts);

  float fltSolarPVGenerated = ParseSensorJsonData( ha.sendGetHA("/api/states/sensor.solarpv_todaygenerated"));
  TRACE("Solar PV Generated: ");
  TRACE(fltSolarPVGenerated);


  ParseTimeJsonData( ha.sendGetHA("/api/states/sensor.date_time_iso"));

Battery Monitoring (optional)

If you are running the display from a battery you can add a battery meter to the display using the DrawBattery() function. This is using code modified from https://github.com/CybDis/Lilygo-T5-47-HomeAssistant-Dashboard/tree/master/src

Power Consumption

We measured the current consumption using a Keysight 34461A 6½ digit, Performance Truevolt DMM and our Keysight Oscilloscope measuring across a 1-ohm resistor and calculated the current from the resulting voltage.

The display was powered using a EEMB 3.7V 1100mAh 603449 Lipo Battery Rechargeable Lithium Polymer ion Battery Pack (https://www.amazon.co.uk/gp/product/B08FD39Y5R)

Removing R32 which is the enable pullup on the audio IC reduced the hibernate power consumption by an additional 5mA.

The wake and update state uses approx. 153mA and this takes under 0.4 seconds to connect to WiFi and retrieve the data, the display then takes 3.5 seconds to update then the board goes back to hibernate mode.

Mode Current in mA
WiFi Connected Peak 160
Deep sleep 46.5
Green LED Removed 45.8
Update from REST API 153
Hibernation mode 6.8
R32 audio pullup removed 1.8
Measuring power consumption of the display
Measuring power consumption
Resistor R32 audio pullup removed
Resistor R32 audio pullup removed

Battery Pack Sizes

Using the EEMB 3.7V 1100mAh 603449 Lipo Battery we found that the display would only run for 10 hours.

Based on the power consumption this should have lasted much longer but the battery must be a lower capacity than advertised.

As this was not suitable for a standalone display, we decided to use a pair of 18650 2500mAh cells connected in parallel which gives a much longer runtime and can easily be removed from the battery holder for charging.

Battery holder fitted
Battery holder fitted
The display and battery mount.
The display and battery mount

Building a Case

To hold the display PCB and battery holders we used a 10mm thick sheet of Acetal plastic and machined this on our CNC mill to have four mounting holes for the screen and holes for the battery holder to clip into. We also added two M3 bolt holes to secure the battery holder in place.

To build the outer case we used a 50mm square section of India Satinwood a tropical hardwood which we had purchased from Axminster Tools ( https://www.axminstertools.com/) around 15 years ago for a project which was never completed.

Satinwood Timber block
Satinwood Timber block
The milled case inside
The milled case inside
Case parts
Case parts

This wood has a very fine grain and machined easily on the CNC mill to cut an inside pocket for the circuit board and batteries with a 2mm thick bezel around the edges of the ePaper display.

For the rear panel we cut a sheet of 3mm thick white acrylic, and this was held in place using four M3 bolts. These can be easily removed for charging the batteries when needed.

The wood was then polished with bees wax to provide a durable finish.

The finished case
The front of the finished case
The finished case
The finished case
Rear of the case
Rear of the case showing wall hanging holes and bolts

Permalink


2 comments

avatar
Russell
13 September 2022 at 4:36 pm
Hi, I purchaed the module to build this, however I have some questions:
1.”install dependencies”. What’s a dependency; is that like a DLL file? Where am I installing them; into my windows Pc or my Raspberry Pi home assistant, or onto the screen.
2. I am not using an Arduino. How do I do this with a PC? So far everything I do on my HA is via the web interface.
3. How do I load stuff onto the module/screen? It has usb, so I want to just plug it in and somehow copy across stuff but it doesn’t show up on the file explorer.

This is one of those things that a lot is assumed to be known, but whilst I’m not new to electronics at all, with these modules with serial, usb, wifi and Bluetooth connectivity, some things need to be specified. Ideally I’d like to just install your programme and it works.
avatar
Brian
13 September 2022 at 5:11 pm
Thank you for your comments, regarding your questions:

1.”install dependencies”. What’s a dependency; is that like a DLL file? Where am I installing them; into my windows Pc or my Raspberry Pi home assistant, or onto the screen.
The dependencies are: Adafruit-GFX-Library, lewisxhe/fork/GxEPD, debsahu/HARestAPI, ArduinoJson
The links above need to be downloaded into your Arduino libraries folder, This is normally in your documents folder on a Windows Computer

2. I am not using an Arduino. How do I do this with a PC? So far everything I do on my HA is via the web interface.
You need to install the Arduino IDE from https://www.arduino.cc/en/software

3. How do I load stuff onto the module/screen? It has usb, so I want to just plug it in and somehow copy across stuff but it doesn’t show up on the file explorer.
You need to modify the code to include the sensor data from Home Assistant then compile the code and upload to the eink module. You cannot drag and drop to the module.

Leave a reply

Your email address will not be published. Required fields are marked *

Share this post

Support the blog

AB Electronics Raspberry Pi shop