8000
Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
< F635 /div>
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Mini TV Player (Button Controlled Edition)

A highly modified version of the Mini Lego TV project, originally created by Eric N. (ThatProject). This firmware turns an ESP32 into a standalone miniature TV that plays MJPEG video and AAC/MP3 audio directly from an SD card.

This customised version removes the original touch-screen dependency, replacing it with a robust single-button interface, introduces a dynamic channel system with a "random playback" feature, and adds full support for multiple hardware platforms including the popular Cheap Yellow Display (CYD).


✨ Key Features

  • Single-Button Interface: Navigate channels and toggle mute using just one physical button.
  • Dynamic Channels: No need to hardcode the number of videos. The system automatically scans the SD card on boot and sets up your channels.
  • "Random" Channel: A dedicated folder where the TV will endlessly shuffle through multiple videos.
  • Multi-Device Support: Easily switch between the original custom hardware and off-the-shelf boards like the CYD via config.h.
  • Internal & External DAC: Supports high-quality external I2S audio decoders as well as the ESP32's built-in 8-bit DAC.
  • Flexible Audio: Supports both .aac and .mp3 audio formats.

📺 Supported Devices

Currently, the project comes pre-configured for two hardware profiles:

  1. Mini TV: Uses an external I2S DAC (like MAX98357A) and an ST7789 288x240 display. Runs at 30 FPS. Recommend: https://www.instructables.com/Mini-ESP32-TV-remix/
  2. CYD (Cheap Yellow Display - 2432S028): Uses the ESP32's internal DAC (GPIO 26) and the built-in ILI9341 320x240 display. Runs at 24 FPS for optimal audio/video synchronization.

To switch between them, simply uncomment the desired #define BOARD_... at the top of config.h. Also check config.h for other options such as brightness and volume control


🕹️ Controls

Connect a single push button to the pin defined as MULTI_BUTTON in config.h (connects between the GPIO pin and GND). (Note: On the CYD, this defaults to GPIO 0, which is the "BOOT" button on the back of the board!)

  • Single Click: Next Channel
  • Double Click: Previous Channel
  • Long Press (1-3 Seconds): Toggle Mute / Unmute (Triggers on button release with visual feedback)
  • Hold (3+ Seconds): Reset / Reboot ESP32 to bootloader/launcher menu (Leaves mute state untouched)

Mute state and your last-watched channel are automatically saved and restored on reboot.


📁 SD Card Setup & File Structure

Your SD card must be formatted to FAT32.

Create a folder named Videos at the root of the SD card. Inside, create folders for each "Channel", starting at 1 and counting up sequentially. You can also create a folder named random.

SD_ROOT/
└── Videos/
    ├── 1/
    │   ├── video1.mjpeg
    │   └── video1.aac  (or .mp3)
    ├── 2/
    │   ├── my_show.mjpeg
    │   └── my_show.mp3
    └── random/
        ├── cartoon1.mjpeg
        ├── cartoon1.aac
        ├── advert.mjpeg
        └── advert.mp3

The Channel System

  • Numbered Channels (1, 2, 3...): The system expects one video per folder. It will look for the first .mjpeg file it finds. It will try to find an audio file with the exact same name (e.g., show.mjpeg -> show.aac). If it can't find an exact match, it will automatically fall back and play the first audio file it finds in that folder. When the video in channel 1 completes, it will change to channel 2 and so on.
  • The Random Channel (random): If this folder exists, it becomes Channel 0 (RANDOM). You can put as many videos as you want in this folder. The TV will pick one at random. When it finishes, it will seamlessly pick another random video, great for lots of shorter videos such as vintage TV adverts for example or just put all your videos in there and dont bother with the channel system. Note: In the random folder, audio files must have the exact same base name as the video file (e.g., advert.mjpeg and advert.mp3 or .aac).

Video & Sound Encoding

  • Mini TV: Encode videos at 288x240, 30fps.
  • CYD: Encode videos at 320x240, 24fps (The ESP32 struggles to decode 320x240 at 30fps while maintaining audio sync).

FFmpeg video example for CYD: ffmpeg -i input.mp4 -pix_fmt yuvj420p -q:v 8 -vf "fps=24,scale=320:240:flags=lanczos" output.mjpeg

FFmpeg audio example for CYD: ffmpeg -i input.mp4 -ar 44100 -ac 1 -ab 24k -filter:a loudnorm -filter:a "volume=-8dB" output.aac

Or you can find a GUI interface here: https://github.com/DynaMight1124/MiniTV-Video-Converter image


🛠️ Adding a New Device

The codebase is designed to be easily adaptable to new ESP32 setups. To add a new device, you primarily need to edit config.h.

  1. Create a new Profile: In config.h, add a new definition toggle (e.g., #define BOARD_MY_CUSTOM_ESP).

  2. Define Hardware Pins & Features: Create an #ifdef BOARD_MY_CUSTOM_ESP block. You will need to define:

    • Buttons & Pins: MULTI_BUTTON, BLK (backlight), display SPI pins (CS, DC, RST, MOSI, SCK), and SD Card SPI pins.
    • SPI Hosts: Assign DISPLAY_SPI_HOST and SD_SPI_HOST (use VSPI and HSPI). It is highly recommended to map these to the ESP32's hardware default pins to get 80MHz speeds.
    • Audio: If using an external DAC, define the I2S pins (I2S_DOUT, I2S_LRCLK, I2S_SCLK). If using the built-in ESP32 DAC, define #define USE_INTERNAL_DAC and set the unused I2S pins to -1.
    • Display Settings: Define SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_ROTATION, SCREEN_IPS, SCREEN_OFFSET_X/Y, and the GFX_CLASS (e.g., Arduino_ST7789 or Arduino_ILI9341).
    • Performance: Define VIDEO_FPS (start with 24 for 320x240 screens) and MAX_WIDTH (the physical width of your screen, used for memory allocation).
    • Launcher Reset: Define LAUNCHER_RESET (0 = Disabled, 1 = Retro-Go Launcher, 2 = CYD-Launcher).
  3. Update Display Driver (If needed): If your new board uses a display driver that isn't Arduino_ST7789 or Arduino_ILI9341, open MiniTV.ino, locate the /* Arduino_GFX */ section, and add your new class initialization.

    Ardruino IDE

Compiled for both MiniTV and CYD as ESP Dev Module, all other settings were left stock. Some projects require the partition scheme to be set as Huge APP.


🙌 Credits & Acknowledgements

Massive thanks to the open-source creators who made this possible:

Modified and updated for Button Control, Dynamic Channels, and CYD Support.

About

Another MiniTV, heavily based on the work of others but with some QOL stuff.

Topics

Resources

Stars

32 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages

0