Introduction: Simple Bitcoin Ticker
This is a Simple Bitcoin or any other ALT coin Ticker.
Showing a Single Coin Price on 8x 7 segment Display.
Display is large, bright and simple to read.
Price quote from coinmarketcap.com free API are updated every 5min.
Easy print and build.
Code id based on Hector de Isidro worke: https://medium.com/@hector6872/internet-of-things-from-zero-to-diy-bitcoin-ticker-7ae22f5dd269
Step 1: Part List
NodeMcu V3
MAX7219 LED Dot Matrix 8 Digit Display
5x7 PCB board
5x Male Pin Header Connector
2x x5 Female Dupont Cable Jumper Wire Pin Header Housing
22AWG wire
2x 3M screws
4x 2M screws
Step 2: Print
STL file's are available at :
https://www.thingiverse.com/thing:3620420
1x Simple Bitcoin Ticker Box
1X Simple Bitcoin Ticker Cover
Step 3: Electronics
Connect 5 male headers to NodeMCU Board.
- 3v
- gnd
- dataPin = D5
- csPin = D6
- clockPin = D7
vin - 12v DC power source
g - power source ground
Step 4: Coinmarketcap.com API
Create a Free account at:
https://coinmarketcap.com/api/
Copy API Key you will need it in the next step.
Step 5: Code
Install LedControl Library using Library Manager in Arduino IDE.
Download Simple_Bitcoin_Ticker.ino from:
https://github.com/Nimrod-Galor/Simple-Bitcoin-Tic...
Open File In Arduino IDE and update lines:
- #define STASSID "SSID"; (Where SSID is your WiFi network name.)
- #define STAPSK "PASSWORD"; (Where PASSWORD is network Password)
- const String API_KEY = "API_KEY"; (Where API_KEY is your coinmarketcap.com API Key)
Upload Sketch to NodeMCU.
Step 6: Assembly
- Connect Display to Box.
- Connect dc Jack to Box.
- Screw PBC to Box.
- Connect Power IN wire.
- Connect Display wire.
- Connect NodeMCU Board.
- Pop on Cover.
Connect to a DC 12V power source, wait for a min while NodeMCU connects to you WiFi, and You are Done!
Enjoy.
18 Comments
1 year ago
Hi!!!
How are you?
Since yesterday I am experimenting some issues with the ticker...
:46:01.208 -> Date: Mon, 29 Mar 2021 11:46:02 GMT
08:46:01.208 -> Content-Type: application/json; charset=utf-8
08:46:01.208 -> Transfer-Encoding: chunked
08:46:01.208 -> Connection: close
08:46:01.208 -> Set-Cookie: __cfduid=dcc47c40bbe1b68f90f2f9a8f6f00e78f1617018361; expires=Wed, 28-Apr-21 11:46:01 GMT; path=/; domain=.coinmarketcap.com; HttpOnly; SameSite=Lax; Secure
08:46:01.208 -> vary: origin,accept-encoding
08:46:01.208 -> cache-control: no-cache
08:46:01.208 -> CF-Cache-Status: DYNAMIC
08:46:01.208 -> cf-request-id: 091f6730120000f2035e055000000001
08:46:01.255 -> Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
08:46:01.255 -> Server: cloudflare
08:46:01.255 -> CF-RAY: 6378daf9bf39f203-GRU
08:46:01.255 ->
08:46:01.255 -> 5b8
08:46:01.303 -> {"status":{"timestamp":"2021-03-29T11:46:02.321Z","error_code":0,"error_message":null,"elapsed":18,"credit_count":1,"notice":null},"data":{"BTC":{"id":1,"name":"Bitcoin","symbol":"BTC","slug":"bitcoin","num_market_pairs":9471,"date_added":"2013-04-28T00:00:00.000Z","tags":["mineable","pow","sha-256","store-of-value","state-channels","coinbase-ventures-portfolio","three-arrows-capital-portfolio","polychain-capital-portfolio","binance-labs-portfolio","arrington-xrp-capital","blockchain-capital-portfolio","boostvc-portfolio","cms-holdings-portfolio","dcg-portfolio","dragonfly-capital-portfolio","electric-capital-portfolio","fabric-ventures-portfolio","framework-ventures","galaxy-digital-portfolio","huobi-capital","alameda-research-portfolio","a16z-portfolio","1confirmation-portfolio","winklevoss-capital","usv-portfolio","placeholder-ventures-portfolio","pantera-capital-portfolio","multicoin-capital-portfolio","paradigm-xzy-screener"],"max_supply":21000000,"circulating_supply":18667718,"total_supply":18667718,"is_active":1,"platform":null,"cmc_rank":1,"is_fiat":0,"last_updated":"2021-03-29T11:45:02.000Z","quote":{"USD":{"price":57935.909019262865,"volume_24h":54247443627.20762,"percent_change_1h":0.38435914,"percent_change_24h":3.17173716,"percent_change_7d":-0.38657157,"percent_change_30d":23.42378904,"percent_change_60d":84.61885447,"percent_change_90d":116.7252174,"market_cap":1081531211645.2557,"last_updated":"2021-03-29T11:45:02.000Z"}}}}}
08:46:01.443 -> 0
08:46:01.443 ->
08:46:01.443 -> Deserialization failed
08:46:01.443 -> Not enough memorydoc capacity:
Any Idea how to solve it?
Thanks in advance
Reply 1 year ago
update sketch:
-- DynamicJsonDocument jsonDocument(2024);
++ DynamicJsonDocument jsonDocument(4096);
Reply 1 year ago
New error...
Maybe it will help to solve it.
09:05:12.567 -> connecting to pro-api.coinmarketcap.com
09:05:12.567 -> Using fingerprint '335b4fc7b2e210256ed6f2f900744ea21f436195'
09:05:34.281 -> connection failed
09:05:34.281 -> connecting to pro-api.coinmarketcap.com
09:05:34.281 -> Using fingerprint '335b4fc7b2e210256ed6f2f900744ea21f436195'
09:05:49.752 -> requesting URL: /v1/cryptocurrency/quotes/latest?CMC_PRO_API_KEY=c6e48ded-54e1-4c8a-8cfa-c1a15043f72e&symbol=BTC&convert=USD
09:05:50.033 -> request sent
09:05:55.032 -> Unexpected response:
09:05:55.032 ->
Question 1 year ago
Let me say, thank you so much for this! It is very clearly written and easy to implement. Everything works perfect on my end but I have a quick question for you:
This code is setup to display any price over $1 and rounds up the price to the whole dollar amount without showing the cents (i.e. $ .56)
I want to track price for a stock that is under $1. Is there a way to adjust the code that would display that price?
Answer 1 year ago
You can download updated sketch at:
https://github.com/Nimrod-Galor/Simple-Bitcoin-Ticker/tree/Simple-Bitcoin-Ticker-With_floating-Point
Reply 1 year ago
Hi,
Tray following changes:
@ row number replace all rows after ------------ with rows after ++++++++++
@182-------
printPrice(99999999);
++++++++++++++++++++++++++++++++++++++++++++
printPrice(999999, 1);
@296-------
Serial.println(price, 2);
++++++++++++++++++++++++++++++++++++++++++++
Serial.println(price);
//find floating point index
int left_part, right_part;
char buffer[50];
sprintf(buffer, "%lf", price);
sscanf(buffer, "%d.%d", &left_part, &right_part);
@298--------
printPrice((int)price);
++++++++++++++++++++++++++++++++++++++++++++
printPrice((int)left_part, (int)right_part);
@307----------
void printPrice(int price){
// reset
for(int index=0;index<lc.getDeviceCount();index++) {
lc.clearDisplay(index);
}
int index = floor((8-sizeof(price)) /2);
while(price > 0){
lc.setDigit(0, index, price%10, false);
price = price/10;
index++;
}
}
++++++++++++++++++++++++++++++++++++++++++++
void printPrice(int left_part, int right_part){
// reset
for(int index=0;index<lc.getDeviceCount();index++) {
lc.clearDisplay(index);
}
int sofl = intLength(left_part);
int sofr = intLength(right_part);
int exss = min((8 - sofl), sofr);
if(exss == 2){
right_part = float(right_part / 10000);
}else if(exss == 3){
right_part = float(right_part / 1000);
}else if(exss == 4){
right_part = float(right_part / 100);
}else if(exss == 5){
right_part = float(right_part / 10);
}
int index = floor((8-(sofl + exss)) /2);
bool pfFlag = false;
while(exss > 0){
lc.setDigit(0, index, right_part%10, pfFlag);
right_part = right_part/10;
index++;
exss--;
}
pfFlag = true;
while(sofl > 0){
lc.setDigit(0, index, left_part%10, pfFlag);
left_part = left_part/10;
index++;
sofl--;
pfFlag = false;
}
}
int intLength(int i){
if(i > 9999999)
return 8;
else if(i > 999999)
return 7;
else if(i > 99999)
return 6;
else if(i > 9999)
return 5;
else if(i > 999)
return 4;
else if(i > 99)
return 3;
else if(i > 9)
return 2;
else
return 1;
}
Reply 1 year ago
Wow! Thank you so much for the quick reply. I'm going to give it a shot!!
2 years ago
Hi Excellent work, thanks! Quick question: The code works great to fetch info from coinmarketcap, however it is not showing the price properly in my LED display. I have 4 (8x8) MAX7219 1088AS dot matrix and an NodeMCU V3. How can the LED control part of the code be adapted to work with a 8X32 set up. Thanks
Question 2 years ago
Hi! Excellent post! I try to do it, but I am getting an error with the API implementation.
"
18:34:57.889 -> connecting to pro-api.coinmarketcap.com
18:34:57.889 -> Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
18:34:58.589 -> connection failed
"
Any idea how to Solve it? Thanks in advance.
Reply 2 years ago
Hi sorry for the late reply.
You need to replace the fingerprint to match the new coinmarketcap.com ssl.
1. in chrome go to coinmarketcap.com.
2. click the lock icon next to url bar.
3. click certificate. certificate window popup.
4. in the details tab copy value of field "Thumbprint".
5. in arduino sketch find the row:
const char fingerprint[] PROGMEM = "d3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a";
and replace the fingerprint (d3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a)
with the new value you copied.
6. upload the updated sketch to you board.
Reply 2 years ago
Hi! Thank you so much for your reply.
Tonight I will try to test that.
I will keep you up to date.
Thanks again.
Reply 2 years ago
try downloading the updated sketch from github:
https://github.com/Nimrod-Galor/Simple-Bitcoin-Ticker/blob/master/Simple_Bitcoin_Ticker.ino
this new sketch has some new error alert that will mack it easier to debug.
Reply 2 years ago
Thank you so much! It is working Excellent!
Just one more question. Why did you Power the MCU with the 12V port and you don't use the USB Cable as an "Input Voltage Source" ?
Because I think it is more simple to power it up with a USB cable and not a 12V transformer plugged in into the wall.
What do you think about that?
Thanks in advance
2 years ago on Step 6
Does not work... :(
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
connecting to pro-api.coinmarketcap.com
Using fingerprint 'd3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a'
connection failed
Reply 2 years ago
Hi,
You need to replace the fingerprint to match the new coinmarketcap.com ssl.
1. in chrome go to coinmarketcap.com.
2. click the lock icon next to url bar.
3. click certificate. certificate window popup.
4. in the details tab copy value of the "Thumbprint" field.
5. in arduino sketch find the row:
const char fingerprint[] PROGMEM = "d3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a";
and replace the fingerprint (d3 79 2d dd ac 1f ed 90 8a a9 c1 c0 74 2d cf ff 6d 86 bf 0a)
with the new value you copied.
6. upload the updated sketch to you board.
Reply 2 years ago
Updated the thumbprint, now this:
Date: Fri, 07 Aug 2020 05:50:20 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=db7ad6b0cee181ba3dc719689a0b7fc401596779419; expires=Sun, 06-Sep-20 05:50:19 GMT; path=/; domain=.coinmarketcap.com; HttpOnly; SameSite=Lax; Secure
vary: origin
cache-control: no-cache
CF-Cache-Status: DYNAMIC
cf-request-id: 0469116f8f000063174326a200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5beeb82c1fac6317-BKK
2e5{"status":{"timestamp":"2020-08-07T05:50:20.479Z","error_code":0,"error_message":null,"elapsed":15,"credit_count":1,"notice":null},"data":{"BTC":{"id":1,"name":"Bitcoin","symbol":"BTC","slug":"bitcoin","num_market_pairs":8506,"date_added":"2013-04-28T00:00:00.000Z","tags":["mineable","sha-256","state-channels","pow","store-of-value"],"max_supply":21000000,"circulating_supply":18453681,"total_supply":18453681,"is_active":1,"platform":null,"cmc_rank":1,"is_fiat":0,"last_updated":"2020-08-07T05:49:42.000Z","quote":{"USD":{"price":11780.7824713,"volume_24h":23158375837.232,"percent_change_1h":-0.287996,"percent_change_24h":1.15242,"percent_change_7d":6.32078,"market_cap":217398801655.76187,"last_updated":"2020-08-07T05:49:42.000Z"}}}}}
0
Deserialization failed
Reply 2 years ago
You can try updating sketch:
--- DynamicJsonDocument jsonDocument(1024);
++ DynamicJsonDocument jsonDocument(2024);
If that does not work try downloading the updated sketch from github:
https://github.com/Nimrod-Galor/Simple-Bitcoin-Tic...
this new sketch has some new error alert that will mack it easier to debug.
Reply 2 years ago
Went straight to the updated sketch on github. Working. Thank you!