Rotate the Display

A large part of the visual impact of this project comes from hanging the TV vertically in portrait orientation. We're so used to seeing TVs in their horizontal landscape position, that the portrait orientation is novel and unexpected. This, plus the frame that we'll use, and careful lighting really sell the gag.

To rotate the orientation of the data sent to the TV, you'll add a single line to the Pi Zero's configuration text file. Type this in a terminal to edit the file:


sudo nano /boot/config.txt


and then press return.


You can add the new line at the very bottom of the file. Type this in on a new line:


#rotate the display: 0=normal, 1=right vertical, 2=upside down, 3=left vertical


That line is a comment, which won't be read by the machine, just us humans. Comment lines are preceded by the # symbol.


On the next line, type this:




Now, you can save the file (ctrl-x, Yes, return) and then restart the Pi Zero by typing:

sudo reboot

Get ready to turn your neck sideways or rotate your monitor to continue! If you ever need to go back to regular orientation, change the config.txt file's display_rotate value to 0.

Autostart the feh Script

In the final Haunted Portrait, you won't have a keyboard or mouse connected (unless you use a wireless setup), so you'll want to set up the Pi Zero to automatically run your slideshow script on startup. This also means that if there is a loss of power, the system will not spend a long time stuck on a Linux screen!

To set the script to automatically run on startup, there are just two simple steps. First, we'll set the file permissions of the script to be "executable" by the system, not just the user who created it. Then, we'll add a line to the destktop environment configuration script that  automatically runs our picture frame shell script upon launch.

There are many different desktop environments available for Linux, the one used here in Raspbian is called LXDE for Lightweight X11 Desktop Environment


Let's have a look at the current file permissions. In your Terminal, type this in to list the directory contents with verbose info:

ls -l /home/pi

That list of letters on the left side in front of each file shows you what type of permissions exist for the file.

Possible permissions are read, write, and execute for three types of accounts: owner, group, and user. Here's a very good primer on the subject.

For the slideshow script we see: 


which means the file can be read and written by the owner ("root"), and only read (not executed or written) by groups and by users. This means the system (user "pi") doesn't have execution permission. So, we want to adjust that so the system can actually run the script without user intervention.

This simplest way to adjust this in our case is to grant execution permissions to all users. The chmod command is used to do so. Type this in your Terminal:

sudo chmod 755 /home/pi/


Now, list the file contents and you'll see the new permissions.


Next, you will add a line to the desktop environment autostart file so it run the script after booting. Open the autostart file for editing by typing:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

Add a new line at the bottom and enter this text:


As is by now the familiar routine, save and exit the file with ctrl-x, Y, return.

Once again, you'll need to restart the Pi Zero to see the effects of your changes, so type: 

sudo reboot

This time, once the Pi Zero reboots, it will launch the LXDE desktop, and then start the slideshow! How automagical!

This time, once the Pi Zero reboots, it will launch the LXDE desktop, and then start the slideshow! How automagical!

When you tire of watching your test slideshow, you can press Esc on the keyboard, or the Select button on your Joy Bonnet to stop it. You can relaunch at any time by typing this into a Terminal window:

bash /home/pi/

Now, let's prepare some proper portrait images!

This guide was first published on Sep 15, 2017. It was last updated on Sep 15, 2017.

This page (Portrait Mode Setup) was last updated on Sep 12, 2017.

Text editor powered by tinymce.