Display Hive Price on E-Ink MagTag display

avatar
(Edited)

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



0
0
0.000
27 comments
avatar

That's it!? That's all the code it took to make it auto-update!? Man, I have a e-ink display here from a different company and it's looking like at least 2x the code to get it to run. :/

0
0
0.000
avatar

I am using the MagTag library which was created for it, it simplifies it a lot, but it also has limitations, if you need to access more than one datasource you can't really use it. In my case I wanted both the Hive USD and BTC price which means I have to access two endpoints, to do this I don't think I can use the MagTag object and will need to do direct calls. This will likely take a bit more code.

Posted Using LeoFinance Beta

0
0
0.000
avatar

Wow!
Only thing left now is that the price of Hive rises, so that it makes fun to watch that display 😁

0
0
0.000
avatar

That is really awesome. I have never heard of this subscription box, but I have heard of some other ones. This one seems cooler than the others. I like that you don't need a device to run this. It is all self contained. I have been toying around with using one of my Pi's with some kind of display to do something, but I haven't decided what yet. I've been reading lately about setting up a PiHole and I might use one of them to do that.

Posted Using LeoFinance Beta

0
0
0.000
avatar

That's a geeky tool I can get behind! I could imagine a few of them them mounted on the wall to give you an at-a-glance market overview every time you walk into a room.

0
0
0.000
avatar

That's some cool nerdy stuff!
I still have Raspberry Pi here where I have played with. This inspired me to dust off that thing :D

Posted Using LeoFinance Beta

0
0
0.000
avatar

Hi @themarkymark, this is a cool one. I would like to have any code which could transfer the update to my excel at my desktop/cell phone (if you could manage).

Nice work and thanks.

0
0
0.000
avatar

You could do this with Python, no need for an E-Ink display controller.

Posted Using LeoFinance Beta

0
0
0.000
avatar

Appreciated! I am hoping for the many-more good job from you and the other team.
Looking forward to amazing work in 2021 onward.

0
0
0.000
avatar

wew. That's kinda cool. I might be mistaking that for a digital alarm clock tho..

0
0
0.000
avatar

This makes me want to set up my Raspberry Pi scrolling price display again. I had it showing the weather too. The E-ink displays are cool though with such low power requirements. There's plenty of metal on my desk it could stick too.

0
0
0.000
avatar

It's cool but so difficult to work with seeing as it is so new and drivers and software has bugs they working out, I had to update to newer versions a few times and I still have problems with simple things.

Posted Using LeoFinance Beta

0
0
0.000
avatar

Looks really good, Mark. Adafruit has a lot of little things, such as the trinket, that just make a lot of diy projects easy and fun.
It's making me want to break out my old Raspberry B+ and throwing my screen on it, making it either a desktop portfolio tracker or just a price tracker in general.

0
0
0.000
avatar

Damn. It looks nice as hell.

Let's hope it will display 0.20$ cents for Hive soon. :D

Posted Using LeoFinance Beta

0
0
0.000
avatar

I've been tempted to purchase the Adabox's but I have so many projects on the go that I probably wouldn't have time to start another one.... but this is so cool!!! Hmmmm......

0
0
0.000