Display Hive Price on E-Ink MagTag display

in LeoFinance2 months ago (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

Sort:  

That is amazin.

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

lol yes true.

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......

ahah!
That's awesome!!!

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. :/

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

Damn. It looks nice as hell.

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

Posted Using LeoFinance Beta

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

Pi Hole is good, but since it won't block YouTube ads I found it pointless.

Posted Using LeoFinance Beta

Ah, okay, good to know!

Posted Using LeoFinance Beta

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.

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

Posted Using LeoFinance Beta

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

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

Short and sweet code. Will check if it is available in India.

Posted Using LeoFinance Beta

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.

I love the innovation. Always looking to create.

It is awesome.

Posted Using LeoFinance Beta

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.

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

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.

Uuh, that is a great use for such a display. Let's hope the dot shifts further to the right soon ;)

!gif magic

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

you can change the world