FREEWING-JP / ESP32_BadApple_MP3

Bad Apple Video on ESP32 with SSD1306 OLED with MP3

Home Page:http://www.neko.ne.jp/~freewing/hardware/espressif_esp32_bad_apple_demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESP32_BadApple_MP3

  • ESP32で東方の Bad Apple!!の動画を 128 x 64 dotの OLED SSD1306で再生する!
    http://www.neko.ne.jp/~freewing/hardware/espressif_esp32_bad_apple_demo/

  • Caution ! Not committing MP3 files
    I have not committed the MP3 file due to copyright infringement .
    Place it in the data directory with the file name of "ba.mp3" by yourself .
    "ba.mp3" MP3 Encoding Layer-3 Lame 22050HZ 40kbps Mono, duration 3:39.220, 1096379 bytes

Touhou Bad Apple!! Demo ESP32 with MP3 Audio I2S DAC and SSD1306 OLED (128x64 dot) YouTube https://youtu.be/GdZhwBkUALo

Touhou Bad Apple!! Demo ESP32 with MP3 Audio and SSD1306 OLED (128x64 dot) YouTube https://youtu.be/B9TrOxXer4E

ESP32 I2S Audio Schematics

No DAC
No DAC
MAX98357
MAX98357
CS4344
CS4344

Upload SPIFFS via command line

See this commit ba59205
00_Write_SPIFFS.bat


Freenove ESP32 Breadboard Wiring

Freenove Ultimate Starter Kit for ESP32 FNK0047
Freenove ESP32-WROVER Breadboard Wiring
image

  • I confirmed
DAC Note
ES7148 Good
CS4344 with MCLK Good
MAX98357A But Audio quality problem
PCM5102A Not Tested

ESP32 I2S DAC Audio Comparison YouTube https://youtu.be/4GXgd6Nbv94

#define ENABLE_I2S_DAC
#define I2S_BCLK  12 /* Bit Clock */
#define I2S_LRC   2 /* Left/Right */

  #define I2S_DOUT  15 /* Audio Data */

  // Normary Use Maxim MAX98357 I2S DAC it no need MCLK
  // #define USE_CS4344_DAC
  #ifdef USE_CS4344_DAC
    // Cirrus Logic CS4344 I2S DAC need MCLK
    #define I2S_MCLK 0 /* Master Clock */
  #endif

  #define ADJUST_MP3_PRE_LOOP 700/1000

#define I2C_SCL 13
#define I2C_SDA 14

#define OLED_BRIGHTNESS 196

Freenove ESP32-S3 Breadboard Wiring

Freenove Ultimate Starter Kit for ESP32-S3 FNK0082
Freenove ESP32-S3 Breadboard Wiring
image

#define ENABLE_I2S_DAC
#define I2S_BCLK  46 /* Bit Clock */
#define I2S_LRC   47 /* Left/Right */

  #define I2S_DOUT  45 /* Audio Data */

  #define ADJUST_MP3_PRE_LOOP 700/1000

#define I2C_SCL 3
#define I2C_SDA 14

#define OLED_BRIGHTNESS 196

ESP32_BadApple

Bad Apple video by Touhou on ESP32 with SSD1306 OLED, uses the Heatshrink compression library to decompress the RLE encoded video data. First version, no sound yet, video only.

Bad Apple on ESP32

Hardware Requirements

Runs on ESP32 modules with OLED displays based on SSD1306. Typical modules are available from Heltec or TTGO or others.

Software Requirements

Usage

  • Adapt display pins in main sketch if necessary
  • Upload sketch
  • Upload sketch data via "Tools" -> "ESP32 Sketch Data Upload"

Enjoy video. Pressing PRG button (GPIO0) for max display speed (mainly limited by I2C transfer), otherwise limited to 30 fps.

How does it work

Video have been separated into >6500 single pictures, resized to 128x64 pixels using VLC. Python skript used to run-length encode the 8-bit-packed data using 0x55 and 0xAA as escape marker and putting all into one file. RLE file has been further compressed using heatshrink compression for easy storage into SPIFFS (which can hold only 1MB by default). Heatshrink for Arduino uses ZIP-like algorithm and is available also as a library under https://github.com/p-v-o-s/Arduino-HScompression and original documentation is here: https://spin.atomicobject.com/2013/03/14/heatshrink-embedded-data-compression/

Known issues

SPIFFS is broken currently (Feb 2018) in ESP32 Arduino core - hopefully will be fixed there soon. Search through issue list there for solutions - usually an earlier commit can be used to get it working.

About

Bad Apple Video on ESP32 with SSD1306 OLED with MP3

http://www.neko.ne.jp/~freewing/hardware/espressif_esp32_bad_apple_demo/

License:MIT License


Languages

Language:C++ 65.3%Language:C 11.6%Language:Python 10.9%Language:C# 9.7%Language:Batchfile 2.5%