Train Scene Decoration

by 陳亮 in Circuits > Arduino

119 Views, 1 Favorites, 0 Comments

Train Scene Decoration

ezgif.com-optimize.gif
IMG_3809.jpeg
Train Window Scene Decoration

This instructables show how to use a tiny screen dev device build a train scene decoration that have moving window views.

Supplies

日本の車窓から

The trawin.com is a special site of scenery from Japanese railway train windows. It just likes travel in Japan while viewing. How about if you can looping the video on your desk? It is even better if adding a Japanese theme frame on it!

The Japanese animated fantasy film 《Spirited away》, 千と千尋の神隠し, is one of my favor animation. This project will use this theme as an example. You can simply use your favor theme instead.

Playing Train Window View

A desktop decoration will not playing sound normally, so a dev board that can play MJPEG file is good enough.

The video in train.com is around 1 hours, it requires a microSD card to store the sub-gigabytes size MJPEG file.

Waveshare ESP32-C6-LCD-1.47 is a tiny dev board that have a high resolution (172x320) screen, at the same time it built-in a microSD card slot. It is very suitable for this project.

Software Preparation

Arduino IDE

Download and install Arduino IDE latest 1.x version if not yet:

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

Arduino-ESP32

Follow installation step to add Arduino-ESP32 support if not yet:

https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

Arduino_GFX Library

Open Arduino IDE Library Manager by selecting "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.

Dev Device Pins

Open Arduino IDE Library Manager by selecting "Tools" menu -> "Manager Libraries...". Search "Dev Device Pins" and press "install" button.

JPEGDEC

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

Prepare MJPEG File

After you selected and grab the train window video to local, you need convert it to MJPEG file.

Here are the sample convert command:

ffmpeg -y -i input.mp4 -ss 0:01:00 -pix_fmt yuvj420p -q:v 7 -vf "fps=15,scale=480:-1:flags=lanczos,crop=320:172:80:0" "../trawin.mjpeg"

Since my theme have a higher window, so I first resize it a little bit bigger that the screen, then crop the upper part.

Ref.:

https://ffmpeg.org/ffmpeg-filters.html#crop

Source Code

Please download the MiniTV source code at GitHub:

https://github.com/moononournation/MiniTV.git

Program

ESP32-C6-LCD-1.47_Demo_3.png
  1. Open MJPEG_callback.ino in Arduino IDE
  2. Set the board parameters as above picture
  3. Press Upload button and wait compile and upload finish

Test Play

ESP32-C6 playing train window view

Copy the prepared MJPEG file to microSD card and plugin to the dev board to test play.

Print Theme Picture

螢幕截圖 2025-03-08 上午11.50.26.png

The screen viewable size is around 32mm x 17mm. The theme picture should have a train window a little bit small than this.

Cutout Window

Train Window Scene Production Part1

After print out the theme, use art knife cutout the window. If it is too small to cutout all details, keep some blue sky details on it is ok.

Assembly

Train Window Scene Production Part2

I use a tiny acrylic stand to support the picture. This stand also can help me fix the screen behind the window, but as show in the video, it needs some patching first.

Optional Power Pins

IMG_3787.jpeg

My selected acrylic stand is too tiny, it cannot hide the USB plug behind it. So I soldering the 5V power pin headers, so I can hide the power wire behind the stand.

Enjoy!

IMG_3801.jpeg

Now you just like traveling in Japan while you sit at the desk.

Note:

If you search "Train Window View", you can find more railway video in other countries. Then you can have more combination, e.g. Harry Potter train scene in a London train, The Girl On The Train, or even Spider man at Forest Hills...