By John Mulcahy
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.
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.
Retrieve surf forecast API thorugh Java program
Display forecast to LEDs using Python
Hardware assembly project
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.
(Links and prices)
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.
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
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