Tide Clock

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

Similar projects worth following
I have a place at the shore, right on the water. It's been in the family for years and everything runs by the tide, there. I have had those analog tide clocks in the past, but anyone who has used them knows that they aren't really accurate. They are designed to measure the average duration of a tide to be something like 6 hours and 15 minutes (give or take). However, the reality is that the tide varies throughout the year. Depending on your location, quite a bit. Additionally, one often wants to know the tide at some point in the future. Will there be good fishing, next weekend? Still, I like the look and feel of an analog tide clock. So I set out to make a digital version and I thought that a Raspberry Pi 3, an HDMI panel, and a power supply could be put into a 'shadow' box and made into a wall mounted clock. A shadow box is like a picture frame, but deeper.

The features I wanted the clock to have are:

  • 3 dimensional analog face with an accurate tide hand
  • 7 day weather forecast
  • 30 day tide chart
  • Summary of Tide for Today and Tomorrow (with sun rise and sunset, since I had the space)
  • Some legalese at the bottom should I ever want to sell this to someone
  • Ability to configure location and Internet connection via web page setup

Here's a video of the Clock in operation:

  • Back to the Drawing Board

    Thomas Snow11/29/2017 at 20:11 0 comments

    Faced with the prospect that Chromium could not render animation smoothly enough, I had to go back to the drawing board.  I was worried that I would have to write this app as an X Windows application.  I didn't have a development environment to easily develop one.  Luckily, my research into how to get better animation performance in HTML5 led me to thinking about Java.  That led to the discovery of JavaFX.  It's a library of Java objects that can take advantage of the hardware acceleration of many graphics systems to perform animation.  It's model was very HTML/XML-ish in nature, so it was easy to lay out things.  Using Java also took advantage of all of the Java code I wrote to support the web page via JSP.  So I whipped up a Proof of Concept that had everything but the clock (the clock was going to be tough).  This gave me an app with two scrolling panels.  Things were looking good!

    New Software Motto:  Be wary when things look good.

    I loaded the code into the Pi and viola!, it couldn't find the JavaFX libraries in the Java 8 SDK.  It turns out that Oracle stopped supporting JavaFX on ARM platforms in Java 1.8.33u and naturally, I had a newer version. 

    More research found this page (God bless Stackoverflow!).  It describes a way to get a version of it.  I could only get the second answer to work:

    • Download and unzip it on the Pi
    • Copy:
      • armv6hf-sdk/rt/lib/ext/jfxrt.jar --> jre/lib/ext/ 
      • armv6hf-sdk/rt/lib/arm/* --> jre/lib/arm/
      • armv6hf-sdk/rt/lib/ --> jre/lib/
      • armv6hf-sdk/rt/lib/ --> jre/lib/ 
      • armv6hf-sdk/rt/lib/jfxswt.jar --> jre/lib/

    So things were looking good, right?

    No, see New Software Motto above.

    It turns out that JavaFX is all bare metal.  It wants exclusive access to the video driver.  Since X Windows is using it, you can't run a JavaFX app in Xwin.  So I disabled X Windows and put the Pi into terminal only mode.

    Still no Joy.  JavaFX is picky about the driver settings.  In the end I had to futz with the /boot/config.txt file.  I eventually found this setting worked:

    # turn off lightning bolt

  • Software

    Thomas Snow11/27/2017 at 23:48 0 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:

    • Tide calculation Data for over 4,000 locations in the US and its territories
    • GPS Coordinates for each location
    • High and Low tides
    • Sunrise and Sunsets
    • Moon Phases

    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:

    • X Windows
    • KDE
    • Apache Tomcat
    • Chromium (the public source distro for Chrome on Linux)

    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.

  • Preliminary Assembly

    Thomas Snow11/27/2017 at 22:56 0 comments

    I started out by purchasing a Raspberry PI 3 and an HDMI screen with a controller.  I put this into a hinged shadow box.  I used some stock matting supplies that fit as close as I could to the HDMI panel (I actually lose about 1/4 inch on the left side).  In the future, I'll have custom matting made for it.

    The innards make liberal use of Gorilla Tape.

View all 3 project logs

Enjoy this project?



Jeff wrote 08/09/2020 at 18:44 point

Brilliant idea and something I would truly use.  I have not seen any recent updates from the project originator.  Have any further development taken place?

  Are you sure? yes | no

Surfscooter wrote 04/28/2020 at 14:20 point

Fantastic idea and results.  I have never used my Pi, and with the current stay at home recommendations (4/28/20) I hope to make one of these.  Do you think there’s a way to tie in a GPS, perhaps a Bad Elf, so it would update as you travelled on a boat?  Nice project!

  Are you sure? yes | no

rudyebiii wrote 12/09/2019 at 19:05 point

Seeing that the last comment was posted a year ago, I was wondering if you got all the bugs out and can provide the code for the Raspberry Pi to allow others to recreate your project?

  Are you sure? yes | no

Stan wrote 10/30/2018 at 01:11 point

Ah--that makes sense.  Still struggling getting XTide to work on Raspian. Ugh.

  Are you sure? yes | no

Stan wrote 10/29/2018 at 21:04 point

Very nice. Did you have issues getting XTide to work? I can't get past a missing font issue.

  Are you sure? yes | no

Thomas Snow wrote 10/29/2018 at 21:31 point

To be honest, I don't use the XTide interface for the project.  I use the command line version (just plain old 'tide') to spit out data to feed the JavaFX App.

  Are you sure? yes | no

Bruce Semple wrote 06/02/2018 at 00:48 point

I'm willing to be a beta tester as well 

  Are you sure? yes | no

Dr. Cockroach wrote 11/28/2017 at 13:43 point

I like the look of the display. Live within a mile of the coast here and always interested in the tides :-)

  Are you sure? yes | no

Thomas Snow wrote 11/28/2017 at 13:51 point

Once I get all of the kinks out and feel it's ready for production, I'll put an image of the OS somewhere and you can be a beta tester!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates