Making your own e-paper dashboard for home from scratch!
Tags: typescript, raspberrypi, javascript, dashboard
Published: 2021-02-23 13:07:40

---
title: Making your own e-paper dashboard for home from scratch!
published: true
date: 2021-02-22 21:31:58 UTC
tags: typescript,raspberry,raspberrypi,javascript,dashboard
canonical_url: https://lengrand.fr/complete-setup-epaper/
---

 ![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-21-1.png)

**In the few coming minutes, you will read about epaper screens, raspberry pi, node, web components, tailwindcss, open-wc, netlify and more :).**

This article is quite long so for once I'll create a few pointers with TL;DR every time :)

- [**The hardware**](https://lengrand.fr/complete-setup-epaper/#the-hardware-)
- [-> the screen](https://lengrand.fr/complete-setup-epaper/#the-screen)
- [-> the computer](https://lengrand.fr/complete-setup-epaper/#the-computer-)
- [-> the OS](https://lengrand.fr/complete-setup-epaper/#the-os)
- [**The software**](https://lengrand.fr/complete-setup-epaper/#the-software)
- [-> the 'backend'](https://lengrand.fr/complete-setup-epaper/#the-backend)
- [-> the frontend](https://lengrand.fr/complete-setup-epaper/#the-frontend)
- **[Some remarks](https://lengrand.fr/complete-setup-epaper/#additional-thoughts-and-remarks-)**

It's the second time I create a dashboard for my house. We are working hard on reducing our carbon emissions. Tracking energy usage as well as making food plans is a very good way to do just that.

This time, **I wanted my dashboard to be built with an e-paper screen, to avoid the ugly backlight of a tablet, and reduce energy consumption**. Here is the final product :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-21.png)<figcaption>The complete e-paper dasbboard setup</figcaption>

<!--kg-card-end: image-->

**In this post, I'll tell you all about how it's built, and how you can do it too. I won't describe everything, but point you to relevant documentations I followed. I'll also share tips and tricks.**

## The hardware! 

**TL;DR: Get a Waveshare screen, a Raspberry Pi and follow [instructions](https://www.waveshare.com/7.5inch-e-paper-hat.htm).**

As any good physical product, everything starts with the hardware :). If you want to build the same dashboard, you'll need:

- [A waveshare 7.5 inch screen (with UAT)](https://www.waveshare.com/7.5inch-e-paper.htm)
- [A raspberry Pi zero](https://www.raspberrypi.org/products/raspberry-pi-zero/)
- [A bunch of soldering cables](https://www.amazon.com/TUOFENG-Wire-Solid-different-colored-spools/dp/B07TX6BX47/ref=sr_1_34?dchild=1&keywords=Soldering+Wire&qid=1614031046&sr=8-34)
- [Some lego :)](https://www.amazon.de/Lego-10698-Classic-Gro%C3%9Fe-Bausteine-Box/dp/B00PY3EYQO/ref=sxin_9_ac_d_rm?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&ac_md=2-2-bGVnbyBzdGVpbmU%3D-ac_d_rm&cv_ct_cx=lego&dchild=1&keywords=lego&pd_rd_i=B00PY3EYQO&pd_rd_r=5eae0c54-ccbb-4a6f-9244-769b32337e2a&pd_rd_w=XXCMe&pd_rd_wg=iso2P&pf_rd_p=54ea5632-6b46-46db-836f-bc13df6ca6a4&pf_rd_r=G3WK7JTERFGJYNVQRKGG&psc=1&qid=1614031248&sr=1-3-fe323411-17bb-433b-b2f8-c44f2e1370d4)

Total is about 70€, everything included.

### The screen

I am using this [7.5 inch 2 colors screen from Waveshare](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT). My initial plan was to go for a [9.7inch with gray levels](https://www.waveshare.com/wiki/9.7inch_e-Paper_HAT), but I had no experience at all with that hardware so I went for the safer, 50$, solution.

The first good news is that the screen is CRAZY thin, here is a photo to give you an idea :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-25.png)<figcaption>A photo of the e-ink screen from the side</figcaption>

<!--kg-card-end: image-->

When buying an e-paper screen, here are the things you want to look for :

- **Refresh time**. One of the cons of having an e-ink screen is that refreshes usually take a while. If you want performance, also look whether partial refreshes are available. Here is a video of mine so you get an idea:
<!--kg-card-begin: embed-->

> It updates every 5 minutes and that's what a refresh looks like in case you wonder : [pic.twitter.com/PjW4CS4rXp](https://t.co/PjW4CS4rXp)
> 
> — Julien Lengrand-Lambert (@jlengrand) [February 18, 2021](https://twitter.com/jlengrand/status/1362321332516585480?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script><!--kg-card-end: embed-->
- **Resolution**. e-ink screen of higher resolution are still quite expensive (compared to a tablet). Depending on what you want to do with the screen, you might end up with artifacts. A nice font will help you there, but it won't do miracles either. For example, this is what my dashboard looked like before I put my text in bold. You can clearly see the artifacts : 
<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-22.png)<figcaption>A photo of the screen with text missing due to resolution</figcaption>

<!--kg-card-end: image-->
- **Gray levels**. My screen is two colors ( essentially, ink or no ink). Some other screen have 255 gray levels. Some others even have color. You may want to choose one of those but remember that it will cost you in refresh time or price. 
- **Driver board**. We'll talk more about this soon but be aware that not all screen come with connectors and a driver board. If you don't know what I am talking about, be careful buying a HAT version, otherwise you won't be able to use the screen : 
<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-23.png)<figcaption>A photo of the screen with driver board</figcaption>

<!--kg-card-end: image-->
### The 'computer'

This post will be using a Raspberry Pi. Note that the Waveshare screens have a pretty extensive [documentation](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT) so you can also go for Arduino or even the Jatson nano if you fancy it.

Just to be clear, I am using a Raspberry Pi Zero in my build, so you don't need crazy amounts of power to run it.

**If you're afraid of soldering, I recommend you use the B version of the Raspberry** because the driver board from Waveshare can directly clip on the GPIO :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-24.png)<figcaption>Driver Board connected to a Raspberry Pi model B</figcaption>

<!--kg-card-end: image-->

As I mentioned, I decided to go for a Raspberry Pi Zero for two reasons :

- The form factor is much smaller, which allows for a super small setup together with the screen
- The Zero goes for 5$, which is close to nothing! 

In case you go for the 0 like me, you'll have to solder a few cables. Don't be afraid though, everything is [described here](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT). All you need is the table below together with the Raspberry GPIO.

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-26.png)<figcaption>GPIO correspondances of the R Pi Zero</figcaption>

<!--kg-card-end: image--><!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-27.png)<figcaption>Where to solder each pin</figcaption>

<!--kg-card-end: image-->

Once you've done that, you're pretty much good to go! Find a 5V adapter and power up your Raspberry Pi! The nice thing is that your screen will feed off the Raspberry so you need only one alimentation. We're ready to move to phase 2!

### The OS

I've decided to keep this in the hardware part, because I don't have much to say. What we will want to do on our Raspberry Pi is install a default OS that is not too old. [You can create and flash one here](https://www.raspberrypi.org/software/operating-systems/) by following the instructions.

The next thing you want to do is follow all the instructions described [in the default Waveshare setup](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT). Again, they are very well done so I don't have much to add but if you have any issue feel free to drop me a message.

In case you need to setup WiFi for your Raspberry Pi, [here is the guide I used](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)!

You will enable SPI, install the necessaries libraries and download the library and test code from Waveshare. I tested with Python.

In case you have the same screen as I do, you will want to run the `epd_7in5_V2_test.py` script located in `waveshare/e-Paper/RaspberryPi_JetsonNano/python/examples/`! If all goes according to plan and you've soldered everything correctly, your screen will wake up!

## The software

**TL;DR: Use [epaper.js](https://github.com/samsonmking/epaper.js) on the Pi, created a service around it and serve static content in the static folder :).**

Our screen is awake, and we have a linux to work with! Time to start creating our dashboard!

I have made use of the amazing [epaper.js](https://github.com/samsonmking/epaper.js) project to create my dashboard. The project is insanely useful. In short, it runs a static website locally and projects it on the screen using puppeteer.

This has a huge advantage : you only have to create a website and then deploy it on the device! **You can find the complete code for the front and back end of the project [here on Github](https://github.com/jlengrand/epaper-dashboard-blog). And the website is available [at any time on Netlify](https://epaper-dashboard-blog.netlify.app/).**

The project is composed of two parts, which live in the same repository.

- The root repository that contains the code that will run on the Raspberry Pi, 'the backend'
- The `epaper-ui`folder, which will contain our actual dashboard, the 'frontend'.

Let's dive into each of the parts, but first, a word of warning:

Epaper.js  can only be run on the raspberry. Indeed, it depends on native libraries (the GPIO drivers) that do not exist on your computer :). Not a problem, just something to be aware of (For example, don't set a CI on your project on Github).

Conversely, the latest version of Node that I could run on my raspberry is version 10.x, which means that I could not run the frontend code on it. Again, not a problem; just something to be aware of.

What that means is simply that I have been developing the frontend on my computer, and the backend only on the pi.

Now that it's clear, let's go!

### The frontend

This part is the easiest to talk about. Keep in mind that for your own project, you can use any technology that suits you. The only requirement you have is that the result of your build lands in the `static` folder of the repository to be picked up by the backend.

Here is the current deployed frontend :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-31.png)<figcaption>Latest version of the frontend, in the web form</figcaption>

<!--kg-card-end: image-->

I decided to use Web Components, and my website is based on top of [LitElement](https://lit-element.polymer-project.org/guide/properties) and [TailwindCSS](https://tailwindcss.com/). I used the excellent [open-wc](https://open-wc.org/) library to generate my project skeleton in Typescript. Those are personal choices, you may well choose anything you like.

I picked these because by using Web Components I had very little to learn on top of the basic capabilities of HTML. Thanks to tailwind I also didn't have to learn much CSS :). My knowledge is limited in the front-end, having a simple syntax, a boring technological choice and no build-chain seemed like a perfect deal. No need to screw around with Webpack <3!

Another good thing is that because I am basically only building a website, I could use [Netlify](https://www.netlify.com/) as a platform to see the results of my work. And gosh I love their product!

Some things to note :

- [I wrote a short article on how to easily use tailwind together with LitElement](https://dev.to/jlengrand/a-simple-setup-to-use-litelement-with-tailwindcss-for-your-web-components-projects-fla)
- Since it is a personal dashboard, I needed personal data. I leave it up to you to decide where to fetch your data from. The easiest for us to sync up with the girlfriend is Google Spreadsheets :).[I wrote a whole blog post](https://dev.to/jlengrand/automagically-fetching-google-calendar-data-without-oauth-by-using-google-scripts-5a97) about how to do that to sync calendars and avoid having to use Oauth2. In short, you can publish your spreadsheets online as CSV files. I do that and then ingest the data to create my dashboard. The great thing is that the CSV files are always up to date! 

I created my whole dashboard by using `$ npm start` in the `epaper-ui` folder, running `$npm build` every time I was happy with the result. That pushed the built version in the `static` folder of my project and sent it over to Github. By pulling the repository on my raspberry, I can make sure to always have the latest version of the dashboard.

Again, you can [check the source code](https://github.com/jlengrand/epaper-dashboard-blog/tree/main/epaper-ui) here, and the [resulting dashboard over here](https://epaper-dashboard-blog.netlify.app/).

One last thing I want to mention before moving on is the way I refresh my dashboard :). The epaper.js examples [has an example with data that updates](https://github.com/samsonmking/epaper.js/tree/master/examples/weather-station). **However** , that data updates from the backend to the frontend. In my application, all the data is pulled from the internet via the frontend, which means that I cannot use the same mechanism.

To solve this problem, I make use of a very old capability of HTML itself to tell the page to refresh itself after very few minutes :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-30.png)<figcaption>Tells the page to refresh every 60 seconds.</figcaption>

<!--kg-card-end: image-->

Depending on how you build your own dashboard, you may not be concerned by this.

### The backend

Naming that part 'the backend' makes it seem like I've done a whole lot of work but I've really only been piggybacking on the great work done by [epaper.js](https://github.com/samsonmking/epaper.js).

Let me show you the integral content of my 'backend' code :

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-28.png)<figcaption>Two lines of code, only calling the epaper.js init</figcaption>

<!--kg-card-end: image-->

Yep, the only thing I did was call the epaper.js library and pick the device I am using. (Be careful, in case you use another model of Waveshare display you will have to change that value).

That is enough for the content of the static folder to be successfully displayed on the screen :).

Now, you might be expecting a few more things coming up. And you'd be right...

The first time I ran my dashboard ( `$node index.js` ) and logged off the SSH connection, I got a little surprise : the application stopped. Of course, I had to run it in the background.

However, it is not directly possible, because epaper.js supports stdin inputs (for buttons or keyboards). I looked around and decided to comment out the lines of code that handle stdin :). To do this, you can go on your clone of the project on the raspberry and in `node_modules/epaperjs/index.js`. You want to comment out the following line in the init function:

<!--kg-card-begin: image-->

![Making your own e-paper dashboard for home from scratch!](https://lengrand.fr/content/images/2021/02/image-29.png)<figcaption>Disabling the setupKeyInput method</figcaption>

<!--kg-card-end: image-->

There are cleaner ways, but that works for now.

Once that works, the next thing to do is to make it start automatically at boot of the raspberry. I have created a service for that. It comes in two parts:

- the `dashboard.js` file in the root of the project.
- the `dashboard.service` file in the service folder of the project. To activate it, you want to follow [the typical way to create a new service Linux](https://www.shubhamdipt.com/blog/how-to-create-a-systemd-service-in-linux/). (careful, you want to make sure that the location of dashboard.js in the file is correct for your system!).

**Et voilà! Your dashboard now runs automagically on boot of the raspberry and can be started and stopped on demand.**

## Additional thoughts and remarks: 

- One thing that got me a few times is that an e-paper screen literally works by projecting ink on the screen. Once the ink is there, it won't go way by itself. This means that even when the raspberry is off, the data sticks to the screen. I got tricked a few times by this :).
- Depending on the resolution of your screen, you may see artifacts on the screen. Choosing a newspaper font can help there. There is a [good Reddit thread](https://www.reddit.com/r/archlinux/comments/736xx4/which_fonts_do_you_find_render_best_on_regular_or/) about this.

Overall, I'm extremely happy about the result of this side project and the choices I've made. Picking epaper.js, open-wc and tailwind has helped tremendously to iterate fast and be productive. Having a simple website that I can work with and deploy on Netlify at any time has been a tremendous help.

It was also great fun to build this project with the family. The gilfriend was responsible of the design of the dashboard as well as the data, I built it while my 4 year old did the casing.

Because I don't need the interactions capabilities of epaper.js, I probably could get rid of the websockets altogether in the project and pull the website directly from the web instead of running it locally. That would be very interesting, because then **I would automatically get the latest version of the dashboard every time I push a new version to Netlify. To be continued....**