- American Physical Society Sites
- Meetings & Events
- Policy & Advocacy
- Careers In Physics
- About APS
- Become a Member
Minjoon Kouh, Drew University
Drew Physics Department uses a Raspberry Pi (RPi) to run custommade slideshows about its course offerings, research opportunities, student activities, as well as “Physics InSight” about careers and opportunities for undergraduate physics students (published by American Physical Society). The following is a short guide on how to set up and maintain an automated digital signage system with a RPi, in case other departments might want to adopt a similar outreach solution. Some familiarity with the Linux environment is assumed.
Raspberry Pi (RPi) is a $35, credit-cardsized, singleboard computer, which can serve well as a lowcost -platform for teaching/learning computer programming or electronics and for deploying various DIY projects. It is equipped with an HDMI output, and can be easily hooked up to a TV for displaying slideshows or video clips.
Among many benefits of using a RPi for driving a digital signage are its low cost, low power consumption (< 5 Watts), and ease of automation. One could use Microsoft PowerPoint to run a slideshow on a regular PC; however, it not only consumes unnecessarily more power (~ 60 Watts), but also is more difficult to automatically start various applications.Necessary Hardware
RP-idriven signage can be set up in many different ways. Our particular solution runs “qiv” (for images) and/or “omxplayer” (for video clips) at specified times with a simple shell script.
First, install a Linux operating system on a SD card, and start up your RPi. Configure the RPi to boot into a Desktop environment directly when it powers on, by running “sudo raspi-confi” from the command line and following the options. You may also want to change the password for security. More information on this basic setup of RPi is available at www.raspberrypi.org.
Second, install “qiv” (quick image viewer) by running “sudo aptget install qiv” from the command line. The movie player, “omxplayer,” should already be installed by default. You can use “lxterminal” to execute a command.
Third, create a shell script such as the following. Use “nano” within “lxterminal” as a text editor.
# Countdown to the slideshow.
while [ $sec -ge 0 ] do
echo "Starting slideshow in $sec seconds"
while true do
t=$(date +%H%M) # Get time.
w=$(date +%w) # Get weekdays (0=Sunday)
echo "Current time: $t"
if [ $t -le $maxtime ] && [ $t -ge $mintime ] \
&& [ $w -ge 1 ] && [ $w -le 5 ]
then # Do the following slideshows.
qiv -fismCd 10 /home/pi/Drew_Science/*.jpg
omxplayer -b /home/pi/Physics_InSight.mp4
The above shell script is the major part of the setup. The command “qiv -fismCd 10” goes through the jpg files in the specified directory every 10 seconds in the full screen mode. Then, the command “omxplayer -b” plays the specified movie file with a black background. It checks the current day of the week and time. If it is a weekday (i.e., “$w” is between 1 and 5) and the current time is between 08:30 and 18:00, the programmed slideshows will run. If those conditions are not met, the program sleeps for 60 seconds. Since RPi does not have an onboard clock, it needs to be connected to the internet to update its time. The shell script is programmed to run continuously, unless it is canceled with ctrl-C. In our case, we saved it as “play_slideshow.sh.”
The shell script must be made executable by running “chmod +x play_slideshow.sh” from the command line.
Four, add the following lines to “/etc/xdg/lxsession/LXDE/autostart” by using “sudo nano”:
@xset s noblank
@xset s off
@lxterminal -e /home/pi/play_slideshow.sh
These commands disable the screensaver and dpms (display power management system), so that the screen does not go blank during the presentations. The last line executes the slideshow shell script as soon as the Desktop starts. Hence, the slideshow can be restarted, just by rebooting the RPi. The initial countdown in the shell script gives its user an opportunity to stop the slideshow at the beginning.
Maintaining the slideshows is relatively easy. In order to add/remove/update a slideshow program, files need to be transferred to the RPi, and the shell script should be edited accordingly. PowerPoint slides can be saved as individual images within Microsoft PowerPoint. If you need to convert a .pdf file into a sequence of images, you can install “imagemagick” on RPi by running “sudo apt-get install imagemagick” and run the following shell script.
while [ $pg -le $maxpage ] do
convert -quality 100 -density 300 \
Minjoon Kouh is an Assistant Professor of Physics at Drew University. His primary research area is in Computational Neuroscience, but he has also published several articles on the teaching of physics, particularly on incorporating the Wii-mote into physics labs as an inexpensive accelerometer.