DEV Community

Cover image for Converting an old TV Box into an epic Picture Frame
Leonardo Colman Lopes
Leonardo Colman Lopes

Posted on • Edited on

Converting an old TV Box into an epic Picture Frame

I built and customized 3 instances of The Digital Picture Frame. It's so simple yet such a great system setup that I fell in love.

People have built such awesome setups for this small utility, and passion drove me to my calling: It's my time to hack a device and turn it into a Picture Frame.

My chosen target? An old TV Box:
TV Box

It has everything needed:

  • A Hackable Android TV that I can turn into Linux
  • A way to boot a custom system (i.e. an SD card)
  • A way to mount different media for photo display (i.e. Flash Drives)

Let's dive in this journey and perhaps you will have a TV Box-Frame too!

⚠️ A Word of Warning First:
Not all TV Boxes will work. Some (if not most) are not able to host a custom system. Be wary when following this as a guide as your setup might vary.

Installing Armbian

Armbian is a "Minimal custom Debian or Ubuntu based Linux perfect for server and IOT". We're going to pick it as most TV Boxes are ARM-based, and Armbian is perfect for the job.

We are going to follow the guide CSC Armbian for RK322x TV box boards.

Armbian

For this tutorial we're going to use a RK3229 as our pilot chip. It's available in many TV Boxes and is not hard to setup

Discovering the Chipset

If you're not sure that your TV Box chip is supported, download and install through the TV Box the app Z-CPU or the FLOSS App CPU Info.

In the app we're looking for information on the chipset. Chipsets of the format RK322X are supported.

Unbricking Instructions

Technically, rockchip devices cannot be bricked. In some cases a screw-up might require repairing of the original system, and the unbricking instructions from CSC Armbian for RK322x TV box boards can help.

Installing Using SD Card

We're going to use an SDXC Card (Or most commonly an SD Card + Adapter). This card will hold our entire operating system*, and will be plugged in the machine 24/7. I recommend anything 8GB or bigger, but realistically 3GB is the entire system + files.

* You could instead install the system directly to the machine. I couldn't get that to work reliably and preferred the permanent SD approach.

Preparing the TV Box with Multitool

The Multitool is a small but powerful tool to make changes to our RK322X.

Let's flash the Multitool image onto the SD Card first. You can use any tool for it, but I like Balena Etcher.

Balena Etcher

Our goal with Multitool is straightforward:

  1. Flash Multitool to the SD Card
  2. Put the card in the TV Box and power on. After a few seconds Multitool should appear on the display
  3. RECOMMENDED Make a backup of the current firmware with Backup Flash
  4. Select Install Jump Start for Armbian

Multitool

And we're done with Multitool! Power the device down and retrieve the SD card. Store your backup and get ready to flash it again!

Choosing an Image

CSC Armbian for RK322x TV box boards explains how to make a build, but we are going to grab a pre-built binary from armbian/community.

Armbian
Let's take the image Rk322x-box_bookworm_current_6.12.15_minimal.img.xz

As we've done earlier, let's flash it to our SD card using Balena Etcher.
After flashing, insert the SD with the new Armbian image on the device and power it on.

Welcome to Armbian

If everything worked correctly, you should now have a shell inside Armbian asking you for information.
The most important point here is that we'll create a normal user account with the username pi. This will be important to follow The Digital Picture Frame without too many changes on the scripts.

Armbian

To finish configuring Armbian, let's run two commands:

  • sudo rk322x-config and select your board characteristics to enable leds, wifi chips, etc.
  • armbian-config to configure timezone, locales and other personal options

At this point you can also connect your device to your network and connect to it through ssh.

Install The Digital PictureFrame

From this point on we are done with the system and can start playing with PictureFrame itself. We are going to follow the guide for Raspberries as close as we can until we get it working.

Let's first install necessary dependencies:

sudo apt update
sudo apt install build-essential pkg-config python3-dev python3-pip python3.11-venv libjpeg-dev libtiff-dev libfreetype6-dev zlib1g-dev liblcms2-dev libwebp-dev tcl-dev tk-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpng-dev cmake ninja-build git libgles2-mesa libegl1-mesa libgl1-mesa-dri libglapi-mesa libsdl2-2.0-0 libsdl2-dev

Enter fullscreen mode Exit fullscreen mode

And compile + install HEIF, as the ones from Armbian aren't updated enough:

cd ~
git clone https://github.com/strukturag/libheif.git
cd libheif

mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install

Enter fullscreen mode Exit fullscreen mode

Then let's prepare a Python VEnv to install picframe into:

cd ~
mkdir venv_picframe

python3 -m venv /home/pi/venv_picframe

source venv_picframe/bin/activate
Enter fullscreen mode Exit fullscreen mode

And finally, let's install PicFrame!

pip install picframe
Enter fullscreen mode Exit fullscreen mode

To know it worked, we should see after a long (maybe 30+ minutes) some positive messages:

Successfully installed IPTCInfo3-2.1.4 Pillow-11.1.0 PyYAML-6.0.2 defusedxml-0.7.1 ninepatch-0.2.0 numpy-2.2.3 paho-mqtt-2.1.0 pi-heif-0.21.0 pi3d-2.53 picframe-2024.11.1 pysdl2-0.9.17

Configuring PicFrame

On Configuring PicFrame we have clear instructions on how to configure picframe. Let's do that now!

You will be asked three questions for the basic configuration settings. Just hit Enter to keep the default for now. You can always change these settings later.

mkdir {Pictures,DeletedPictures}

picframe -i /home/pi/
Enter fullscreen mode Exit fullscreen mode

You don’t need to make changes in the configuration file at this point. But you probably want to customize it later. In that case, open it with

nano ~/picframe_data/config/configuration.yaml
Enter fullscreen mode Exit fullscreen mode

Starting Picframe

Let's create a script to start our Picframe:

nano start_picframe.sh

#!/bin/bash
source /home/pi/venv_picframe/bin/activate # activate phyton virtual env
picframe &  #start picframe

while true; do sleep 10; done # Keep the script running
Enter fullscreen mode Exit fullscreen mode

Save and close and make the file executable with

chmod +x ./start_picframe.sh
Enter fullscreen mode Exit fullscreen mode

And now, finally, let's run our PicFrame

./start_picframe.sh
Enter fullscreen mode Exit fullscreen mode

And if everything went through correctly, we'll get a beautiful mug on the screen:

Image description

Auto Starting Picframe

This part will work a bit different from Autostarting PictureFrame, so pay close attention!

Let's start by creating the file picframe.service with sudo nano /etc/systemd/system/picframe.service and pasting the following content inside:

[Unit]
Description=PictureFrame Startup
After=multi-user.target

[Service]
Type=simple
ExecStart=/bin/bash /home/pi/start_picframe.sh
Restart=on-failure  # Only restart if it fails
RestartSec=10       # Wait 10 seconds before restarting
User=pi
WorkingDirectory=/home/pi
Environment=DISPLAY=:0
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode

Then reload systemd and enable the brand new service:

sudo systemctl daemon-reload
sudo systemctl enable picframe.service
sudo systemctl start picframe.service
Enter fullscreen mode Exit fullscreen mode

We can check the service status by running

systemctl status picframe.service
Enter fullscreen mode Exit fullscreen mode

Enable Autologin on tty1

The pi user doesn't have auto-login enabled, and we must have it if we don't want to stare at a login screen. Let's change that by creating an override for getty@tty1:

sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
sudo nano /etc/systemd/system/getty@tty1.service.d/override.conf

Enter fullscreen mode Exit fullscreen mode

And paste this inside to enable auto-login:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
Enter fullscreen mode Exit fullscreen mode

PictureFrame should now start on boot!

Top comments (2)

Collapse
 
grimmnir profile image
Grimmnir • Edited

I set something like this up for my grandma a while back, but ended up switching to nixplay.com/ since it was way easier for my family to send her photos remotely. It worked out great because she didn’t need to mess with anything—photos just showed up on the screen. Might be worth checking out if you want something more hands-off after the initial setup.

Collapse
 
homelessjimmy profile image
HomelessJimmy

has anyone tried hooking this setup with a motion sensor so the frame only turns on when someone’s nearby? I’m thinking that could save power and make it feel more dynamic. Also curious if anyone added weather or calendar widgets to the display.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.