Raspberry Pi Autostart Program

The Raspberry Pi is a small handy computer. Lots of programs are available to do all kinds of things. It's easy to use the mouse and keyboard to bring up the program you need and you're off and running. But, what if you want your Pi to do one specific thing, AND, you don't want or need to drag along a mouse and keyboard. There are several ways to run the Pi "Headless", no keyboard or mouse, and boot right into your application. We've explored lots of them here. Webcams, Temperature monitors, DMR Hot Spots to name a few. The directions assume you want this to be a single use device that automatically starts the appropriate software. Everything is built into the article you are following.

So, let's say you want to automatically boot up and display a web page, show a video, or put up pictures. There is a relatively simple way to do this. We'll assume you want to display a web page on Chromium. Here is a way to do it. In your /home/pi directory, there is a .config sub directory. (Any file name or directory name that starts with a "." means it is hidden.) You need to go to the .config directory and create a sub directory called autostart. Then you have to create a file called chromium.desktop. Start with a fresh, updated version of Raspbian on your Pi. Open a terminal and enter the commands below, one at a time.

mkdir /home/pi/.config/autostart

nano /home/pi/.config/autostart/chromium.desktop

[Desktop Entry]

Type=Application

Name=Chromium

Exec=chromium-browser %U

nano is a text editor that will create the file chromium.desktop with the 4 lines above. Just type the above lines, then Save and exit. Reboot your Pi and it will eventually come up running Chromium. Navigate to the page you want to display and make that your home page, and you are done!

OK, but you want to show a video instead. No Problem. In the example above, substitute vlc for chromium. vlc is the video player installed by default. You can make the last line

Exec=vlc /Videos/myvideo.mp4

This assumes you put a video named myvideo.mp4 in the sub directory Videos. Likewise, you can follow this pattern to call up other programs and either set up a default start location, album etc., or specify one here as you did for myvideo.mp4.

Have fun,

Jim K2BHM

3 views0 comments

Recent Posts

See All

Raspberry Pi Webcam, With RPi_Camera_Web_Interface & pi-pan THIS IS NOT A GOOD BEGINNER’S PROJECT! There are a lot of steps to setting up the hardware and software. It is a lot easier with a working