GET BITCOIN LIVE PRICE TTGO ESP32

by RonFrtek in Circuits > Arduino

5255 Views, 13 Favorites, 0 Comments

GET BITCOIN LIVE PRICE TTGO ESP32

Get BITCOIN LIVE PRICE TTGO ESP32 - Cryptocurrency Tutorial

In this tutorial we will learn how to get a current Bitcoin price in USD and EUR using a TTGO ESP32 and Visuino.

Watch the video.

(New Updated File for Download below!)

What You Will Need

esp32-lilygo.jpg
VisuinoAdvrtisementRaspberryPiRobot.jpg
Wifi-1-icon.png

Start Visuino, and Select the Arduino TTGO T-Display ESP32 Board Type

2020-09-02_20-21-47.jpg
2020-09-02_20-21-11.jpg

The Visuino: https://www.visuino.eu needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "TTGO T-Display ESP32" as shown on Picture 2

In Visuino Set WiFi

2020-09-02_20-25-32.jpg
2020-09-02_20-25-54.jpg
2020-09-02_20-26-16.jpg
2020-09-02_20-32-59.jpg
2020-09-02_20-35-54.jpg
2020-09-02_20-36-15.jpg

Select TTGO T-Display ESP32 board and in the properties window expand "Modules>WiFi>Connect To Access Points

  • Click on the Connect To Access Points 3 Dots
  • In the AccessPoints window drag "WiFi Access Point" to the left side
  • In the properties window set SSID (name of your WiFi hotspot or router)
  • In the properties window set Password (password of your WiFi hotspot or router)
  • Close AccessPoints window

Select TTGO T-Display ESP32 board and in the properties window expand "Modules>WiFi>Sockets

  • Click on the Sockets 3 Dots
  • In the Sockets window drag TCP/IP Secure Client (SSL) to the left
  • In the properties window set Host to: blockchain.info
  • Close Sockets window

In Visuino Set Display

2020-09-02_20-41-53.jpg
2020-09-02_20-44-32.jpg
2020-09-02_20-46-49.jpg
2020-09-02_21-03-34.jpg
2020-09-02_21-02-58.jpg
bitcoin-icon (3).png
2020-09-02_21-02-41.jpg
2020-09-02_21-17-16.jpg
2020-09-02_21-17-39.jpg

Select TTGO T-Display ESP32 board and in the properties window expand "Modules>Display>Orientation

Set Orientation to:goRight

Select TTGO T-Display ESP32 board and in the properties window expand "Modules>Display>Elements

Click on the Elements 3 Dots

In the Elements window drag Draw Bitmap to the left

In the properties window set Y to 20, Click on the Bitmap 3 Dots

In the Bitmap Editor Load the Bitcoin bitmap (picture 6) and close the Bitmap editor

In the Elements window drag Draw Text to the left

In the properties window set color to aclOrange, size to 2, text to USD, X to 150, Y to 10

In the Elements window drag Text Field to the left

In the properties window set size to 3, X to 100, Y to 35

In the Elements window drag Draw Text to the left

In the properties window set color to aclOrange, size to 2, text to EUR, X to 150, Y to 80

In the Elements window drag Text Field to the left
In the properties window set size to 3, X to 100, Y to 105

Close the Elements window

In Visuino Add Components

2020-09-02_21-20-14.jpg
2020-09-02_21-20-47.jpg
2020-09-02_21-21-08.jpg
2020-09-02_21-21-28.jpg
2020-09-02_21-27-52.jpg
2020-09-02_21-28-07.jpg
2020-09-02_21-32-25.jpg
2020-09-02_21-34-26.jpg
2020-09-02_21-35-05.jpg
2020-09-02_21-35-22.jpg
2020-09-02_21-35-46.jpg

  • Add "HTTP Client" component
  • Select and in the properties window set Host to api.coindesk.com
  • Click on the Requests 3 Dots
  • In the requests window drag "GET" to the left
  • In the properties window set URL to: /v1/bpi/currentprice.json
  • Close the requests window
  • Add "HTTP Client" component "Char To Text" component
  • Select "CharToText1" and in the properties window se Max Length to 2000
  • Add "Clock Generator" component
  • Select "ClockGenerator1" and in the properties window set frequency to 0.1
  • Add "Delay" component
  • Select "Delay1" and in the properties window set Interval to 2000000
  • Add "Split JSON Object" component

In Visuino Parsing JSON

2020-09-02_21-42-11.jpg
2020-09-02_21-45-15.jpg

  • With the mouse right click on the "SplitJSON1" and in the menu click on the "Parse JSON Object.."
  • In the "JSON Object" window paste this sample code(avalible on https://www.coindesk.com/coindesk-api:


{"time":{"updated":"Sep 18, 2013 17:27:00 UTC","updatedISO":"2013-09-18T17:27:00+00:00"},"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index. Non-USD currency data converted using hourly conversion rate from openexchangerates.org","bpi":{"USD":{"code":"USD","symbol":"$","rate":"126.5235","description":"United States Dollar","rate_float":126.5235},"GBP":{"code":"GBP","symbol":"£","rate":"79.2495","description":"British Pound Sterling","rate_float":79.2495},"EUR":{"code":"EUR","symbol":"€","rate":"94.7398","description":"Euro","rate_float":94.7398}}}

  • Close the "JSON Object" window
  • "SplitJSON1" component will now create new pins

In Visuino Connecting Components

2020-09-02_21-47-33.jpg
2020-09-02_21-47-48.jpg
btc.png

  • Connect "ClockGenerator1" pin Out to "HTTPClient1" pin Clock and "Delay1" pin Start
  • Connect "HTTPClient1" pin Content to "CharToText1" pin In
  • Connect "HTTPClient1" pin to TTGO T-Display ESP32 > WiFi>TCP Secure Client1 pin In
  • Connect "Delay1" pin Out to "CharToText1" pin Clock and TTGO T-Display ESP32 > WiFi>TCP Secure Client1 pin Disconnect
  • Connect "CharToText1" pin Out to "SplitJSON1" pin In
  • Connect "SplitJSON1>USD>rate_float to TTGO T-Display ESP32>Text Field1 pin In
  • Connect "SplitJSON1>EUR>rate_float to TTGO T-Display ESP32>Text Field1 pin In

Note: you can also play with the other pins from "SplitJSON1" component

Generate, Compile, and Upload the Code

2020-09-02_22-01-12.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the TTGO ESP32 module it will connect to the network and display the current Bitcoin price in USD and EUR

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu

Note: In the File Project when you open it in Visuino, change the WiFi settings (Access point and password) to your settings.

Troubleshooting

2021-04-22_16-49-54.jpg
2021-04-22_16-52-43.jpg

In case you dont get any data:

  1. make sure that you are using the latest Visuino version
  2. check that you entered correct WiFi settings
  3. connect "SplitJSON1" pin "rate_float" to serial [0] pin, upload and click connect button and see if you get any data there (see attached pictures )