Tutorial 9: Measuring Tank, Snow or Water Levels over the Internet

This tutorial explains how to measure tank, snow or water levels over the internet using the combination of an ioBridge module and the Maxbotix XL-MaxSonar® -WR1™ (Part Number MB7060) range sensor.

Step 1 – Connect the Ultrasonic Sensor

Refer to the Maxbotix Datasheet and connect the sensor to Channel 1 as follows. Note that the Maxbotix sensors do not come with connectors and that wires need to be soldered to the Maxbotix terminals. Cat-5 Ethernet cable is a good choice.

Maxbotix wiring corrected

According to the datasheet for this sensor AN outputs analog voltage with a scaling factor of (Vcc/1023) per cm. A supply of Vcc = 5V yields ~9.8mV/in. The output is buffered and corresponds to the most recent range data.

Note: 0-5 V analog inputs of the ioBridge modules can be read and displayed as RAW 10-bit numbers. i.e. 0-5V corresponds to a number 0-1023. Conveniently the 0-1023 RAW values correspond to range from 0-1023cm.

Step 2 – Configure your Module

Follow the steps shown in previous tutorials to register your module if you have not done so already.

Log on to your account, click on the Modules menu, select your module and adjust the Settings for the channel that your sensor is connected to (this tutorial assumes channel 1) as follows:

The settings above send the analog values from the sensor to the server every 10 seconds. The RAW Analog Input value is the sonar range in cm.

Step 3 – Place a Range Gauge on your Dashboard

Click on Widget and then Create Widgets. Follow the Wizard to create an I/O monitor – i.e. I/O Monitor|Analog Input|”Select Module”|Channel 1|. You should then get a page that looks like this:

Edit the Widget to look like the following. Note that you can leave the display as text if you prefer or use a different style.

Click on your dashboard to see your new Range Gauge.

Step 4 – Display Range Results in Other Ways – i.e. Level, Volume etc (Using the Optional Expression Builder)

The Expression Builder functionality for the ioBridge modules enables you to scale inputs by applying equations to input values. Here are a few examples that might be useful:

Example 1 – Display the results as Range in Feet

Knowing the distance to a reference level (or Offset) it is often useful to use range to determine level (i.e. snow, water, grain etc) using this simple expression:

Level = Offset – Range

This can be implemented using the Expression Builder. The Offset value can be set using a “Set Selectable Variable Value” widget as follows:

The following expression could be used to take the range offset provided in inches and display the result as level in feet. Of course any other combination of units could also be used.

Example 2 – Display Cylindrical Tank Volume in Gallons

Take the following cylindrical tank as an example:

The volume of the substance in the cylindrical tank above is:

Volume = 3.142 * Radius * Radius * Level

If the units are in feet then the volume in gallons is:

Volume (in Gallons) = 7.48051948 * Volume (in cubic feet)

This can be implemented using the following expression where the radius is defined by the user.

This can be displayed on your dashboard as follows:

Step 5 – Logging your Results

The best way to log range measurements (or measurements based on range) is to use Medians rather than Averages or raw values as follows:

This is important since Range sensors tend to occasionally produce very short or very far false readings (outliers) that are effectively filtered using Median readings.

click to chat