📈 Live Crypto/Stocks Ticker
Fetch live market data from REST APIs and display it on a colorful TFT LCD.
Overview
The ESP32 can make HTTPS GET requests to public APIs (like CoinGecko or AlphaVantage) to fetch JSON data. We parse this JSON to extract the current price and display it.
What you'll learn: HTTPClient, JSON parsing (ArduinoJson), and drawing text/shapes on an SPI TFT display.
Estimated time: 3-4 hours. Difficulty: ⭐⭐⭐ Intermediate.
Components Needed
| Component | Specification | Qty | Notes |
|---|---|---|---|
| ESP32 Development Board | WiFi | 1 | |
| ILI9341 TFT Display | 2.8" SPI | 1 | Or any ST7739 / ST7789 |
| Jumper Wires | Female-to-Female | 9 | For SPI connection |
Step-by-Step Tutorial
1
SPI Wiring
Connect TFT SCK to GPIO 18, MOSI to 23, MISO to 19, CS to 5, DC to 2, RST to 4.
2
Install Libraries
Install TFT_eSPI and ArduinoJson libraries.
3
Configure TFT_eSPI
You must edit User_Setup.h in the TFT_eSPI library folder to match your exact display and pinout.
4
Fetch & Parse
The ESP32 downloads the JSON string, parses it for the "price" key, and updates the screen every 60 seconds.
ArduinoJson is incredibly powerful, but you must allocate the correct buffer size. Use the ArduinoJson Assistant website to calculate the exact size you need based on the API response.
Code / Configuration
crypto_ticker.ino
INO
// Crypto Ticker (Conceptual)
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASS";
const char* url = "https://api.coindesk.com/v1/bpi/currentprice/BTC.json";
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
WiFi.begin(ssid, password);
while(WiFi.status() != WL_CONNECTED) delay(500);
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(url);
int httpCode = http.GET();Reviews & Ratings
—0 reviews
Sign in to leave a review
Loading reviews...