I recently ordered one of these E-Ink Photo Frames from Waveshare. The stock code allows it to display images from the SD card, however the drawbacks are you have to first convert the photo to the correct format using their supplied software scripts.
My goal was to write some firmware that allows you to update the photos by only having to drop images in a folder on a network drive. I've had an Odroid HC2 running Ubuntu for a few years. It has a 6TB 3.5" drive and shares this drive on my home network using Samba. However between having the ESP32 connect using Samba or SSH or SFTP, the coding effort was too much. So the least effort method ended up being setting up nginx to host a folder as a HTTP server. The ESP32 can easily act as a HTTP client and download images from that folder onto its SD card.
Next was displaying the images, I didn't want to have to have to do any processing of the images if I could. Luckily Larry Bank has written a really great JPEG decoder library: JPEGDEC. This makes load JPEGs on the ESP32 easy, bitmap files (BMP) files were also easy, but I found using Larry's PNGDEC library, I was running out of RAM with my implementation, and as I intend to display JPEGs normally, saving a PNG as a BMP isn't that much effort as I won't do it very often. Once its downloaded the image into a temporary file on the SD card, it then decodes and resizes them to fit the E-Ink display.
The last part of the image display pipeline is dithering. E-Ink display pixels can't colour mix like with LCD, LED and OLED displays. The pixel can only be one of the six colours. So to dithering is a way to create the illusion of other colours by patterning different colour pixels that are close together. I've used Floyd-Steinberg dithering algorithm.
The last part of this code was to add an extra function. I recently setup home assistant on a raspberry pi. Since this Waveshare board has a temperature and humidity sensor on board, why not set it up as a temperature and humidity sensor for Home Assistant using MQTT. It will also publish on start up the correct data to the home assistant auto discovery topic so that it doesn't require any additional configuration.
The current code has the device setup to come out of deep sleep ever 30 minutes, pick a random picture from the folder and display it, and to come out of deep sleep every five minutes to log the temperature and humidity.
It the git repository is the setup instructions for flashing the board, and a nginx config file for your sites-available folder in /etc/nginx. Once you've pointed it at that folder, adding new images is as easy as adding JPEG and BMP files to that folder, you don't need to resize them!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.