stoic-dashboard

Dashboard that displays a new Stoic thought everyday!

The main components of the project are:

Other accessories include

This repo contains the ESP32 firmware (frontend), RPi server code (backend) and design files for the ESP32-EPD adapter (designs).

backend

Run this code on a permanently powered and internet connected system like a RaspberryPi. If a RaspberryPi isn't available, any computer running Python can be used as a server. Just make sure to update the URL in main.py.

To setup, create a Python venv and install dependencies


cd backend
python -m venv .env
source ./.env/bin/activate
pip install -U pip
pip install -r requirements.txt

and run the server indefinitely.


nohup python server.py &

After a few seconds, there should be images downloaded in backend/image_repo. You can verify that the server is working well by visiting http://raspberrypi.local:8080 in your browser.

The server maintains a queue of available images from image_repo, popping one out whenever client (ESP32) queries. If the size of the queue drops below a threshold (default=10), it executes another pull from Instagram to update image_repo and the queue.

To avoid repeating images, it also maintains a history of previously served images as history.pkl. Delete that file to recycle old images.

frontend

This is a MicroPython port of the original MSP430 firmware from PlasticLogic (written in C) with some modifications like pulling the image to display from a server on the network instead of reading from an SD-card.

If not done already, follow the steps here to prepare ESP32 for MicroPython.

Create a Python3.7 venv and install dependencies


cd frontend
python3.7 -m venv .env
source ./.env/bin/activate
pip install -U pip
pip install -r requirements.txt

Change WiFi and SSID and password in wifi.json, and run run.sh


./run.sh

This will transfer all frontend code and configs to the ESP32, pull an image from the server, display it on the EPD, and go to deep sleep for approx 24 hours. On wake-up, it will pull and display a new image.

Before running run.sh, make sure that the server is running, else the frontend code will crash because it can't find server! If that happens, perform a hard reset


ampy --port /dev/cu.SLAB_USBtoUART reset --hard

Changing an image on demand

If you want to change the current image (and understandably don't want to wait 24 hours), ESP32 has a way to wake-up from deep sleep using touch. ESP32 has several capacitive touch-enabled pins; I'm using GPIO #14 that I fly-wired to a corner of the dashboard. Touching that corner wakes up the ESP32 and updates the image. It could take ~20s, but still pretty cool!

designs

I used KiCad for designing the adapter board.

Why Stoic?

Because I find it interesting 🤷

But yeah, technically, it's a generic dashboard, and one can add any number of Instagram accounts as SOURCES in server.py :)