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:
jphotoframe.jpg


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.
 /etc/network/interfaces
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
address 192.168.1.254
netmask 255.255.255.0
gateway 192.168.1.1




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:
 Commands
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:
 Commands
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:
 /etc/fstab
/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):
 Commands
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):
 config.properties
screenNumber=0
imageDirectory=/photos
cacheDirectory=/photos/cache
imageTimeout=300000
fontName=Verdana
fontSizeDate=20
fontSizeTime=50
dateFormat=MMM d yyyy
timeFormat=H:mm
dateOffsetX=15
dateOffsetY=10
timeOffsetX=10
timeOffsetY=30



Running it is simple...I actually put this in a script and made it execute when LXDE starts.
 Commands
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.

Enjoy!

-i

, , , ,
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

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
StrFunc() Online
300 George St Blogumentary
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

New Nintendo 3DS XL, R4i SDHC RTS Lite and DSDoom

Older versions of JD-GUI crashing on macOS Sierra

How does Seeed Fusion stack up as a low budget PCB fab

Where to find the last item (Robbie's lost lyrics) in GravityFalls Lake level

Detecting print requests to print contents of a DIV with JavaScript

Using Google DFP with AdSense on responsive pages

How to change the email subject line in Gmail

Force PHP GD library to load JPEG images that have invalid data

How to uninstall Samsung Smart Switch from your Mac

Facebook adds weather forecasts but forgets to adjust them to your time zone

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

Friends

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