Igor's Blog

I've received my new Raspberry Pi Model A+ last week to use to replace the old Model A inside my photo frame, so I spent some time on the weekend setting that up. Last time that I've set this photo frame up, I went with out-of-the-box software, which did the job but did feel quite clunky. This time around I decided to do it better and write some software for the photo frame instead.

Since Java is what I'm most comfortable with, and it works on the Raspberry Pi, that's the language I decided to use. I did do some research first however and managed to find jPictureFrame, I couldn't get this to work - it just kept on displaying a blank white screen.

At the moment the software is quite basic. It displays photos from a directory, resizes them to the screen and caches the resized files to use later. It also shows the current date and time. There are a few things missing like weather forecast, web browser control, and more intelligent display of photos. I'll be adding new features at a later point.

This is what the output looks like:

Now lets see what I did to set this all up.

Instead of using an OS with a lot of features that I would never use, I went for a minimal distribution. I went with Minibian, but specifically I got the wifi enabled version: Minibian-wifi. Since I'm doing this on a Model A+, there is no ethernet connection and wifi connectivity is essential. I used ApplePi Baker to write the image.

Once the image was ready, the first thing I did was set up networking. A static IP was set to make it easier to connect to the photo frame. Below is the content of the /etc/network/interfaces file. The /etc/wpa_supplicant/wpa_supplicant.conf was also updated to have my wifi SSID and password.
auto lo
iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static

There is a good getting started guide for Minibian that I made some use of. It's important to expand the file system, set the memory split and overclocking options as required. I used raspi-config for this, since it is not installed with Minibian, I had to get it first:
apt-get update
apt-get install raspi-config

Once I was done with that configuration, I ran apt-get upgrade to upgrade all the system packages.

Next I needed to install all the software that I would need:
apt-get install git dosfstools lxde oracle-java7-jdk netatalk samba samba-common-bin unclutter

After this, I needed to get the USB monitor working, for that I followed my own blog post from earlier. The only thing I did differently was to force the USB key to be mounted with the sync option to prevent file system corruption. My /etc/fstab file looks like this:
/dev/mmcblk0p1 /boot vfat defaults 0 2
#/dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1
/dev/sda2 / ext4 defaults,noatime,sync 0 1

Once that was done, I followed this post to get Samba and AFP configured. I also added the pi user and made the Raspberry Pi login into a desktop environment (using raspi-config again).

Now I was almost ready to get some Java development happening on the Raspberry Pi. As I was about to start, the USB monitor switched off. Of course this was due to the cron job I've scheduled, but it was the wrong time of the day. I realised that the time zone was wrong, the following command let me change it to my correct time zone (as the root user):
dpkg-reconfigure tzdata

Now I was ready for Java coding on the Pi. It took a few hours to write the code, which is available on my GitHub Project Page, the jar file is also there for download.

This needs a configuration file, config.properties to be present in the same directory as the jar file. The contents of mine are as follows (it should be more or less self-explanatory):
dateFormat=MMM d yyyy

Running it is simple...I actually put this in a script and made it execute when LXDE starts.
java -Xms64m -Xmx64m -jar jphotoframe.jar

My photo frame has been running with this software without any issues for a couple of days now. It seems much more stable than the previous attempt using Conky to draw the images. I'll be making updates to this soon and I'll release the source code in due time too.



, , , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Handling visibility of mobile only pop-over DIVs on a responsive web site

WebLogic package-name element classpath generator script

Using Jersey 2.x as a shared library on WebLogic 12.1.2

Google DFP with AdSense fallback is causing infinite scroll pages to go haywire

Workaround for Mobile Safari scrollTop() not updating during scroll

Skipping execution of Maven plugins that do not have a native skip option

Unmarshalling an XML fragment representing a JAXB object without XmlRootElement

Injecting a ContainerRequestContext into a Jersey entity provider class

Obfuscating PHP source code with Maven and YAK Pro PO

Making use of corner shelves with easy to make slide out draws

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth


RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
...or subscribe for updates!

Don't show this again