Display Hive Price on E-Ink MagTag display

LeoFinance
14 days ago
(edited)
2 Min Read
450 Words

I got my first Adabox a couple of weeks ago and it included an E-Ink display, some NeoPixel lights, and a few other things. Adabox is a quarterly subscription from Adafruit that sends you curated electronics to build projects.

I messed around with it and ran some example projects using the device and included neopixel lights to setup a wreath with RGB colors that synchronized with other users running the same codebase. Sending a tweet to a specific twitter address with a color would change everyone's lights to match.

I wanted to find a project to use with the main device called a "MagTag". It is a 2 color 2.9" E-Ink display with Wifi and a few other really cool features.

E-Ink displays are easy to read and don't cause eye strain, it also works very well in sunlight. It doesn't work very well in the dark and it has a very slow refresh rate. If you ever used a Kindle, you know exactly what I mean.

One of the nice things about the Adabox is you receive their newest products before most customers. In fact, the MagTag is still out of stock a month later after the release of this quarters Adabox.

The kit is $40 which includes the display, a battery, and magnetic feet so you can put it on any magnetic surface (i.e. a fridge). The legs also allow it to stand upright on a flat surface.

These will likely be out of stock for a little bit but you can check on adafruit.com and be notified when they return.

If you want to run the project I did, I will include the code.

from adafruit_magtag.magtag import MagTag

ENDPOINT = "https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd"
JSON_PATH = ["hive", "usd"]


def format_text(val):
    return f"${round(val, 3)}"


magtag = MagTag(
    url=ENDPOINT,
    json_path=JSON_PATH,
)

magtag.peripherals.neopixel_disable = True
magtag.peripherals.speaker_disable = True
magtag.graphics.set_background("/images/logo.bmp")

magtag.network.connect()

magtag.add_text(
    text_position=(
        (magtag.graphics.display.width // 2) + 60,
        (magtag.graphics.display.height // 2) - 1,
    ),
    text_scale=3.5,
    text_transform=format_text,
    text_anchor_point=(0.5, 0.5),
)

try:
    value = magtag.fetch()
except (ValueError, RuntimeError) as e:
    print(e)
magtag.exit_and_deep_sleep(60)

As you can see, it is fairly simple but setting up the device was a bit of work.

The device should last a few weeks without charging. I will likely make some changes to utilize the 4 RGB NeoPixel lights on the device to maybe show trend direction or volume. I also want to add the Hive Bitcoin price as well. Unfortunately the display is only two colors, so there are limitations.

The code can easily be changed to display Bitcoin or any other token.


Securely chat with me on Keybase

Why you should vote me as witness

Posted Using LeoFinance Beta