Mini Retro TV

28K148124

Intro: Mini Retro TV

This instructables show how to make a mini retro TV.

Note:

This TV cannot receive analog TV broadcast signal but can play mini video tape (micro SD card).

STEP 1: Previous PoC

This project is base on the previous PoC project: Play Video With ESP32, you may find more basic details there.

STEP 2: CRT Attributes

Retro TV display with a Cathode-ray tube (CRT). It is a big vacuum glass tube that emit electron beams to a phosphorescent screen to display image. It makes retro TV have some attributes:

  • Aspect ratio nearly like a square (actually a circle)
  • Rounded corner
  • Thick and bulky

So I selected a 7:6 rounded corner LCD to build this mini retro TV.

Thanks to the bulky case, I can squeeze all the sophisticated components in it.

Ref.:

https://en.wikipedia.org/wiki/Cathode-ray_tube

STEP 3: Analog TV Format Standard

There are various analog TV video standard, I will refer the first well known digitalize format (VCD) as a reference. VCD NTSC format is 240p (240 horizontal lines) with around 30 frames per second (fps). So this project target is playing 240p video in 30 fps.

The broadcast audio sample rate is 44.1 or 48 KHz single channel, since most video source on the web is in 44.1 KHz so I selected 44.1 KHz to avoid unnecessary sample rate conversion distortion.

Ref.:

https://en.wikipedia.org/wiki/Video_CD

https://www.thebroadcastbridge.com/content/entry/11502/broadcast-for-it-part-15-digital-audio

STEP 4: Case Design

  • A grey rounded corner screen frame on the LCD make it looks more like a CRT screen
  • Front panel right side is a MicroSD card slot imitate a video tape slot
  • Front panel no room fit a speaker so I put the full range audio speaker at the bottom
  • The ESP32 dev board mounted at the top
  • Left side reserved room for LCD breakout wires
  • Back panel has the USB port and power switch
  • Retro TV also have a signature long shaped legs, so this design also built 3 legs to support the TV. Limited by 3D printing 45 degree rule, I cannot make it too long but I think it is enough to present this signature.

I have uploaded the design to Fusion 360: https://a360.co/3zdd511

STEP 5: 3D Printing

Download and 3D print all parts at Thingiverse: https://www.thingiverse.com/thing:5400343

STEP 6: Software Preparation

Arduino IDE

Download and install Arduino IDE latest 1.x version if you are not yet do it:

https://www.arduino.cc/en/main/software

ESP32 support

Please follow the Arduino-ESP32 install guide to add ESP32 support if not yet do it.

Arduino_GFX Library

Open Arduino IDE Library Manager by select "Tools" menu -> "Manager Libraries...". Search "GFX for various displays" and press "install" button.

You may refer my previous instructables for more information about Arduino_GFX.

JPEGDEC

Open Arduino IDE Library Manager by select "Tools" menu -> "Manager Libraries...". Search "JPEGDEC" and press "install" button.

arduino-libhelix

This project use Helix decoder for playing AAC or MP3 audio. Download and import the arduino-libhelix library to Arduino IDE:

https://github.com/pschatzmann/arduino-libhelix.git

You may refer to Arduino Documentation for the details on how to import library to Arduino IDE

STEP 7: Software Desgin

ESP32 have 2 cores and run on top of FreeRTOS, so it can run multitask simultaneously.

Playing video is heavy loading for a microcontroller, so it should well planning the processing power allocation. After subsequent testing, the most heavy loading is the MJPEG decoding, so this task dedicate Core 0 to do the job. All other processes run on Core 1:

  • Read audio file
  • Decode audio
  • Enqueue decoded audio to I2S
  • Read video file
  • Draw decoded video to display

STEP 8: Upload Program

The program can upload at the early stage even before connect the components. So you can check is it work for each component connection.

  • Download the MiniTV source code at GitHub: https://github.com/moononournation/MiniTV.git
  • Open "MJPEG_2task_Audio_1task.ino" in Arduino IDE
  • Connect TTGO T7 dev board
  • Select Tools Menu -> Board -> ESP32 Arduino -> ESP32 Dev Module
  • Select Tools Menu -> PSRAM -> Disabled
  • Select Tools Menu -> Port -> [select the port dev board connect]
  • Press Upload Button
  • Wait compile and upload success

STEP 9: Convert Video

Prepare a video you want to play in the mini retro TV and convert to MJPEG video and AAC audio. Below script assume source video is "input.mp4":

ffmpeg -i input.mp4 -vf "fps=30,scale=-1:240:flags=lanczos,crop=288:in_h:(in_w-288)/2:0" -q:v 11 288_30fps.mjpeg
ffmpeg -i input.mp4 -ar 44100 -ac 1 -ab 24k -filter:a loudnorm -filter:a "volume=-5dB" 44100.aac

FFmpeg: https://ffmpeg.org

Note:

  • The display resolution is 280 x 240, but MJPEG format love the dimension that can divided by 16, so it is extended to 288 x 240.
  • You can adjust the audio volume by alter the "-5dB" value

STEP 10: MicroSD Card Requirements

As previous benchmark test, ESP32 read SD card only can reach around 2MB per seconds. Recently most cheap MicroSD already rated at class 4 and can meet the requirement. Faster card cannot help improve the performance. The above cards I bought 10 in bulk and below USD1 each, it rated class 4 and tested no frame drop in 30 fps.

Ref.:

https://www.instructables.com/Select-SD-Interface-for-ESP32/

STEP 11: SD Card Connection

Previously, I found ESP32 SD_MMC 4-bit mode is fastest for reading SD card data. However, with latest Arduino-ESP32 version, the SD_MMC library become very unstable and cannot compatible with most SD card. So this project is fall back to standard Arduino compatible SD library instead.

STEP 12: Optional: Adjust Audio Gain Level Setting

The 24 mm full range audio speaker is rated 2-4 W and the MAX98357 audio board support up to 3.2 W output, so the speaker should capable output the audio board maximum gain setting. But we will not expect this tiny screen TV speak too loud, so I think setting to 3 dB gain level should be better.

STEP 13: Power Splitter

TTGO T7 dev board can power up by USB and also can connect Lipo Battery for the unplugged power, so all other components can draw the power from the dev board.

But the dev board only have one 3v3 pin header, so it requires a little pin splitter replicate the power pins.

STEP 14: Optional: Battery Powered


TTGO T7 dev board have built-in Lipo battery socket, it can charge the Lipo and powered by the Lipo. You may add a Lipo in the TV that can fit under the dev board. Theoretically, a 600 mAh Lipo can last around 1-2 hours. the above video show the battery can play 44 minutes without any problems.

STEP 15: Optional: Micro SD Card Insert Switch

This is an advance tricks and require some soldering skills.

Most micro SD card slot breakout board not broke out the insert detect switch, so you need break it out yourself. Then connect it to the TTGO T7 power switch. So that once you insert the micro SD card, the TV auto power on and turned off when you took out the card.

STEP 16: Seamless User Experience

I remember in last century, when I insert a video tape into the Video Tape Recorder/player (VCR), the VCR auto turned on and auto play if it is a read only tape (most likely rent from video rental shop). If it is a VCR TV combo appliance, the TV also auto turned on. That means once you rent a movie and back home, the only action you new to do is put the tape into the VCR TV combo. Then you can enjoy the movie in sofa.

This is the most seamless user experience I can enjoy in last century, but I cannot make it in 21 century ( ˘︹˘ )

So I designed this optional "Micro SD Card Insert Switch".

STEP 17: Connection Summary


Here are the connection summary:

TTGO T7 ESP32   ST7789 LCD   MAX98357 Audio   SD Card Slot
============= ========== ============== ============
VCC -> VCC -> VCC -> VCC
GND -> GND -> GND -> GND
GPIO 4 -> MISO
GPIO 5 -> CS
GPIO 13 -> CS
GPIO 14 -> SCK
GPIO 15 -> MOSI
GPIO 18 -> CLK
GPIO 22 -> BLK
GPIO 23 -> SDA
GPIO 25 -> BCLK/SCLK
GPIO 26 -> LRCLK/LRCK
GPIO 27 -> DC
GPIO 32 -> DOUT
GPIO 33 -> RST

Note:

  • SD card MISO requires connect to GPIO 2 if you want to try using SD_MMC, but remember disconnect GPIO 2 while uploading program.
  • If the audio output too much noise, it may caused by the 3v3 power source not enough for the MAX98357, you may consider change the MAX98357 power source to 5v.

Ref.:

https://github.com/LilyGO/ESP32-MINI-32-V1.3

STEP 18: Assembly


STEP 19: Imitate Clumsy Wires Inside

This project not only imitate a retro TV outside, it is also imitate the clumsy wires inside :P

Ref.:

https://www.radios-tv.co.uk/wp-content/uploads/wpforo/attachments/93/132040=25907-chassis1.jpg

STEP 20: Imitate Bulky Weight

This 1.69" Mini TV 78 g in weight. In proportion, a 25" size will become: (25" / 1.69") ^ 3 * 0.078 kg ~= 252 kg. It weigh much more that a real CRT TV!!!!

Note:

Real CRT TV does not have built-in battery.

STEP 21: Enjoy!

It's times to play!

STEP 22: Optional: Flower Power

The most beautiful CRT device I ever seen is Apple iMac Flower Power series. So I also want this Mini Retro TV decorate in flower pattern. That's why I print the case with matte white PLA material.

91 Comments

hi, thanks for the post, can you help me with one thing? for some reason my project starts working excelent but after a couple of minutes it strats showing glitches, i already change the cables for thiker ones and all are soldiered.

it is like when the components heats starts the problems

Did you have any similar problem?

thanks

Hi, thanks for everything, i have one question. How can I use de internal DAC for audio ( with a PAM8403)? this is because in my country the max98357 is dificult to get and very expensive. Thanks!

Hello, thank for this project.
I'm using Lilygo T7 S3 like Zaba_ and I need to change some GPIO. Could you tell me where can I find the declaration of the GPIOs for the screen and the audio ampifier?
Thank you
Hello,
I used a LILYGO T7_S3 v1.1 for your project. I customised the GPIOs and everything worked perfectly. Sound and video excellent. I have used the following code for the file system.

#define SDMMC_D3 13 // SDMMC Data3 / SPI CS
#define SDMMC_CMD 12 // SDMMC CMD / SPI MOSI
#defineSDMMC_CLK 14 // SDMMC CLK / SPI SCK
#defineSDMMC_D0 4 // SDMMC Data0 / SPI MISO

SPIClass spi = SPIClass(HSPI);
spi.begin(SDMMC_CLK, SDMMC_D0 /* MISO */, SDMMC_CMD /* MOSI */, SDMMC_D3 /* SS */);

open the file with:
File aFile = SD.open(AAC_FILENAME);

As I said, it works perfectly.

Inspired once again by the SPYWARS project, I wanted to play different videos and jump to the next video by pressing a button.

#define DOWN_BTN_PIN 0
void IRAM_ATTR down_btn_pressed()
{
if((millis() - last_pressed) >= 200)
{
last_pressed = millis();

curr_video_idx++;
if(curr_video_idx > 2)
{
curr_video_idx = 0;
}

btn_pressed = true;
}
}

pinMode(DOWN_BTN_PIN, INPUT_PULLUP);
attachInterrupt(DOWN_BTN_PIN, down_btn_pressed, FALLING);

if i put this line:
File aFile = SD.open(aac_files[curr_video_idx]);
for example in the void setup() section the file will be opened.

If I enter the same line in the void loop() section and press the button to call the interrupt, the ESP32 crashes when calling File aFile = SD.open(aac_files[curr_video_idx]);.
MJPEG_2task_Audio_1task<br>

Init display<br>

Init I2S<br>

S3<br>

Init FS<br>

File system mount OK<br>

/File02.aac

and than the crash


Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.<br>


Core  1 register dump:<br>

PC      : 0x4037e855  PS      : 0x00060a30  A0      : 0x8200652e  A1      : 0x3fceb7c0  <br>

A2      : 0xb33fffff  A3      : 0xffffffff  A4      : 0xb33fffff  A5      : 0x3fcec9a8  <br>

A6      : 0x02c977e0  A7      : 0x00ffffff  A8      : 0x82026d44  A9      : 0x3fcebb60  <br>

A10     : 0x3fcebcb0  A11     : 0x3fc9bcf8  A12     : 0x3fcebd34  A13     : 0x3fca29c0  <br>

A14     : 0x3fca29dc  A15     : 0x00000003  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  <br>

EXCVADDR: 0xb340003f  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffd 
I have no idea what the reason for this could be. I would be grateful for any help.

Kay


Hi

Firstly, thanks for the guide and the effort! Its an amazing bit of kit. I have made one and it works great. I have an issue compiling the code, well it does compile just fine but I do not get any sound and I get an error in the serial monitor "OOM in SBR, can't allocate 50788 bytes"

I have previously been using a precompiled .bin firmware that plays these files perfectly and doesnt give the error so I am sure the unit and the files are fine but obviously its compiling differently and its running out of memory opening the AAC file (its over 30mins long, shorter ones are ok) but like I said, these do work on the precompiled firmware. After about 30secs it plays the video, just no sound.

I've tried loads of different versions of libhelix, the most recent versions dont compile at all, the older versions compile but all get the same OOM error. I was assuming it was a libhelix issue but obviously could be elsewhere.

SBR stands for Spectral Band Replication and its part of AAC. I cant see a way of disabling it (not sure if that will resolve the issue or not to be honest) but I can find other results where SBR needed to be disabled due to the same error message but they used a different AAC decoder (ESP32 Audio I2S) and its way beyond my skill level to move this to a different decoder!

Any suggestions would be super helpful. Thanks
it said out of memory, should be not yet enable psram option
PSRAM isnt enabled, I did enable at one stage to try but it didnt make any difference to the OOM error message.
if the error come from AAC file, then try to use MP3
Can you please tell me what kind of Micro SD card board you are using?
your link up top is bad
Sorry, I also cannot find that board now.
I am confused on step 15
What part of the micro SD card slot breakout board gets soldered with a wire and where does it connect on the system board on the other end? I am using a LilyGo TTGO T7 V1.3 Mini 32 connecting to a AdaFruit Micro SD Card breakout board (ADA254)
Thank you
This is a little bit tricky, some (micro) SD card slot have a insert switch for dectecting card inserted. I connected this switch to T7 power switch so it will power on once card inserted. This trick is optional, you can skip to next step if encounter problems.
I am using the ESP32-WROOM-32 Dev version. Everything compiled/uploaded without issues. I copied audio and video files after conversion. When I power on, I see the follow lines of text. *left top corner is cut off, cannot read all of it:

12S
it FS
Open AAC file: /44100.aac
Open MJPEG file: /288_30fps.mjpeg
Init Video
Start Play audio task

This is the only thing I see and no video/audio is playing.
What could be wrong? I double check all connections, seem to be correct.

Thank you
You can use Serial Monitor to see more detail message.
So Close! :-)
I see video now but no audio :-(

I Upload and open the Serial Monitor. It just shows this:
16:02:37.456 -> ⸮⸮⸮u⸮

I doubled checked wiring and swap amp module, still no sound.
What do you suggest?
Make sure your serial baud rate is set to 115200. Then you might see a better message.
Hi,

So I tried using MP3 instead of AAC for the ffmpeg audio conversion. I can hear audio now but it is out of sync with the video. The audio is faster than the video. Is there any simple way to sync this up? Why would MP3 work and not AAC?

Thank you
More Comments