Originally posted on Hackster April 8, 2021
Featured in MagPi Magazine, Issue 106!
My parents recently got a place on the water and have been obsessed with looking up the tides everyday so I decided to build them a custom TideTracker. The idea is to present the predicted high and low times for the day and a plot showing the tide over the last 24 hours. In addition to that I added some basic weather data to give them info at a glance.
This project uses a Raspberry Pi for the brains and an E-Ink display for the information. When researching the project initially I found a similar project by Luke Haas that I used to test the display’s functionality before writing my own program, check that project out here.
E-Ink Display
For this project I wanted to use an e-ink display for a few reasons. The first being that they are low energy; once the screen has been written to the image on screen will remain even when power is removed which means the device can enter a sleep mode without needing to power the display. Secondly this is going to located likely in a very sunny place and there’s no need to worry about brightness or glare on e-ink screens. And lastly because I think they’re cool and I haven’t had the chance to use them in any of my projects yet.
This project uses the WaveShare 7.5 Inch Display and HAT for the Raspberry Pi. There are a number of different versions of this display but I’m using the basic 800×480 black and white.
The Brains:
This project is running on a Raspberry Pi ZeroW which is perfect given it’s compact size and wifi connectivity. All of the computation and code is done in python; this includes gathering tide/weather data, analysis, image processing, and writing to the e-ink display. The program is a loop that pulls data from the two sources, analyzes it, prints it to the display, then sleeps for 10 minutes and repeats.
Data Sources:
Weather Data:
The weather is pulled directly from OpenWeatherMap.org based on coordinates of the town/city. Using the free One Call API we get get current, forecast and historical weather data all in a single json file. This is the information that will be printed to the screen and used to determine the weather icons used.
Tide Data:
Local NOAA station using noaa_coops python package which is an awesome tool that allows you to pull requested data through their easy API. First you have to identify the closest local station that collects the data we’re after and get the station ID number.
From this station the past 24 hour tide level data is pulled and analyzed to create a plot which is then exported and saved as a png to use later. The predicted tide times are also pulled based on local standard and daylight time.
For purposes of the display the the plot was actually saved as greyscale as it can’t display color.
Image Processing:
The information that is displayed is actually a single image file that is pushed to the screen meaning that a new image is created every time the program updates (currently set to 10 minute intervals). It begins with a blank image that matches the size of the display (800×480) on which all the information is systematically added/pasted. I began with drawing the straight dividing lines that separate out the different sections then moved onto the weather. The weather icons are determined based off of the data that is pulled; the icon is selected from the image library, resized, then pasted into the appropriate location. After that the tide data is added, writing in the high and low times and pasting in the previously generated plot. The resulting image is what you see below.
Writing to E-Ink Display:
As mentioned above an image file is generated then sent to the display via SPI communication. In order to do this the screen first needs to be initialized which is easily done thanks to the source code on the e-ink’s wiki. When refreshing the image the display will flicker while updating. Afterwards it’s important to put the screen to “sleep” to help prevent potential damage that may occur from constant voltage during prolonged use. The display will maintain the image even after the power has been removed.
The Build:
The way I imagined the project was to look like one of those digital photo frames that sit on a coffee table. The frame housing and stand were designed in fusion 360 and printed on a Prusa i3 MK3. The frame is a simple design with a flat front face for the display to be set in with a back plate with room for the RPi and e-ink HAT. Below you can see the back plate showing the power port hole and kick stand mounting spots.
Once the frame pieces were printed out the components were assembled with some miscellaneous hardware.
The kick-stand is printed separately and is snapped into place on the back of the frame.
Once all the parts were printed and assembled a final test was done to make sure everything worked properly.
Community Builds:
It’s been amazing hearing from people all over about their interest in the project and advice on building their own version. So I thought it would be cool to add a section to the project to highlight builds that other people have done and continue to grow it with any new versions that are shared.
The first build that has been shared with me is by Gwil who adapted the project to work in the UK (his code is linked below).
The next project by Brendan Aye builds off the original code and adds a new lunar phase feature as well as some other changes, the link to his code is in his comment below.
Please continue to share your builds and I’ll update the page as they come in, thanks!
Custom Parts:
3D Printing Files: https://www.printables.com/model/378679-tidetracker
Code Repository:
US Version: https://github.com/Ssabaker/TideTracker
UK Version: https://github.com/GwilCodes/TideTrackerUK
As the proud recipient of the first tide and weather tracker, I can attest to the fact that this is cool. Looking forward to 2.0.