https://github.com/mcauser/micropython-esp8266-nokia-5110-bitcoin
MicroPython library for displaying bitcoin price index on a Nokia 5110 display with PCD8544 driver
https://github.com/mcauser/micropython-esp8266-nokia-5110-bitcoin
bitcoin coinbase-api esp8266 micropython nokia-5110 pcd8544 wemos-d1-mini
Last synced: 12 months ago
JSON representation
MicroPython library for displaying bitcoin price index on a Nokia 5110 display with PCD8544 driver
- Host: GitHub
- URL: https://github.com/mcauser/micropython-esp8266-nokia-5110-bitcoin
- Owner: mcauser
- License: mit
- Created: 2017-05-23T07:17:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-07T16:06:52.000Z (almost 8 years ago)
- Last Synced: 2025-04-04T15:50:43.710Z (about 1 year ago)
- Topics: bitcoin, coinbase-api, esp8266, micropython, nokia-5110, pcd8544, wemos-d1-mini
- Language: Python
- Size: 688 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](http://www.coindesk.com/price/) and their free [Bitcoin Price Index API](http://www.coindesk.com/api/).
Prices are converted to Australian dollars (AUD) using hourly conversion rate from [openexchangerates.org](https://openexchangerates.org/).
You can change this to another currency by changing the api endpoint.
Prices are updated around every 84 seconds.

The 84x48 PCD8544 buffer:

## Initial setup
1. Copy the files to your ESP8266 board
* using WebREPL
* See [ESP8266 QuickRef](http://docs.micropython.org/en/latest/esp8266/esp8266/quickref.html#webrepl-web-browser-interactive-prompt)
* using ampy
* see [Adafruit ampy guide](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/file-operations)
* 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
```python
>>> 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.
```python
>>> 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.
```python
>>> import upip
>>> upip.install('micropython-urequests')
```
Did it install?
```python
>>> import os
>>> os.listdir()
['boot.py', 'lib']
>>> os.listdir('lib')
['urequests.py']
```
Yes!
4. Run the demo
```python
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
* [WeMos D1 Mini](http://www.aliexpress.com/store/product/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/1331105_32529101036.html) $4.00 USD
* [Nokia 5110 module](https://www.aliexpress.com/w/wholesale-Nokia-5110.html?groupsort=1&SortType=price_asc&g=y&SearchText=Nokia+5110) $1.77 USD
* [Breadboard 400 point](https://www.aliexpress.com/w/wholesale-breadboard.html?groupsort=1&SortType=price_asc&g=y&SearchText=Breadboard+400+point) $0.90 USD
* [Jumper wire](https://www.aliexpress.com/w/wholesale-breadboard.html?groupsort=1&SortType=price_asc&g=y&SearchText=65+breadboard+jumper+cables) $1.09 USD
## 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
* [MicroPython PCD8544 Driver](https://github.com/mcauser/micropython-pcd8544)
* [WeMos D1 Mini](https://www.wemos.cc/product/d1-mini.html)
* [micropython.org](http://micropython.org)
## Credits
* Bitcoin Logo [Wikipedia](https://commons.wikimedia.org/wiki/File:Bitcoin_logo.svg) (Creative Commons CC0 1.0)
## License
Licensed under the [MIT License](http://opensource.org/licenses/MIT).