Igor's Blog
Programming, DIY, Games, Hacks, and Tech

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.



Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...

Recent Blog Posts

How to enable the full stack trace in Maven's Surefire plugin for JUnit testing

Twelve elements of the Burst Mining Pool interface explained

TPG FTTB settings for the Billion BiPAC 8700AXL 1600 modem router

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

How to fix SoapUI javax.net.ssl.SSLHandshakeException calling WebLogic 12.2 web services on Java 8

Woolworths (WOW) shares disappeared from Computer Share Investor Centre

Connecting the Dell UltraSharp U3415W monitor to a MacBookPro via USB-C

How to add/change PHP versions appearing in MAMP preferences

Fix the ORA-00904: ORA_ROWSCN: invalid identifier error in SQLDeveloper with a few easy steps

G Suite Gmail is broken on Safari due to new Google Content Security Policy settings

Recent Galleries

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

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

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
Travel ┬ÁBlog

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Don't forget to
my Facebook page for more great articles!
Don't show this again