In the United States, the average distance between tide stations with real-time measurements is over 100 miles. Tide levels can vary significantly over short distances and variations are particularly noticeable in bays and inlets. Strong wind also results in water levels significantly higher or lower than predicted, so local real-time measurements are essential to determine the current water depth for navigation or current flood levels. Average distances of 100 miles between tide stations means there are many locations along the over 12, 000 mile long US coastline without the benefit of real-time measurements for navigation or flood alerting.
Tide measurement and forecasting in the United States is provided by the National Oceanic and Atmospheric Administration (NOAA). NOAA provides tidal predictions for over 3, 000 locations, and about 113 of them are active primary "Harmonic" tide stations with tidal harmonic constants and tidal datums calculated from measured tide levels. Many of the Harmonic stations also provide real-time tide level data. Predictions for the rest of the "Subordinate" locations are based on the Harmonic stations and do not provide real-time tide level data.
This project describes the design of a tide and meteorological station for Popponesset Bay on Cape Cod. It is the latest of multiple iterations of low-cost tide gauge designs dating back to 2010 designed to provide real time water level data for shallow water navigation and coastal flooding. A previous generation tide gauge was published in Hackster in 2017. This tide station improves on the previous designs in the following ways:
- It provides automatic estimation of tidal datums. In particular it automatically estimates the mean lower low water (MLLW) and logs and publishes tide levels relative to MLLW.
- It uses two ultrasonic sensors to improve the detection of false outlier readings that are a particular issue during strong snow storms.
- It is solar powered.
- It includes the following meteorological sensor readings that are relevant to tidal surge forecasting: wind speed and direction, atmospheric pressure, and water temperature. It also includes air temperature and humidity sensors.
- It is based on the Sentient Things IoT Node that enables the use of multiple communication modes including: Cellular, WiFi, Ethernet, and Lora.
- It is capable of being modified to use other tide level sensors including radar and submersible depth pressure gauges.
The Sentient Things Tide Gauge and Met Station measures water level, wind speed and direction, atmospheric pressure, and air temperature and direction. Readings are taken every minute and the data are saved locally to micro SD card and also sent to the cloud for storage and real-time display.
The tide levels are published relative to MLLW and the MLLW is automatically estimated by the tide gauge software. The tide gauge estimates the MLLW by measuring and saving the average of the MLLW values over time. After installation the gauge measures an entire tidal cycle over 25 hours to determine the first MLLW estimate. The gauge reports tide levels after estimating the first MLLW. In the chart above you can see the discontinuity in the MLLW at 16:20 as the MLLW value was updated. As the MLLW estimate improves over time these discontinuities get smaller and smaller until they are no longer noticeable.
The tide gauge uses two temperature compensated ultrasonic sensors placed at different heights above the water. The height difference between the sensors is automatically measured when the tide gauge first starts up and the height difference is saved to non-volatile memory. Range readings alternate between the two sensors and the median of the last 99 readings is used as the range value. Differences between alternate readings that are greater than 30 mm are rejected. This improves the detection of false outlier readings that are a particular issue during strong snow storms.
The tide gauge firmware includes serial outputs for debugging and publishes device quality metrics or "Vitals" to the cloud.
Cloud functions and variables are exposed by the device. The hardreset function is used to completely reset the firmware state once the station is installed for the first time and to start the station calibration process.
The assembled tide station hardware without sensor extension cables and mounting hardware is shown below.
Note that in the actual project a larger solar panel and a larger Li-Ion battery was used as listed in the parts list above.
Follow the instructions below to assemble the parts. Before deploying the station in the field assemble it as shown above and bench test it thoroughly.
Step 1: Assemble the IoT Node, Weather and Level Adapter and Particle Communication ModuleThe Sentient Things IoT Node, Level and Weather Adapter, and Particle communication module are mounted inside a hinged waterproof case that comes with the IoT Node. The IoT Node includes a stackable header that is a super-set of the Adafruit Feather header. Stack the boards are together as shown below:
In the photo above a WiFi Particle Argon is shown. This is an option if reliable WiFi is available. The cellular Particle Boron LTE has the same footprint and is the actual module used in this project. The Particle Boron 3G is also an option outside the USA. The USB cable plugged into the Particle module is used for programming and debugging and is removed after programming for deployment. Connect the AM2315, DS18B20, and Maxbotix ultrasonic sensors using following the Sentient Things header pin-out:
A side view of the stacked boards is shown below:
Assemble AM2315 air temperature and humidity sensor and shield as shown below. Pass the AM2315 cable through a hole in the base of the sun shield and attach the AM2315 using Velcro. Note that the RJ45 connector is too large to pass through the hole and so attach the RJ45 connector after passing the cable through the hole in the sun shield.
The water temperature sensor is a DS18B20 sensor packaged in a stainless steel case. While the sensor is waterproof, it will not last long submersed in marine water and so the sensor is mounted inside a PVC pipe. Installation details will vary from site to site.
Epoxy the DS18B20 to a threaded PVC end cap and solder a six inch pigtail with a female connector to the DS18B20. Make the pigtail connector by cutting off the end of the waterproof cables listed in the parts list. Note that the pin size of these waterproof connectors is NOT consistent from vendor to vendor and so it is best to purchase complete cables and cut them rather than using individual pigtail connectors from different vendors and attempt to match them with extension cables. These cables are very reasonably priced. Other more expensive options exist such as using waterproof marine NEMA 2000 cables.
Choose a pipe length and fittings for your particular installation.
Step 4: Assemble Ultrasonic and DS18B20 pigtailsAssemble RJ45 to male waterproof connector pigtails to enable easy connection and maintenance of the two ultrasonic sensors and DS18B20 in the field. Thread the waterproof cables through the cable gland in the IoT Node enclosure before the RJ45 connectors are attached. The individual wires are a very tight fit and the listed RJ45 connectors are needed for their hole size. The easiest way to thread the individual wires through the pass-through RJ45 connector is to strip about 1/2" of the insulation off the ends of the wires before threading them through the RJ45 connector. Pull the bare ends through the RJ45 holes so that the wire with insulation is also fed through the holes. Crimp the RJ45 when done.
Solder six-inch female pigtails to each of the Maxbotix ultrasonic sensors as shown earlier. The choice of which wires to use with the waterproof cables is arbitrary so long as the following connections are made from end to end. It is best to be consistent from pigtail to pigtail.
For the DS18B20 the wiring is as follows. The wire colors below are typical but not guaranteed.
DS18B20 Sentient Connector
GND (black) GND
Power (red) 5V
Data (yellow) GPIO
Note that the DS18B20 should only be connected to the header on the Level and Weather Board shown in the labeled photo.
Step 5: Mount the Ultrasonic Range SensorsMount the two Maxbotix sensors above the water level at a height of least 30 cm above the maximum tide surge level. The maximum range of the selected sensors is 5 m and it is necessary to have a clear and open path to the water (see Maxbotix site for details). Mount the sensors with a height difference of at least 150 mm. Measurements are alternately taken of the distance to the water for each sensor and compared. If the difference between the readings is not consistent (+-30 mm) then the software rejects the reading. This technique minimizes false readings that are typically noticeable during blizzard conditions and that are difficult to detect through software filtering. The median of the last 99 readings is taken as the current range to the water. Note that one sensor will also work with this system if preferred.
The mounting of the ultrasonic range sensors is very site dependent. Mounting the sensors on the side of a pier is a very common arrangement but in this location the water bottoms out underneath the pier during very low tides and so the sensors were mounted on a piling in deeper water.
The arm used to mount the sensors should be rigid and not sag over time. Pilings are also not the best mounting arrangement as they can move over time or be jacked up by ice but in this installation there was no better alternative.
It is important to note that the recommended sensors are internally temperature compensated and also include filtering that provides the range of the largest returned signal that, in this application, is the water if mounted correctly. For best accuracy, additional sun shielding of the range sensors should be provided. In the photo below you can see how PVC adapters were mounted over the ultrasonic sensors and painted white to provide additional sun shielding.
This arm works well but ideally it should include additional bracing to prevent future tilting of the arm.
The Li-ion battery and solar panel used for this project are listed above. This solar panel and battery are larger than the ones shown the the photos to provide additional margin for bad weather conditions with limited sun that may last days. Although not shown, it is necessary to extend the leads of the Li-ion battery to mount it in the lid of the enclosure where the black battery pack is shown in the photos above. Remove the 3AA battery pack lid to make it thinner and mount it higher on the lid opposite the Boron. Do this to prevent the thick 6600 mA battery from interfering with the Boron when the case is closed. Mount both batteries to the lid with the Velcro pads that come with the IoT Node. Note that the 3AA batteries are designed to provide fail over power in the event of the Li-ion battery running flat. The firmware described below does not provide an alert when this happens but this could be added. The battery and solar panel connections are shown below:
For this project the switch is in the FBAT position when on.
Step 7: Wind GaugeThe wind gauge is plugged into the IoT Node as shown earlier. In this implementation the gauge is mounted to the side of the piling using stainless steel brackets as shown. This height is not ideal for a wind gauge but the aesthetics of a taller pole are not desirable for this location. Find the small N mark on the gauge and use that to make sure the gauge is installed with the N facing North.
Step 8: Micro SD CardAn 8 GB micro SD card is used for local storage and is plugged into the Micro SD Card slot on the IoT Node. This provides additional backup of the data that are sent to the cloud.
Step 9: Create ThingSpeak and Particle AccountsCreate a ThingSpeak and a Particle account if you do not have one already. ThingSpeak offers free accounts for non-commercial use and Particle offers a free service level too. Note that if you use the Particle cellular option then there is a monthly fee for the data that you use.
Step 10: Cloud Data Storage and DisplayWhile the firmware can be modified to work with almost any cloud server, ThingSpeak is easy to use and includes good display capabilities (I am also partial to ThingSpeak as I was the CEO of the IoT company ioBridge that originally created ThingSpeak).
The ThingSpeak documentation provides details on how to create a ThingSpeak Channel and edit the channel properties. Do this before the project is deployed. Use the channel used for this project as a template.
In addition to creating a ThingSpeak Channel and setting up the fields as shown above, record the ThingSpeak Channel Write API Key (See API Keys tab in your ThingSpeak channel) and channel ID number so that they can be added to the firmware later.
Step 11: Particle Account and WebhookThingSpeak offers both REST and MQTT APIs to send data to ThingSpeak. ThingSpeak also provides a Particle/Arduino compatible library to make it easy to use the APIs. This library is an excellent choice for devices that are connected via WiFi or Ethernet where there are no data charges. In the case of cellular though, it is best to minimize the data traffic by not using REST directly. One of the best ways to do that is to use Particle's (low overhead) COAP protocol to send data to the Particle servers and to have the Particle servers relay the data via REST (http) to ThingSpeak. This is done using Particle Webhooks.
The Sentient Things firmware makes use of the Particle Webhooks listed in the Code section below. Log into your Particle account Console and create the TSBulkWriteCSV Webhook under Integrations by pasting the JSON code below into a Custom Template and saving.
This project requires an understanding of the Particle.io modules and services. Particle provides excellent documentation. Familiarize yourself with registering your Boron and programming it with examples using Particle's web IDE or desktop IDE called Workbench that uses Visual Studio Code.
Use the firmware listed below to program your Particle device. This may be done using the Particle Web IDE or by using Particle Workbench if you are familiar with the Visual Studio Code based desktop development environment. You may copy and paste the code below into a new project on the Particle Web IDE or simply follow this link to a shared version of the firmware.
You may program or flash your device over the air (at the expense of data usage) or you may flash locally connected to your computer to avoid cellular data charges by following Particle's instructions.
Prior to flashing your firmware you need to update the TideGauge.ino file to add your own ThingSpeak channel ID and Write API Key:
Assemble and fully test you station on the bench before deploying it to the field. Monitor the serial output through the Particle USB port and log into your Particle Console to view the published messages. Read through the firmware to understand the details behind what you are seeing.
Note the exposed Particle functions and variables and familiarize yourself with them prior to installation. The hardreset is particularly important as it clears the state of the device prior to calibration. Read through the firmware to determine the Argument values used below.
Make sure that your device is posting expected readings to ThingSpeak and familiarize yourself with clearing data from a ThingSpeak channel. You will need to clear your data after testing and once the device is installed in the field.
For bench testing you may find it useful to rig up your range sensors something like this so that they are at a fixed height separation pointing at a ceiling.
After fully testing your tide station on the bench and fully familiarizing yourself with the hardware and firmware you are finally ready to install your tide station. Each installation is unique but at a minimum do not forget to run hardreset after installation and clear your ThingSpeak channel.
DisclaimerThis firmware and design is provided as-is and does not come with support or any warranty. The use of any tide gauge data generated using this design is also at your own risk and the author assumes no liability to you or anyone else for any decision made or action taken based on data published using this tide station software design.
Comments