Johnny5C
Posts: 82
Joined: Thu Apr 18, 2013 3:32 pm

Pi Based Tide clock/display

Thu Jan 30, 2014 3:02 pm

I’m exploring the art of the possible here...

I noticed on my commute to work today that the harbour tide clock wasn’t working.

It’s a simple, decorative 4 section bar graph which indicates the current state of the tide. It started me thinking that this could be done with a Pi.

My first thought was a sensor on the harbour wall actually measuring the height of the water, but galvanic corrosion might stop it working after a while?

Then I thought of a RTC module, and deriving the tide state from the local time, knowing the phases of the tide and synchronising with it.

Or a GPS module, by counting a 1 pps signal or as above deriving the current tide state by time.

My worry with it being time/GPS based is drift. Are the tides exactly predictable by time?

I don’t really have a problem with the interface to the indication system. I can use GPIO for that.

I imagine the code to count pulses and take a gpio high accordingly wouldn’t be too complicated?

What do you all think?

Cheers

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 3:43 pm

Johnny5C wrote: My worry with it being time/GPS based is drift. Are the tides exactly predictable by time?
The time is pretty predictable, it just follows the moon - though calculating the height is probably much harder!

I think local effects are very significant, both in the height of the tide and its timing (i.e. how soon it happens before or after the moon passes). For example if you're in a large river estuary which is facing due East or West the tides tend to be much higher than other areas... I think...

Another idea is to write something that just logs onto the internet and looks up tide table data for your area - I'm sure some service will be available for areas with lots of shipping...

RH314
Posts: 8
Joined: Thu Jan 30, 2014 3:23 pm

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 3:52 pm

From below 2 links, it seems tide clocks can be implemented less complicated than what you are thinking without those external sensor interface.

http://www.ebay.com/bhp/tide-clock

http://en.wikipedia.org/wiki/Tide_clock

Johnny5C
Posts: 82
Joined: Thu Apr 18, 2013 3:32 pm

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 5:08 pm

Thanks Ravenous.

The existing "tide clock" only has 4 segments, so the full out to full in tide only corresponds to 5 states. (I think)

Tide out = no lights
Light 1
Light 1+2
Light 1+2+3
Tide fully in = light 1 + 2 +3 +4

and in reverse!

I have done some python work with A/D conversion, lighting an LED for a corresponding value between 0 and 1023.

If I imagine this applied to the above example :

0 to 200 = state 1
201-400 = state 2
401-600 = state 3
601-800 = state 4
800-1023 = state 5

But this relies on actually sensing the water level. I think that will prove too dificult. Hence why im thinking about it being time based.

Im struggling in my mind to correlate the time to a tide state, as they are not in sync.

It seemed so simple on the surface.

Google Gosport Tide Clock if you want to see what im talking about!

EDIT: Looked closer and it has 5 segments, but the same principal applies!

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 5:23 pm

Good grief I just gooogled what you said and found this:

http://www.wolframalpha.com/input/?i=Go ... ide%20time

Also this:

http://tides.mobilegeographics.com/locations/2222.html

Neat eh? That's the sort of thing I was thinking of. You could just have a program at home that logs into that.

The wikipedia page has some interesting examples of charts for different tide types too:
https://en.wikipedia.org/wiki/Tide
- I was thinking the time between lunar tides would be a single fixed period (just over 12 hours) but I can't find it quoted anywhere. I've seen home tide clocks, novelties for fishing fans, and as far as I can tell they are just a normal clock that runs at that speed - you would set it at the known high tide for your area and it just goes high, low, every 12 and a bit hours. I think that period is fixed, though the wiki page says some places get very differently shaped tides.

hippy
Posts: 8561
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 5:42 pm

Tide clocks seem to be a variant on Moon Phase clocks with some extra maths thrown on top. The maths is quite complicated but it's simpler if you aren't so worried about accuracy or drift. The time between tides may have some reasonably fixed average but it will vary; for a four quarter display being out by an hour or so may not matter much.

If you can find a tide table and trust its data it could be fairly easy to use / extend that rather than calculate it yourself; let someone else do the heavy lifting!

With an internet connection you could even scrape the data as you go from somewhere on the web, but check copyright and license restrictions. Short-term forecasts should be fairly easily calculated and accurate enough to cover any loss of live data.

stevend
Posts: 285
Joined: Fri Oct 11, 2013 12:28 pm

Re: Pi Based Tide clock/display

Thu Jan 30, 2014 6:09 pm

The interval between successive high tides is usually around 12.5 hours. In an ideal world the tide height against time is a sinusoidal curve; local effects change this, with the Solent being particularly non-sinusoidal - you get a double high water in places. (see http://www.ntslf.org/data/realtime?port=Portsmouth for Portsmouth, which is relatively good compared with nearby Southampton (http://easytide.ukho.gov.uk/easytide/ea ... onLength=2).

Calculation of tide height involves a number of 'harmonic constants' - can be 200 or more, although a smaller number will suffice for a reasonable approximation.

Have a look at http://www.wxtide32.com/ - I found that its times of high/low tide were within half an hour of more accurate predictions from other sources (for the River Thames, at least). More to the point, you could download its source code (or the original XTide http://www.flaterco.com/xtide/, which being a Unix program might need less work to run on the Pi).

A number of ports (e.g. Portsmouth - http://www.qhm.mod.uk/portsmouth/port/tides) also publish tide tables.

Or you may be able to get a data feed from Bramble Bank weather station (http://www.bramblemet.co.uk/%28S%28zyua ... fault.aspx) out in the Solent.
Maybe you could improve on the original tide gauge display!

croomster
Posts: 1
Joined: Sun Feb 02, 2014 5:40 pm

Re: Pi Based Tide clock/display

Sun Feb 02, 2014 5:50 pm

How about setting up the Raspberry Pi to display the tidal information (and surf height) by using it to send you an RSS feed from Surfline.com? You won't have a 4-LED readout (you'd probably have to use a monitor at first), but then you would also have surf conditions and MUCH more reliable information in every part of the world due to circumventing the fun mathematical headache you've conjured for yourself. Tide clocks sold in the U.S. tend to work pretty well on some parts of the East Coast but only provide the vaguest possible information everywhere else without constant re-setting. How easy would it be to then send the feed to some Nixie tubes in a scrolling readout? Or, you could skip the display altogether and use miniflux to have the pi send you the feed in the form of constant, nagging emails that fill up your inbox.

Johnny5C
Posts: 82
Joined: Thu Apr 18, 2013 3:32 pm

Re: Pi Based Tide clock/display

Mon Feb 03, 2014 1:11 pm

Thanks all for your input and comments.

I like the idea of polling a website for current tide information, but I was hoping to come up with something stand alone, i.e., it doesn’t rely on an internet connection to work.

So with tides having a period of 12.5 hours it would be simple to equate this to counting a 1 PPS signal from a GPS receiver.

You know what? I might ask the council to let me have a look how the existing one works (or dosent)!

Cheers

John

stevend
Posts: 285
Joined: Fri Oct 11, 2013 12:28 pm

Re: Pi Based Tide clock/display

Mon Feb 03, 2014 1:33 pm

Johnny5C wrote:So with tides having a period of 12.5 hours it would be simple to equate this to counting a 1 PPS signal from a GPS receiver.
If you get the period between high tides accurate, this would certainly work - essentially an electronic version of the 'tidal clocks' mentioned earlier. The most accurate time I found on a quick look was 12 hours and 25.2 minutes (Wikipedia) - maybe compare this with your local tide tables.

Set a start time from the tide table, calculate a sine wave with a period 12 hours 25.2 minutes and you'll have an approximate indication of tide activity at any time. You could then enhance it by taking into account spring and neap tides...
Johnny5C wrote:You know what? I might ask the council to let me have a look how the existing one works (or dosent)!
More likely operated by the harbour authority, or maybe a marina operator. Is it by the ferry?

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Pi Based Tide clock/display

Mon Feb 03, 2014 2:11 pm

Johnny5C wrote: You know what? I might ask the council to let me have a look how the existing one works
The clock shows the current state (when it's working that is) but it doesn't seem to show the direction - whether the tide is currently going up or down, or is slack. I think a neat system would be something to show both the level and an arrow or other indicator to show which way it's going. Is it still going up, or is it on the way down for example? Is now a good time to set the rods up on the "beach" or wait a bit?

By the way a super-accurate clock is still not that accurate if based on the 12-hour-something cycle. Remember the exact time of highs and lows varies with the Sun's position too. The fixed cycle is only going to be exactly right twice per month (or maybe twice per 29.5 days or so?)

Steve walls
Posts: 2
Joined: Sat Feb 01, 2014 5:03 pm

Re: Pi Based Tide clock/display

Mon Feb 03, 2014 2:12 pm

Tide heights aren't totally predictable. Tidal height predictions are based purely on astronomical data, position of moon sun and planets. If there's an onshore wind, tides are likely to be higher, high pressure in your area and there'll be lower etc.

Most places just have a tide gauge painted on to a post to give you current tide.

Mechanical tide clocks are usually just a normal clock (12hrs 25m per rotation), though I guess if you wanted a real measurement, an ultrasonic sensor, with averaging applied to take out any wave effects would do it.

Steve

User avatar
DougieLawson
Posts: 40227
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Pi Based Tide clock/display

Mon Feb 03, 2014 5:47 pm

Steve walls wrote:Tide heights aren't totally predictable. Tidal height predictions are based purely on astronomical data, position of moon sun and planets.
Could you explain which planet is a) near enough and b) massive enough to have any noticeable effect on tidal levels?
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

mixographer
Posts: 5
Joined: Tue Feb 04, 2014 5:53 am

Re: Pi Based Tide clock/display

Tue Feb 04, 2014 6:11 am

Johnny,

Save your Raspberry Pi for another use, and do it with a simple Arduino, take a look at this library:

http://lukemiller.org/index.php/2012/09 ... e-arduino/

I built a tide clock with this library and 2 10x10 led matrices. It works great.

tenochtitlanuk
Posts: 156
Joined: Fri Jul 06, 2012 8:51 pm
Location: Taunton, Somerset, UK
Contact: Website

Re: Pi Based Tide clock/display

Tue Feb 04, 2014 11:06 pm

I see three areas of interest here worth using a Pi for.
1 If you have access to the sea, install a vertical pipe sump-and-float, and use a Pi to record a year's worth of tidal level. Now do a frequency/amplitude/phase analysis on it.
2 Use this data, or the appropriate constants scraped from the web to PREDICT next years tides, and compare with next year's actual data.
OR ( !)
3 Use a Pi and weather-hardened flat-screen display to show present level and trend, plus web-scraped relevant info. Or an electro-mechanical equivalent that would be visible to sailors in your nearest marina ( or yacht club bar)

Otherwise, just add 12.5 hours to the time of last HW to predict the next one! Shouldn't need a Pi...

Johnny5C
Posts: 82
Joined: Thu Apr 18, 2013 3:32 pm

Re: Pi Based Tide clock/display

Wed Feb 05, 2014 10:08 pm

Thanks for the link mixographer. I will check that out.

But tenochtitlanuk,
Shouldn't need a Pi
Doesn't mean dont use a Pi!

Cheers

tenochtitlanuk
Posts: 156
Joined: Fri Jul 06, 2012 8:51 pm
Location: Taunton, Somerset, UK
Contact: Website

Re: Pi Based Tide clock/display

Mon Feb 10, 2014 9:51 am

Agree entirely... it's these odd uses which are the most fun.

Return to “Automation, sensing and robotics”