Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

Don’t Get Stuck in the Mud, Understand Tide Levels with MATLAB

Tides go up and down. But, the question is when and how will the tide levels change in the future. If you are planning a boating trip or trying to understand how the wind affects tide levels during storms, you want to predict the tide levels using data that you have collected locally. In a tutorial published on Hackster.io, you will be able to learn how to use ThingSpeak to collect sensor data that represents the tide height at a given time, use MATLAB to preprocess the data, use MATLAB to predict future tide levels, and use ThingSpeak to send alerts. Here’s what the system looks like installed at a dock in Cape Cod.

The tide height is calculated using an ultrasonic level sensor. This measurement is taken periodically and then sent to ThingSpeak, an IoT analytics cloud platform by MathWorks, using a cellular modem. The system can easily be adapted to collect data about any environmental system such as greenhouses or oyster farms.

Once you have the data in a ThingSpeak channel, you use MATLAB to preprocess and clean up the data. The raw data some times has extraneous values caused by environmental factors such as lighting, cabling, and electrical interference. Sometimes, you have missing data caused by connectivity issues. It is important to clean up the data before you use the data in your analysis.

To predict future tide levels and send alerts when the tide is rising or falling, we use the MATLAB Analysis app on ThingSpeak. With MATLAB, we can use historical data to make a prediction about the future tide levels. This predicted tide level can be used to help schedule a boating trip or plan for a water surge after a storm.


Tide Alerts

Remembering to check the tide level when fishing or lazing on the beach is not particularly convenient. A much more useful approach is to have the system send a message when the time has come to pack up and start heading back to the dock. The timing of the alert depends on how much water depth is needed by a particular boat. Larger boats need higher water levels in order to move without getting stuck in the mud. One way to send alerts is to use ThingSpeak and MATLAB to detect changes in tidal height and send alerts.


Developing a tide monitoring system provided accurate tide level measurement and tide level prediction, with the added ability to send alerts. Robert has been able to avoid being stuck in the bay by providing enough time to get back to his dock using this system. This project also serves as a useful approach to solving many data-driven puzzles by having a reliable way to collect, analyze, and act on data. Using MATLAB, the accuracy of the tide levels improved by understanding the proper tide levels at a specific location and when the tide levels will change. If you used the general tide forecast, you would have to account for several inches of tide height difference.


  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.