Close

Software

A project log for Tide Clock

Raspberry PI 3 and a 1280x800 HDMI Screen that will run a JavaFX application to display the Time, Tide and Weather forecast.

thomas-snowThomas Snow 11/27/2017 at 23:480 Comments

From a software point of view, my approach was to "write as little of it as possible".  It was why I chose the RPi3 platform since I knew of publicly available software for predicting tides in the form of XTide for Linux and most Linux stuff seems to be ported to the RPi.  XTide has a command line interface for listing tide predictions, so figuring out the tides was sorted; that was a win.  

XTide provides:

XTide relies on accurate time for its predictions, so I needed the RPi connected to the internet.  Since I had the Internet as a requirement, I decided that weather should be available to my clock.  To facilitate this I used the National Weather Service's SOAP Web Services.  They can provide all sorts of useful and endless data on the weather predictions up to 10 days into the future, by GPS coordinates.  So the good news was that once I established a location for XTide, XTide would give me the GPS coords.

Next I needed a presentation layer.  My challenge was that the display I chose, while high resolution, it was only 10.1" screen.  It was meant to be mounted on the wall to allow you to glance at it to get the information you needed.  That meant that I was limited to larger fonts and therefore less information available at once.  The focal point would be the clock face and it would present the most useful information for glancing.  This dictated that the clock face would consume most of the display with weather and future tide predictions scrolling on the sides of it for additional information.  You can't glance at the additional information, but you can walk up to clock to read it.

I am not terribly creative.  I wanted to create a clock based on the analog versions I had in the past.  My first approach was to see what was available on the web as far as clocks were concerned.  I found a wonderful site for this, "20 CSS Clocks".  I settled on this one.  So this dictated that I needed my presentation layer to be a Web Page.  This implied I needed the following on the RPi:

I developed my Web App using Eclipse.  I had to do it on my Windows PC and then upload a WAR (web archive) file to the Pi's Tomcat instance to deploy it.  All of the animation is done by Javascript using JQuery and Snap SVG (the clock face is done in SVG).  

I set up the RPi to start up Chromium in "koisk" mode which plasters nothing but the web page on the screen without keyboard or mouse input (in fact, I had to hide the mouse).

It worked, but not satisfactorily.  The problem is that the scrolling tiles and the clock all share 1 thread during animation.  This is a limitation of the browser (all browsers, it turns out).  I didn't notice it too much on my PC because of the horsepower, but on the Pi, everything stuttered.

In my next log, I will go into how I went back to the drawing board to seek another solution.

Discussions