Skip to content

markomarkovic/cyd-crypto-ticker

Repository files navigation

πŸͺ™ CYD Crypto Ticker

A real-time cryptocurrency price display application for ESP32-based "Cheap Yellow Display" (CYD) boards from Sunton. Features a modern touchscreen interface built with LVGL to monitor your favorite cryptocurrencies with live price updates, trend indicators, and customizable display options.

✨ Features

  • Advanced Candlestick Charts: Interactive OHLCV charts with real-time data from Binance API
  • Dynamic Interval Selection: Touch-enabled interval selector with 14 timeframes (1m to 1M) and automatic refresh
  • Technical Analysis: 7-period moving averages with smooth line rendering
  • Interactive Price Inspection: Click-to-show-price with blue indicator line and precise price display
  • Real-time Crypto Prices: Live price updates from Binance WebSocket API (no API key required)
  • Multi-Currency Support: Display multiple cryptocurrencies simultaneously
  • Touch Interface: Modern LVGL-based GUI with touch controls
  • Visual Indicators: Color-coded price trends and status indicators
  • Hardware Integration: RGB LED status indicators and automatic brightness adjustment
  • WiFi Connectivity: Automatic connection management with retry logic
  • Modern Web Interface: PicoCSS v2-styled configuration portal with responsive design
  • Multi-Board Support: Compatible with 40+ different Sunton ESP32 display variants
  • Memory Efficient: Optimized for ESP32's limited RAM with 25% usage (82KB/327KB)

πŸ“Έ Screenshots

Physical Device

CYD Crypto Ticker Device ESP32-2432S028R (CYD) running the crypto ticker application

Configuration Mode

Configuration Mode Info
Initial configuration portal information screen

Configure via Phone
Web configuration interface accessed from phone

Main Display - Cryptocurrency Lists

Bull Market Display
Main view during bull market - all green indicators

Mixed Market Display
Mixed market conditions with varied price changes

Interactive Candlestick Charts

1 Hour Candles
1-hour candlestick chart with moving average

Interval Selection
Touch-based interval selector (1m to 1M)

1 Day Candles
Daily candlestick chart view

1 Minute Candles
Real-time 1-minute chart for day trading

Note: Screenshot capture functionality is available in the screenshots branch. See that branch's README for details.

πŸ› οΈ Hardware Requirements

Supported Boards

This project should supports all Sunton ESP32 display boards, you can check the boards documentation.

  • Primary Target: ESP32-2432S028R (CYD - Cheap Yellow Display)
  • Display: 240x320 ILI9341 TFT with SPI interface
  • Touch: XPT2046 resistive touchscreen controller
  • Additional Hardware: RGB LED, CdS light sensor, speaker output, TF card slot

πŸ“¦ Installation

Prerequisites

  1. uv: Install uv for running PlatformIO commands

    # Install uv (recommended)
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Or via pip
    pip install uv
  2. No API Key Required: Uses free Binance WebSocket API for real-time cryptocurrency data

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/your-username/cyd-crypto-ticker.git
    cd cyd-crypto-ticker
  2. Initialize submodules (for board definitions):

    git submodule update --init --recursive
  3. Configure the application:

    The application provides a web-based configuration interface. After first boot, connect to the device's WiFi configuration portal to set up your WiFi credentials and select up to 6 Binance USDT trading pairs through an HTML interface.

  4. Build and upload:

    # Using Makefile (recommended)
    make upload-monitor
    
    # Or using uv directly
    uv tool run platformio run -t upload -t monitor
    
    # See all available commands
    make help

πŸš€ Usage

Finding Cryptocurrency IDs

Use the included Python utility to discover available Binance trading pairs:

# Find specific trading pairs
python find_binance_symbols.py BTC ETH SOL

# List top 20 pairs by trading volume
python find_binance_symbols.py --list-top 20

# Search by cryptocurrency name
python find_binance_symbols.py --search bitcoin

# Show all USDT pairs
python find_binance_symbols.py --usdt-pairs

The utility will show available trading pairs that you can enter in the web configuration interface.

Board Configuration

To use a different CYD board variant, modify the board setting in platformio.ini:

[env:esp32-cyd]
board = esp32-2432S028R  ; Change this to your board model

Available board models are listed in the boards/ directory.

Display Orientation

The default orientation is portrait (240x320). To change to landscape mode, modify the rotation settings in your display configuration.

Web Configuration Interface

The application provides a built-in web interface for configuration:

  1. First Boot: Device creates a WiFi access point for initial setup
  2. Configuration Portal: Access the HTML configuration interface
  3. Settings: Configure WiFi credentials and select up to 6 Binance USDT trading pairs
  4. Save & Restart: Settings are saved and the device connects to your WiFi network

Button Controls

The BOOT button provides several configuration options:

  • Short Press (< 5 seconds): Cancel configuration mode and return to normal operation
  • Medium Press (5-9 seconds): Enter configuration mode to change WiFi/crypto settings
  • Long Press (10+ seconds): Factory reset - clear all stored data

πŸ”§ Development

Project Structure

β”œβ”€β”€ src/                           # Main application source code
β”‚   β”œβ”€β”€ main.cpp                   # Application entry point
β”‚   β”œβ”€β”€ ApplicationController.cpp  # Main app controller
β”‚   β”œβ”€β”€ BinanceDataManager.cpp     # Cryptocurrency data handling
β”‚   β”œβ”€β”€ NetworkManager.cpp         # WiFi and web config management
β”‚   β”œβ”€β”€ DisplayManager.cpp         # LVGL UI management
β”‚   └── HardwareController.cpp     # Hardware control and sensors
β”œβ”€β”€ include/                       # Header files
β”‚   β”œβ”€β”€ lv_conf.h                  # LVGL configuration
β”‚   └── constants.h                # Hardware constants, colors, and timing intervals
β”œβ”€β”€ picocss/                       # PicoCSS v2 build system for web interface
β”‚   β”œβ”€β”€ scss/minimal.scss          # Source SCSS with minimal PicoCSS build
β”‚   β”œβ”€β”€ package.json               # Node.js build tools and dependencies
β”‚   └── update-cpp.js              # Automated CSS embedding script
β”œβ”€β”€ boards/                        # Hardware board definitions (submodule)
β”œβ”€β”€ find_binance_symbols.py        # Utility to find Binance trading pairs
└── platformio.ini                 # Build configuration

Key Components

  • ApplicationController: Main application lifecycle management and WebSocket coordination
  • BinanceDataManager: Real-time cryptocurrency data management and chart data fetching
  • NetworkManager: WiFi connection, web configuration interface, and reconnection logic
  • DisplayManager: LVGL-based user interface and chart rendering using constants from constants.h
  • HardwareController: RGB LED status indicators and sensor management using hardware pin constants
  • WebSocketManager: Real-time WebSocket connections to Binance API with automatic reconnection

Configuration Architecture

  • Hardware Constants: Pin definitions, colors, timing intervals, and system limits defined in include/constants.h
  • User Configuration: WiFi credentials and cryptocurrency selections managed through web interface
  • Settings Storage: User configurations stored in ESP32 flash memory via NetworkManager
  • Unified Constants: All system limits (MAX_COINS, MAX_CANDLESTICKS) centralized in constants.h for consistency

Build Commands

See all available commands with make help. Common commands:

# Using Makefile
make build              # Build firmware
make upload-monitor     # Upload and monitor (most common)
make clean              # Clean build files
make update-deps        # Update dependencies
make all                # Clean, build, upload, and monitor

# Using uv directly
uv tool run platformio run                     # Build
uv tool run platformio run -t upload -t monitor  # Upload and monitor
uv tool run platformio run -t clean            # Clean
uv tool run platformio lib update              # Update dependencies

Memory Optimization

The project is optimized for ESP32's limited memory:

  • Size optimization enabled (-Os)
  • Function/data sections (-ffunction-sections, -fdata-sections)
  • Unused section removal (-Wl,--gc-sections)
  • Disabled C++ exceptions and RTTI
  • 32KB LVGL memory pool
  • Reduced logging levels

LVGL Configuration

Key LVGL settings in include/lv_conf.h:

  • 16-bit RGB565 color depth
  • 32KB heap allocation
  • 33ms refresh rate (30 FPS)
  • All major widgets enabled
  • Performance monitoring available

🀝 Contributing

We welcome contributions! Please follow these guidelines:

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Follow the existing code style and conventions
  4. Test your changes on actual hardware when possible
  5. Update documentation as needed

Code Style

  • Follow existing C++ conventions in the codebase
  • Use meaningful variable and function names
  • Add comments for complex logic
  • Keep functions focused and modular
  • Use const where appropriate

Submitting Changes

  1. Ensure your code builds without warnings
  2. Test on actual hardware if possible
  3. Update README.md if you add new features
  4. Commit with clear, descriptive messages
  5. Submit a pull request with detailed description

Reporting Issues

Please include:

  • Hardware board model
  • PlatformIO version
  • Complete error messages
  • Steps to reproduce
  • Expected vs actual behavior

πŸ›‘οΈ Security

Configuration Security

  • Cryptocurrency pairs are automatically converted to uppercase in the web interface
  • Access the configuration portal only when needed
  • Monitor API usage to avoid rate limits
  • Use HTTPS for all API communications

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Third-Party Licenses

  • LVGL: MIT License
  • esp32_smartdisplay: MIT License
  • ArduinoJson: MIT License
  • ESPAsyncWebServer: LGPL-3.0 License
  • PicoCSS: MIT License
  • Board Definitions: Various licenses (see boards/ directory)

πŸ™ Acknowledgments

  • Sunton for the affordable ESP32 display boards
  • LVGL for the excellent embedded graphics library
  • rzeldent for the esp32_smartdisplay library
  • Binance for the free WebSocket cryptocurrency API
  • PicoCSS for the minimal, semantic CSS framework
  • Claude Code for significant contributions to the code and documentation
  • The ESP32 and Arduino communities for excellent documentation and support

πŸ“ž Support

  • Documentation:
    • Online API documentation: Check GitHub Pages (automatically generated from code)
    • Development notes: See CLAUDE.md for detailed development guidelines
  • Issues: Report bugs and feature requests on GitHub Issues
  • Discussions: Join the community discussions for help and ideas
  • Hardware: Refer to boards/README.md for board-specific information

Happy crypto tracking! πŸš€πŸ“ˆ

About

A real-time cryptocurrency price display application for ESP32-based "Cheap Yellow Display" (CYD) boards from Sunton. Features a modern touchscreen interface built with LVGL to monitor your favorite cryptocurrencies with live price updates, trend indicators, and customizable display options.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors