A new companion on my desk

in STEMGeeks2 months ago (edited)

I have this Pi Zero W for a while doing nothing but now it has a use case. :) I started monitoring my small GPU rig with it.

Scenario 1: Rig is up, everything is OK.


Scenario 2: Rig is down, alarm!


It was pretty cool to play with inky phat. I'll definitely try to hack more sophisticated things on it.

I use hiveon as pool, so it gathers stats from there. Based on the reported hash rate, one of the two different drawings shows up on the e-ink screen. If you want to try this, make sure you have libraries installed. (arrow, requests, etc.)

Here is the full script:

import requests
import inkyphat
import arrow
import os

wallet = os.environ['WALLET']
font_file = inkyphat.fonts.PressStart2P
font = inkyphat.ImageFont.truetype(font_file, 11)

def main():
    r = requests.get(f"https://hiveon.net/api/v0/miner/{wallet}?currency=ETH")
    data = r.json().get("data")
    hash_rate = int(data.get("hashrate"))
    utc = arrow.utcnow()
    local = utc.shift(hours=2)
    last_update = local.format('HH:mm')

    if hash_rate > 0:
        mh = round(hash_rate / 1e6, 2)
        msg = f"MINING { mh} MH"

        text_colour = inkyphat.BLACK
        msg = "Rig is DOWN!"
        text_colour = inkyphat.RED

    msg2 = last_update
    w, h = font.getsize(msg)
    msg_x = int((inkyphat.WIDTH - w) / 2)
    msg_y = int((inkyphat.HEIGHT - h) / 2)

    inkyphat.text((msg_x, msg_y - 11), msg, text_colour, font=font)
    inkyphat.text((inkyphat.WIDTH - 66, inkyphat.HEIGHT - 15), msg2, text_colour, font=font)



Wish there were bigger e-ink displays. The small ones are relatively cheap though.

I’ve just been building a new open frame GPU mining rig from existing materials (aluminium extrusions, melamine panelling and 3D printed parts) and computer parts incl RX580s from earlier mining.

Hope to have it working soon.

Looks pretty cool mate! Mine doesn't look that organized. :)