Project: SURFCAST

An LED Lamp which enables you to instantly be informed about the local surf forecast
In an unobtrusive way, while seamlessly integrating into your daily routine

By John Mulcahy

Description


This is a Raspberry Pi Project

The Raspberry Pi is a mini computer which is designed to be lightweight and cheap but almost a fully functional computer. This makes it perfect for small projects such as this.
This is a relatively easy project to build and can be done over a few weekends, all of the components necessary are mentioned with links of where to buy and linked pdf tutorial on wiring. I created the Surfcast project for surfers or any water sport enthusiast in mind, whether your miles from the beach or always feel the need to have a connection with the local surf. This lamp will bring the waves to you!
The motion activated lamp will download the most current and accurate local surf forecast and display it using 120 integrated LEDs. Enabling you to effortlessly glanse at this lamp and make a decision to go for a surf.
There are many ways to get the surf forecast but this lamp makes it almost effortless.

Accreditation

The forecast data generated is done completly by www.magicseaweed.com and full accreditation to there service for this data is given with much appreciation.
The C++ module which drives the underlying code to send input to the LEDs is taken from rpi_ws281x library by Jeremy Garff which is a publicly available library, this is needed to run the Adafruits neopixel LEDs on the Raspberry Pi. The display code which is written in python makes use of this C++ module.


Details

Key features and Functionality

  • Motion activated sensor that starts the forecast display, this sensor can be easliy programmed to be triggered after various motion intervals
  • Display's a 24 hour surf forecast, a new forecast is downloaded through the MagicSeaWeed API once the forecast is older than 24 hours
  • A wave is represented by a rows of LEDs which show the height of the waves by the color they bear and their relative motion by its speed through the display using the sets period value.
  • Display's Primary, secondary and combined wave heights and periods between wave sets in 3 hour time blocks, starting from next 3 hours to 24 hours a head
  • This project has the ability to get other local weather information such as precipitation, temperature and wind I hope to add these in another update.


Basically 3 projects in 1!

Retrieve surf forecast API thorugh Java program

Display forecast to LEDs using Python

Hardware assembly project


Basic demo video

With Cover

Without Cover


Reading the display and what it means

In general the greater the wave period, the better the swell. The amount of time it takes for two successive wave crests to pass through a determined point is called swell period or wave interval. The swell period is critical surf knowledge because it ultimately measures the quality of the upcoming surf session.

A wave is represented by rows of LEDs in the lamp and there colour is determined by the wave height.

The surf forecast is split into 3 hour time blocks, each time block first shows the primary swell then the secondary swell and lastly a combined or average swell to give a total of 3 wave sets per time block.
Their period swell value determines the speed of the waves moving through the lamp to give a feeling of the quality of wave sets in the forecast.



Build and Design






Code Implementation

Code Discussion

This java code first checks to see if a previous file with the json forecast data exists and if not creates a new file to be written to. A connection to the magicseaweed website is then tested whether it is accessible or not, if it is then it checks to see how old the previous file is, if its older than 24 hours it will begin to stream the json data in and write it to the file for use by the python script.
IF the file is not older than 24 hours it will just use the current file, this ensures that the API service is not called more than once a day which is in the terms of use of the magicseaweed API service. In the end a valid json file should exist.


Conclusion

This was a fun project to make and has a lot of possibilities to add to its functionality as it can display various colours through the leds, further improvement of the wave display will be made by adding more wave detail in the display.

The ability to display other types of weather such as temperature, wind and precipitation is another opportunity to add to this project by implementing another API service and creating a general weather display script

Issues in this project:

The main issue was the Raspberry Pi's wifi connection which seems to drop out frequently, the main purpose for the wifi is to connect to the API service and also to update the RPIs time from a server on the internet as there is no inbuilt clock hardware on the RPI. To resolve this issue it required running a subprocess which refreshes the network in order to regain connectivity. This is an issue with the Raspberry Pi model B itself as of 02/03/2018.

The total cost of this project was €130.00

I hope this project will be useful to other poeple who are interested in building similar projects. If you have any questions email me at johnmulcahy346@gmail.com