Close
0%
0%

Crypto Ticker

Uses an ESP8266 to display live cryptocurrency prices on an OLED display

Similar projects worth following
Update January 2021 - The version available here probably doesn't work because coinmarketcap don't allow free access to their API any more. I've rewritten it for my own use to use coingecko but I can't make the ESP download the data directly because of the memory limitations wrt HTTPS. I've got a PHP script running on a web server which pulls in the JSON data, reformats it and makes it available via HTTP but it doesn't feel like a widely accessible solution, so I'm not publishing it here. Feel free to contact me if you're interested.


This is a simple device which sits on my desk and displays realtime crypto currency prices, currently Bitcoin and Monero but it can easily display any currency available on coinmarketcap.comIt doesn't need any soldering, the total parts cost is around €7.

I hope the majority of the code is self explanatory but feel free to ask if anything is unclear.

The logos are XBM bitmaps stored as strings - I created them in GIMP by saving 16x16 logos as XBM files, then opening the XBM with a text editor and copying the string. You can also use an online converter to make the XBM but that didn't work well for me.

update_display.lua

lua - 1.87 kB - 12/18/2017 at 10:59

Download

getrates.lua

lua - 1.12 kB - 12/18/2017 at 10:59

Download

init.lua

lua - 471.00 bytes - 12/18/2017 at 10:59

Download

nodemcu-1.5.4.1-cjson-file-gpio-http-i2c-net-node-tmr-u8g-uart-wifi-tls-2017-12-18-float.bin

The firmware I used. Built on nodemcu-build.com.

octet-stream - 496.25 kB - 12/18/2017 at 10:58

Download

  • 1
    Flash firmware to ESP8266

    You can either use the firmware I've included here, or build your own on nodemcu-build.com. It only works with the 1.5.4.1 branch. You'll need the modules cjson, file, gpio, http, i2c, net, node, tmr, u8g, uart, wifi. You also need to tick 'TLS/SSL support' towards the bottom of the page. This flashing tool works well.

  • 2
    Connect the screen to the ESP8266

    3.3v to 3.3v, gnd to gnd, SDA to D3 and SCL to D4. You can use other GPIO pins if you like, make sure to update the pin numbers at the top of update_display.lua. If you get nothing on the display, they're probably set wrong.

  • 3
    Upload the code to the ESP8266

    I use ESPlorer for this - open the 3 files on the left side, connect to the ESP on the right side and click 'Save to ESP' for each file. You'll need to set your wifi details in init.lua first.

View all 3 instructions

Enjoy this project?

Share

Discussions

pwnd wrote 03/07/2018 at 16:50 point

I used your code to extend it so the oled could display your current hashrate from nanopool and added some features like offline detection. You can access it on github. https://github.com/o0pwnd0o/miningmonitor

  Are you sure? yes | no

dannyritchie wrote 02/19/2018 at 21:25 point

Am enjoying having a play with this but can not seem to figure out how to get to show after the decimal for sub dollar coins. Sorry if this is a stupid question but its my first time using away from the arduino ide. Thanks

  Are you sure? yes | no

kieranc wrote 02/19/2018 at 22:09 point

It's not you, the code isn't very well commented. This line:

btcrate = string.format("%d", t[1]["price_eur"]+0.5);

pulls the rate from the json array and displays it as whole numbers.


To make it show decimals, you want something like:

btcrate = string.format("%.3f", t[1]["price_eur"]);

3f will display 3 numbers after the decimal point.

  Are you sure? yes | no

dannyritchie wrote 02/19/2018 at 23:30 point

thanks for that working like a charm now. I was playing with the %.3 wouldn’t of tried f. Keep up the good work. 

  Are you sure? yes | no

relay wrote 01/21/2018 at 22:23 point

It looks very nice!

I added logo's for eth, zec and bch and changed Monero to Ethereum

<code>

ethlogo = string.char(0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f, 0xf0, 0x07, 0xec, 0x1b, 0x98, 0x0c, 0x70, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00);
zeclogo = string.char(0xe0, 0x07, 0xf8, 0x1f, 0x1c, 0x38, 0x8e, 0x71, 0xe6, 0x67, 0xe3, 0xc7, 0x03, 0xc7, 0x83, 0xc3, 0xc3, 0xc1, 0xc3, 0xc0, 0xe3, 0xc7, 0xe6, 0x67, 0x8e, 0x71, 0x1c, 0x38, 0xf8, 0x1f, 0xe0, 0x07);
bchlogo = string.char(0xb6, 0x7f, 0x6e, 0x7f, 0x0e, 0x78, 0x06, 0x70, 0xc2, 0x71, 0xc6, 0x73, 0x8e, 0x61, 0x0e, 0x40, 0x0e, 0x47, 0x9e, 0x4f, 0x1e, 0x47, 0x1e, 0x61, 0x1e, 0x70, 0x0e, 0x78, 0x7e, 0x7b, 0xfe, 0x76);

</code>


Did you already take steps to alternate between two or more pages?

I would like to show two combinations, one page with BTC/ETH and a page with BCH/ZEC.

  Are you sure? yes | no

cryptooth wrote 01/22/2018 at 23:23 point

Thanks for eth symbol. Can you create USD symbol too?

  Are you sure? yes | no

djsimul wrote 01/24/2018 at 05:40 point

Here you go. I just made this the other day. :)

usdsym = string.char(0x80, 0x01, 0x80, 0x01, 0xe0, 0x0f, 0xf0, 0x0f, 0x70, 0x00, 0x70, 0x00, 0xf0, 0x01, 0xe0, 0x07, 0xc0, 0x0f, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0xf0, 0x0f, 0xf0, 0x07, 0x80, 0x01, 0x80, 0x01);

I also made a cleaner BTC logo as well as a ZEC logo:

btclogo = string.char(0x60, 0x01, 0x60, 0x01, 0xfc, 0x0f, 0xfc, 0x0f, 0x70, 0x1c, 0x70, 0x1c, 0x70, 0x1c, 0xf0, 0x0f, 0xf0, 0x1f, 0x70, 0x3c, 0x70, 0x38, 0x70, 0x3c, 0xfc, 0x1f, 0xfc, 0x0f, 0x60, 0x01, 0x60, 0x01);

zeclogo = string.char(0x80, 0x01, 0x80, 0x01, 0xf0, 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0x00, 0x0f, 0x80, 0x07, 0xc0, 0x03, 0xc0, 0x01, 0xe0, 0x01, 0xf0, 0x00, 0xf8, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0x80, 0x01, 0x80, 0x01);

I use the ZEC logo for ZCL, but it could also be used for any of the other Z coins. 

  Are you sure? yes | no

kieranc wrote 02/19/2018 at 22:14 point

To displays 2 pages alternately you could create 2 getrates files then set the timer to increment a counter and display one on even numbers, the other on odd.

  Are you sure? yes | no

adrian wrote 12/21/2017 at 00:27 point

Im having trouble with memory issues.

In my serial console i get:

E:M 5128
HTTP request failed

The unit then crashes and reboots. Ive deleted the update_display.lua  to troubleshoot and commented out the call to run the update_display.lua file. Still has the same issues. Any thoughts?

  Are you sure? yes | no

kieranc wrote 12/24/2017 at 09:55 point

I'm not sure, I've not seen this type of error before, how much heap space do you have free? What module type/firmware version/etc? If could be worth trying with just one currency, you could change the last line of getrates.lua to call getxmrrate instead of getbtcrate, see if that works?

  Are you sure? yes | no

BrieucDelbart wrote 12/18/2017 at 19:25 point

Can you share your 3D print case ? :-)

  Are you sure? yes | no

kieranc wrote 12/19/2017 at 08:22 point

It's linked above, on the left.

https://www.thingiverse.com/thing:857858

It's not the most convenient case, not a lot of room to fix the screen or wire it up, but it looks quite good.

  Are you sure? yes | no

deʃhipu wrote 12/18/2017 at 16:40 point

I think those OLED displays have too slow refresh rate for the recent changes in bitcoin prices ;-)

  Are you sure? yes | no

kieranc wrote 12/18/2017 at 17:08 point

I think the bigger problem was space on the screen for 6 digits, I eliminated the mantissa so we should be good until it hits a million ;-)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates