A project that displays weather information, news, cryptocurrency prices, MotoGP / Formula1 calendars and stock market data on an ESP32 with a TFT display. The ESP32-2432S028 is a 2.4" TFT display with a resolution of 240x320 pixels which is perfect for this project.
graph LR
subgraph ESP32["ESP32 Display"]
E[ESP32 Board]
T[TFT Display]
E --> T
end
subgraph Backend["Go Backend"]
B[API Server]
W[Weather API]
M[MotoGP API]
F[F1 API]
C[Crypto API]
N[News API]
S[Stock API]
end
E <-->|HTTP Requests| B
B <-->|Data Fetch| W
B <-->|Data Fetch| M
B <-->|Data Fetch| F
B <-->|Data Fetch| C
B <-->|Data Fetch| N
B <-->|Data Fetch| S
backend/
: Go API backendesp32/
: ESP32 display code
- Navigate to the backend directory:
cd backend
- Install dependencies:
go mod tidy
- Run the server:
go run main.go
The API will be available at http://localhost:5173/api
with the following endpoints:
GET /api/motogp
- Get MotoGP season dataGET /api/motogpnextrace
- Get next MotoGP raceGET /api/formula1
- Get Formula 1 season dataGET /api/formula1nextrace
- Get next Formula 1 raceGET /api/weather
- Get weather data for a locationGET /api/crypto
- Get cryptocurrency price dataGET /api/news
- Get top news headlinesGET /api/finance
- Get stock market data
The API documentation is available at http://localhost:5173/docs/
and provides:
- Interactive Swagger UI interface
- Detailed API endpoint documentation
- Request/response schemas
- Try-it-out functionality for testing endpoints
The documentation is automatically generated from the OpenAPI specification and includes:
- All available endpoints
- Required parameters
- Response formats
- Example requests and responses
-
Install required libraries in Arduino IDE:
- TFT_eSPI
- ArduinoJson
- HTTPClient
- LVGL
-
Configure TFT_eSPI:
- Edit the
User_Setup.h
file in the TFT_eSPI library - Uncomment the correct display configuration for your ESP32 board
- Edit the
-
Update the following in
esp32/src/main.cpp
:- WiFi credentials (
ssid
andpassword
) - API endpoint URL (
BASE_URL
) - Location and timezone settings
- WiFi credentials (
-
Upload the code to your ESP32
- ESP32 development board
- TFT display compatible with TFT_eSPI library
- USB cable for programming
- Power supply
The display automatically switches between screens every 10 seconds, showing:
-
Weather Information
- Location
- Current date and time
- Temperature
- Humidity
- Weather conditions
-
MotoGP Calendar
- Race name
- Circuit
- Date
- Next race information
-
Formula 1 Calendar
- Race name
- Circuit
- Date
- Next race information
-
Stock Market
- Multiple stock symbols
- Current price
- Price change
- Market data
-
Cryptocurrency
- Multiple crypto symbols
- Current price
- 24h change
- Market cap
-
News Headlines
- News title
- Source
- Multiple headlines across two screens
-
About Screen
- Version information
- Author details
- GitHub repository link
- Weather data: Every 60 minutes
- MotoGP data: Every 60 minutes
- Formula 1 data: Every 60 minutes
- Cryptocurrency data: Every 60 minutes
- News data: Every 60 minutes
- Stock market data: Every 60 minutes
The project can be configured through:
- Backend configuration file (
config.yaml
) - Environment variables (
api.env
) - ESP32 source code settings
The project supports:
- Test mode for development
- ICS to JSON conversion for calendar data
- CORS support for API endpoints
- HTTP caching for improved performance