My E-Ink WeatherFlow Display

If you have weewx running, just cook up a custom skin of your liking and buy a $35 to $70 kindle fire hd and run Belchertown as the skin. It’s better than anything I’ve seen. You already have the hard part (weewx) done. Much faster and more stable than anything using a zero too.

1 Like

@vinceskahan thanks for the suggestion, my pi4 running weewx already does belchertown - but it’s the basic skin. When you say “cook up a custom skin” that’s the part i haven’t quite figured out yet - and another project for when i get more time. i have plans for the belchertown to eventually link into a domain i purchased…

in the meantime, i love learning new things and i have the zero & e-ink display… i’d love to get @Rjames version running, throw a backup battery on it and see how long it lasts on my wall.

yeah - the instructions are kinda almost non-existent if you don’t know what you’re looking for and maybe even then perhaps.

The instructions in the linked howto on his ‘code’ page have a demo to read through down to at least the big blue ‘hello world’ in step-3. That should give you a starting point for figuring it out.

Then try it for real on your pi.


# remember to enable SPI via raspi-config and reboot first....

# install prerequisites
sudo apt-get install -y git python3-venv gcc python3-dev
sudo apt-get install -y libatlas-base-dev

# git clone the software
cd /home/pi
git clone https://github.com/rjames86/tempest-eink.git

# activate the python virtual environment
cd tempest-eink
python3 -m venv .
source bin/activate

# install the requirements
pip3 install -r requirements.txt

# numpy blew up for me but an upgrade worked
pip3 install -U numpy

# light that candle
python3 main.py

The python venv is nice because it installs all the python stuff ‘there’ and does not alter your os’s python setup. That’s why you have to ‘activate’ it, so your shell knows to work within that python virtual environment and use ‘that’ and not your os’s python setup. When you give the activate command you’ll see your shell prompt change to indicate you’re working in a venv.

Try the stuff above. Mine blew up in the last step trying to run main.py but that’s because I didn’t try it on a pi, I used a debian virtual machine since I could spin one up quickly. I’m guessing you’ll get reasonably far using the commands above…

Now how to get it to start on boot etc - I dunno. Get it to work manually from the command line first :slight_smile:

@vinceskahan awesome, i already had read through most of that "how to’ and right before the hello word part i started second guessing i was in the right place. thank you for confirming, and adding the code above should get me where i need to go. I’ll post back when i get there. just finished soldering on my header pins so i have a ways to go yet.

thanks!.

You can do the software in advance of the soldering fun if you want. If it tries to start up and can’t talk to a (not connected yet) e-ink display then you’re pretty far down the road toward success.

1 Like

update - I did try the code on a pi4 with a waveshare 2.13" epaper on it and needed to make a couple edits to the procedure I posted above. Unfortunately the code is very epaper model-specific so it blows up on my smaller epaper display, but it does run enough to expect some success if you have the model epaper display that the code expects… if you follow the (modified) steps I posted above.

update2 - just so I don’t lose the howto myself, to get the 2in13 demo script from waveshare to work…

cd
git clone https://github.com/waveshare/e-Paper
cd e-Paper
python3 -m venv .
source bin/activate
pip3 install numpy spidev Pillow RPi.GPIO
cd RaspberryPi_JetsonNano/python
python3 examples/epd_2in13_V2_test.py

# of course if you have a different model
# display, use 'its' test program

success, although, it took A LOT to get there.

screenshots:



it works from the command line. Now i need to figure out how to get it to run “automatically” as it’s a 1 and done script currently. (i also have to load / run my test eink python to clear the screen). It took alot of trial and error on my part, and this was a first time for me in a virtual environment. I made the mistake of trying to load a browser into the RPIzero so there went an hour or two before i realizing my mistake there.

in the morning, I deleted everything from the night before, and started over. finally thought i had it but it wrote “Token not found” on the display - WTF … found the server created a JSON file that needed my info, created a Token, and added my token, station & device ID’s into it (made a mistake there as well thinking my device_id was my station name =another wasted hour of hair pulling), FINALLY after upgrading and manually installing parts of the requirements.txt files, my last error was it was missing a temp directory file. i noticed there wasn;t a temp directory, so i added it, and boom it WORKED!

now to figure out how to get it to endlessly loop every 3-4 minutes or so…

thanks for the help @vinceskahan

Blockquote

1 Like

You need to install the modules in the requirements.txt file into your python venv. See my post above for how to do that.

You could do it with cron if you just want to run it periodically…

The answer in (this stackoverflow post) should help you write a quick bash script to activate the venv and run the script via cron…

I run main.py, get below message and screen just flashes.

2022-03-27 23:55:18,197 [INFO] Starting up…
2022-03-27 23:55:28,152 [INFO] is testing: False
2022-03-27 23:55:28,156 [INFO] initializing epd
2022-03-27 23:55:28,198 [INFO] Sleeping time. Don’t do anything

Hey folks! Sorry I’ve been out of town right now. I’ll update the GitHub repo with a full rundown of the setup I did and instructions on how to get it going

3 Likes

Found the issue, in the server.config.json file it has a on-time and off-time. I was running my test outside the window. I updated on-time to 00:01 and off-time 23:00.

I noticed a few things…

first - my time was off an hour… couldnt for the life of me figure this out - for at least an hour i wrongly assumed it had to do with my Daylight Savings Time not working on the pizero) , but then i realized the desktop time (from the Pi) was correct - i finally checked where you actually drew the time to the display graphic, and found you pulled/forced time from a Denver Timezone - I corrected mine to read Chicago, and all is well in my world again.

second
I added a 5 minute sleep, then installed a while command in MAIN.PY to do an endless loop while we’re inside the on/off-time parameters.

i saw the screen refresh would not clear the previous (my time was just overwriting the new pixels, not clearing the old ones prior) so i added a wipe to the himage after the image was written to the display

then after the 6th cycle (18 charts created) - my terminal window showed a runtimewarning that 20 figures have been opened, and all figures from pyplot are retained unless explicitly closed which may consume too much memory. a few more cycles and sure enough the pi locked up. so to this, i added two close(“all”) commands after the chart draw’s were saved to temp file and now my endless loop is running smoothly

I haven’t tried to setup an autorun yet, that can come later if at all. right now i like to boot into the py zero (running on a battery) “Light the Candle” as was told to me earler :wink: - then unplug the hdmi and wireless keyboard/mouse let the thing run and see how long the battery lasts with the 5 minute refresh window.

@Rjames I have to give you kudo’s. I’m old school, and reading/following the program and charting, the python scripts you put together are amazing. (i’ll be honest i still don’t understand about 70% of it)

I’d love to add a darkmode config option, and then just inverse the Himage prior to writing… maybe i’ll try to figure that out next.

1 Like

was able to add “darkmode” to the config json and confg.py
added commands to main.py to convert the binary image to grayscale, invert , and convert back to binary. a simple test for darkmode, then draw either the normal or inverted image to the epaper screen.

some pics:




you didn’t do it until you submit a PR to the author with your additions :slight_smile:

(nice)

2 Likes

Another nowhere-near-as-cool variant - I finally cooked up a little display on my 2.13" waveshare e-paper display that updates the outside temperature and time of day once/minute using partial refreshes so it’s instantaneous.

In this case I just do a http grab of a file that my weewx system generates every 5 minutes so I didn’t need to go to the complexity of pulling it from MQTT or the like.

Code is on (github) if anybody cares. The only thing that’s reasonably interesting in the general sense is how I clear the screen to prevent burn-in. The partial refresh is really prone to mess up your screen if you’re not careful…

I added a cya full refresh clear routine to prevent burn-in that runs twice an hour, and it also runs a mutiple-clear ‘really’ clear the display routine when the program exits.

There’s a little extra placeholder code in there and the docs are weak, but I’ll get to that on the next rainy day.

2 Likes

Debated on starting a new thread but was afraid to lose all the context above.

I have (after a day or two of troubleshooting, installing, reinstalling, etc.) have this mostly working. I’m hoping all those brave and determined souls who were able to get through this setup process and get this going can offer some guidance.

I cannot get the charts to display. The errors returned are shown below. Can anyone tell me where to even start troubleshooting (code? my Tempest setup?).

Thanks. And thanks very much to OP for creating this option. I wish Weatherflow would offer a screen like this that would show real-time data from the station.

— Logging error —
Traceback (most recent call last):
File “/home/pi/tempest-eink/draw_weather/charts.py”, line 70, in create
img = self.create_chart(value, x_label, y_label, chart_type)
File “/home/pi/tempest-eink/draw_weather/charts.py”, line 84, in create_chart
return self.create_line_chart(obs_type, x_label_name, y_label_name)
File “/home/pi/tempest-eink/draw_weather/charts.py”, line 97, in create_line_chart

UPDATE: against all odds, I stumbled upon the fix. As someone mentioned above, the temp directory wasn’t created in the tempest-eink directory. Manually creating it fixed the issue.

hello all, I want to set this up. the GitHub instructions lose me at the step:

Put this in the file

which prefaces the last two sections. put this in which file?

FWIW, I would write the instructions ‘much’ differently. It would be easier to just supply the two files in the git repo and provide instructions for how to copy them into place.

Basically his marking of code blocks is messed up. Easy to do that in Markdown.

It should be marked like this:

sudo nano /etc/systemd/system/tempest.service

Put the following in the tempest.service file you are editing…

# this is the contents of the tempest.service file
[Unit]
Description=Ryans Tempest E-ink Project
After=network.target

[Service]
User=pi
Group=www-data

WorkingDirectory=/home/pi/tempest-eink/server
Environment="PATH=/home/pi/tempest-eink/venv/bin"
ExecStart=/home/pi/tempest-eink/venv/bin/gunicorn --bind unix:tempest.sock -m 007 wsgi:app

[Install]
WantedBy=multi-user.target

Next, edit a second file…

sudo nano /etc/nginx/sites-available/tempest

Put the following in the sites-available file you are editing with nano

server {
    listen 80;
    server_name tempest-eink.local;

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/pi/tempest-eink/server/tempest.sock;
    }
}

Then run these commands

sudo ln -s /etc/nginx/sites-available/tempest /etc/nginx/sites-enabled/
sudo ufw delete allow 5000
sudo ufw allow 'Nginx Full'

@Rjames It looks like you took the repo down. Do you plan to share it again?