Coder Social home page Coder Social logo

mcauser / micropython-esp8266-nokia-5110-bitcoin Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 0.0 704 KB

MicroPython library for displaying bitcoin price index on a Nokia 5110 display with PCD8544 driver

License: MIT License

Python 100.00%
micropython wemos-d1-mini esp8266 nokia-5110 pcd8544 bitcoin coinbase-api

micropython-esp8266-nokia-5110-bitcoin's Introduction

MicroPython ESP8266 Nokia 5110 Bitcoin Price Index

A MicroPython library for displaying bitcoin price index on a Nokia 5110 display with PCD8544 driver.

Powered by CoinDesk and their free Bitcoin Price Index API.

Prices are converted to Australian dollars (AUD) using hourly conversion rate from openexchangerates.org. You can change this to another currency by changing the api endpoint.

Prices are updated around every 84 seconds.

demo

The 84x48 PCD8544 buffer:

demo

Initial setup

  1. Copy the files to your ESP8266 board

    • using WebREPL
    • using ampy
    • compiling into the firmware
      • make erase
      • copy bitcoin_ticker.py to /esp8266/modules
      • copy bitcoin_ticker_test.py to /esp8266/modules
      • copy pcd8544.py to /esp8266/modules
      • make deploy
  2. Connect to WiFi, credentials are persisted, so you wont need to enter them each time

    >>> import network
    >>> sta_if = network.WLAN(network.STA_IF);
    >>> sta_if.active(True)
    >>> sta_if.scan()
    >>> sta_if.connect("ssid","pass")
    >>> sta_if.isconnected()

    Disable the AP, unless you need it.

    >>> ap_if = network.WLAN(network.AP_IF)
    >>> ap_if.active(False)
  3. Install urequests with upip. You need to be on WiFi for this to work.

    >>> import upip
    >>> upip.install('micropython-urequests')

    Did it install?

    >>> import os
    >>> os.listdir()
    ['boot.py', 'lib']
    >>> os.listdir('lib')
    ['urequests.py']

    Yes!

  4. Run the demo

    import bitcoin_ticker_test

Example Coindesk API json response:

{
	"time":{
		"updated":"May 23, 2017 07:14:00 UTC",
		"updatedISO":"2017-05-23T07:14:00+00:00",
		"updateduk":"May 23, 2017 at 08:14 BST"
	},
	"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org",
	"bpi":{
		"USD":{
			"code":"USD",
			"rate":"2,214.9088",
			"description":"United States Dollar",
			"rate_float":2214.9088
		},
		"AUD":{
			"code":"AUD",
			"rate":"2,955.7979",
			"description":"Australian Dollar",
			"rate_float":2955.7979
		}
	}
}

bpi.AUD.rate_float is parsed from the json and displayed on the LCD.

Parts

Connections

WeMos D1 Mini Nokia 5110 PCD8544 LCD
D3 (GPIO0) 0 RST
D4 (GPIO2) 1 CE
D8 (GPIO15) 2 DC
D7 (GPIO13) 3 Din
D5 (GPIO14) 4 Clk
3V3 5 Vcc
D6 (GPIO12) 6 BL
G 7 Gnd

Links

Credits

  • Bitcoin Logo Wikipedia (Creative Commons CC0 1.0)

License

Licensed under the MIT License.

micropython-esp8266-nokia-5110-bitcoin's People

Contributors

mcauser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.