Config Raspberry Pi As Picture Frame

Here is a guide to set up your Raspberry Pi as a picture frame to show pictures stored on your local Raspberry pi's disk. 

Disable Low Voltage Warning

1.To disable the low voltage warning, we will need to modify the boot config file.

You can begin modifying this file by running the following command on your device.

sudo nano /boot/config.txt

This config file is available on the boot partition when you plug the SD Card on your Raspberry Pi.

2. Within this file, you will need to add the following line to the bottom of the file. By setting this value to 1, we are telling it to disable all warning overlays.

avoid_warnings=1

Please note this means you will no longer receive any more warnings about your Pi not receiving enough voltage.

3. Once you have added this line, save the file by pressing CTRL + X, then Y, followed by the ENTER key.

4. We also need to remove the “battery monitor” plugin. This plugin is responsible for showing the notification you may see in the top-right corner of your screen.

You can remove this LXPanel plugin by using the following command on your device.

sudo apt remove lxplug-ptbatt

5. For this change to take effect, you will need to restart your Raspberry Pi.

You can restart by using the following command in the terminal.

sudo reboot

Fix Raspberry Pi Apt update issue

1.Let’s begin modifying this file by running the following command on the Raspberry Pi.

sudo nano /etc/apt/sources.list

2. Within this file, you will see the following text.

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

This text defines which repository the package manager will connect to when updating.

uncomment last line will allow apt update to get source list.

Turn Off Screen Blaning

Click on the Menu button on the upper right (Raspberry Pi Icon) >> Preferences >> Raspberry Pi Configuration.

In Raspberry Pi Configuration Window, click on Display Tab.

Look for the Screen Blanking row, click Disable.

Then click OK.

Apt Update and Install Package

pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# apt update

Feh can show different size photos to your LCD. 

1. To install the package, use the following line:

sudo apt-get install feh

2. Now to test that it works enter the following line. Replace /media/NASHDD1/test with the directory that contains all your image (/home/pi/Pictures).

DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --preload --randomize --full-screen --reload 60 -Y --slideshow-delay 15.0 /media/NASHDD1/test

3. Now we can use short tags to make this command a lot shorter. You can read more about all the flags you can use over at the feh manual page.

DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -Z -F -R  60 -Y -D 15.0 /media/NASHDD1/test

4. Now as you will notice this locks up the command line bar. To fix this, add the & after the command and the script/process will launch in the background.

5. So now let’s store this in a simple script file. This way you can add or change it later. To make the file enter the following command:

sudo nano /home/pi/start-picture-frame.sh

6. In here, enter the following lines.

#!/bin/bash
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -Z -F -R  60 -Y -D 15.0 /media/NASHDD1/test

7. Now that’s done you can test it by running the following command.

bash /home/pi/start-picture-frame.sh

8. Finally, let’s have it start at boot. Now it is important that you have SSH enabled so you can access the Pi remotely as you will lose access to the GUI/Screen. So make sure you have done this before setting it to launch at boot up.

9. To do this open up the rc.local file by entering the following command.

sudo nano /etc/rc.local

10. Add the following before the exit 0 line in this folder.

sleep 10
bash /home/pi/start-picture-frame.sh &

11. If you ever need to kill the process as you may want to be able to access the desktop, simply enter the following line.

sudo pkill feh

You should now have your very own slideshow of pictures going. If you end up with any troubles, then double check all the steps and look for any errors. If you’re still having trouble, then be sure to seek help on our forums.

Autostart Slideshow

Depend on your LCD screen resolution, image size will be vary. For my LCD screen 3.5 inch, it is 480 x 320 pixels. 

Autostart is the best way to run GUI-based Raspberry Pi programs on startup. It works by ensuring that both the X Window system and the LXDE desktop environment are available before the system runs any of the scheduled programs.

If you have a script that runs in the windowed mode, or you want to run any of the GUI-based programs/applications at startup on your Raspberry Pi, you should schedule them to run using autostart. Here are the steps to do this.

  1. First, open the terminal and enter the following command to create a .desktop file in the autostart directory: sudo nano /etc/xdg/autostart/display.desktop. We've used display.desktop as file name, but you can name your desktop file anything you want.
  2. In the .desktop file, add the following lines of code:
    [Desktop Entry]
    Name=Slideshow
    Exec=bash /home/pi/start-picture-frame.sh
  3. In this file, replace the value for the Name field with your project/script name. Similarly, we've added our display.py program to run every time the Raspberry Pi boots up.
  4. However, you can replace it with any program that you want to run. In fact, you can even schedule to run a third-party program, like the Chrome browser; in which case, the .desktop file should include the following code:
    [Desktop Entry]
    Name=Chrome
    Exec=chromium-browser
  5. After that, hit CTRL + O to save the file, and then enter sudo reboot to restart the Pi

As soon as your Pi boots up, your GUI program should automatically start as well. In case you'd like to stop your program from running at startup anymore, simply go to the autostart folder and remove the .desktop file you just created.

版权声明:
作者:Alex
链接:https://www.techfm.club/p/13587.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>