Ultra depth sounding

Six weeks ago I installed version 3 of a water depth data logger in the vernal pool we are monitoring. I liked that logger more than the earlier versions because the parts cost $35 instead of $50. After posting about it I noticed that many Arduino hobbyists measure distance with an ultrasonic rangefinder instead of the laser rangefinder I had used, so I ordered a few HC-SR04p rangefinders.

The top of a peanut butter jar with an ultrasonic rangefinder (HC-SR04p, top), a temperature, humidity, and pressure sensor (BME280, left), and the cable for a water temperature sensor (DS18B20, right). The ultrasonic sensor sends a sound from one side (left) and senses the reflected sound on the other side (right).

There were three important unknowns about this ultrasonic sensor, but after some testing I learned that 1) it is very good at measuring the distance down to a surface of water, and 2) it can be run on 3.3 volts, and 3) it does not require an Arduino with a lot of memory. These three features allowed me to make a new version of the vernal pool water-depth data-logger with a remarkable characteristic — the parts cost only $17.00, half the cost of the last version (see BOM below).

The parts used for the new version of the vernal pool data logger. If ordered carefully from places like eBay or Amazon, the total cost of these parts, including shipping, is $17.00. That might require buying more than one of some of the parts.

Four serendipitous things allow this. First, ultrasonic rangefinders cost $1.00 instead of $7.00 for the laser rangefinder. Second, the laser rangefinder used in the previous versions is hard to run without a beefy Arduino microcontroller with enough memory for its big library. The ultrasonic rangefinder does not even need a library and runs great on a basic 328p Arduino like a Pro Mini. That saves $8.00. Third, the laser rangefinder does not work in bright light so I used a light sensor to keep track of when the laser readings were unreliable. The ultrasonic sensor works regardless of light level, so we can save $6.00 by eliminating the light sensor and also get continuous water level data. Fourth, although the basic ultrasonic rangefinders run on 5 volts, some models seem to do fine on just 3.3 volts. That allows them to run on the Arduino Pro Mini with other common and inexpensive data-logging components that can run for months on batteries. The rangefinders I bought are labelled “HC-SR04p,” and that “p” might be an important designation that it can run on 3.3v.

All the parts soldered together into a working vernal pool data logger.

Another advantage of the ultrasonic rangefinder compared to the laser rangefinders is that bouncing the sound signal off a water surface works very well. I had to float a target under the laser rangefinder versions, but that is not needed with the new version. That may not save any money, but it makes installing the logger easier and eliminates a fragile moving part.

The Version 4 logger ready for field deployment in its peanut butter jar.

Yet another minor advantage of the Version 4 logger is that the low-power timer works well with the Arduino Pro Mini and does not need to be kludged with the capacitor I added to make it work with the Adafruit Feather or ItsyBitsy.

Part of the testing of the new logger involved installing it in my backyard pond and then making like a beaver and manipulating the water level. The peanut butter jar is inside the iced-tea jug which has its bottom removed.
Results from a preliminary test of the Version 4 logger. The changes I made to the water level in my backyard pond were recorded well by the logger, in this case every 30 minutes or so. However, some data logging intervals were skipped (note gap after I “Breached the dam”). Also, the logger stopped logging altogether after two days. This was caused by a software bug, and after two weeks of troubleshooting the bug was carefully removed from the premises. Every time the logger wakes up, it takes 10 distance measurements and computes the mean and standard deviation.
Other tests produced some understanding of the precision and accuracy of the ultrasonic rangefinder. I set up the logger at measured distances from a wall and let it record data for many hours. The results above suggest that the error increases (precision decreases) with distance from the wall. The actual distance to the wall was either 20, 40, 60, 80, or 100 cm, so accuracy was good in this test.
This separate test with greater distances from the wall (100, 150, and 200 cm) again suggests that precision decreases with distance, and error is generally less than a centimeter or two, especially for distances under 200 cm. It also suggests that accuracy varies with distance, but I wasn’t as careful as I could have been measuring the distances with my meter tape, so some of that inaccuracy is probably not the fault of the rangefinder. The results of the rangefinder seem to be sufficient for the intended use which is to track the general long-term trends in vernal pool water level.
The circuit schematic for the Version 4 logger. The low-power timer cannot get more than 5.5 volts, so four alkaline AA or AAA are too much voltage, but four rechargeable NiMH batteries (1.2 v each) seem to work fine. The Arduino Pro Mini takes whatever voltage the timer sends to it and reduces that to 3.3 volts which powers everything else.

Bill of materials. These are prices on eBay or Amazon including shipping, but sometimes you have to order more than one to get these prices.

  • Arduino Pro Mini (3.3v) …………………………………$3.00
  • Adafruit low power timer (TPL5110) …………………..$5.00
  • Real-time clock (DS3231) ………………………………$1.00
  • MicroSD module (3.3v) ………………………………….$1.00
  • MicroSD card (1 or 2 GB) ……………………………….$3.00
  • Ultrasonic rangefinder (HC-SR04p) ……………………$1.00
  • Temp, pressure, humidity sensor (BME280, 3.3v) ……$1.00
  • Water temperature sensor (DS18B20) …………………$1.00
  • Battery case (4 AA) ……………………………………….$1.00
  • Total ………………………………………………………$17.00

I hope to install the new logger in our vernal pool soon and also retrieve the data from the two loggers already there [I did just that].

The sketch running on the Arduino Pro Mini is here.

Leave a Reply

Your email address will not be published.