Depth is being inferred from sound.
The sonar transducer sends a pulse through the water, listens for the return from the bottom, and estimates distance from the pulse travel time. In water, the speed of sound is often close to 1500 m/s, but it is not fixed.
Round-trip time has to be cut in half
The travel-time measurement includes the trip down to the bottom and the return trip back to the sensor. The one-way depth is therefore:
depth = (sound speed × travel time) / 2
That division by two is easy to overlook, but it is fundamental. The instrument never measures one-way depth directly. It measures elapsed time and converts that time into range.
Sound speed depends on the water itself
Temperature, salinity, and pressure all change how quickly sound moves through water. Warmer water generally raises sound speed. Increased salinity also raises sound speed. Greater pressure at depth raises it as well.
Because OMEGA is measuring travel time rather than direct physical contact, any change in sound speed changes the interpretation of the depth reading.
The logger applies a temperature-based correction to the sonar range.
In the Arduino code, the sonar uses a baseline reference speed of 1500 m/s at 20 °C. The measured water temperature from the DS18B20 is used to adjust that baseline before the depth enters the mapping pipeline.
rov_logger_mapping.ino
// Baseline reference values used by the logger.
const float sonarCalSoundSpeed = 1500.0f; // m/s
const float sonarCalTempC = 20.0f; // °C
// Estimate sound speed from water temperature.
float estimateSoundSpeed(float waterTempC) {
float c = sonarCalSoundSpeed;
if (!isnan(waterTempC)) {
c += 4.6f * (waterTempC - sonarCalTempC);
}
return c;
}
// Rescale the sonar-reported range to match the estimated sound speed.
float correctSonarRangeCm(float reportedRangeCm, float waterTempC) {
float cActual = estimateSoundSpeed(waterTempC);
return reportedRangeCm * (cActual / sonarCalSoundSpeed);
}The logger starts from a reference calibration, then nudges the sound speed up or down based on the measured water temperature. If the water is colder than the reference condition, the corrected depth will come down slightly. If it is warmer, the corrected depth will rise slightly.
Salinity still matters, but it is not currently being measured by the device.
The absence of salinity in the correction model does not mean salinity is unimportant. It means the present version of OMEGA is using the variables it can actually measure in the field. Temperature is available directly from the DS18B20, so the code includes a temperature-based correction.
Why the temperature-only model can still be useful
In shallow or modest-precision surveys, especially in freshwater, a temperature correction can remove one of the largest easy-to-measure sources of error without adding more hardware or more operator setup. It is a practical improvement over using a fixed sound speed all the time.
When a fuller sound-speed model would matter more
In salt water, deeper water, or higher-accuracy survey work, salinity and pressure should be part of the model as well. A future version of OMEGA could add a conductivity or salinity sensor, or use a dedicated sound-speed instrument, to improve the correction.
The reading is corrected before it is accepted.
The sonar value does not go straight from the packet decoder into the map. The code converts the raw packet, applies the temperature correction, rejects implausible depths, and only then passes the value into the smoothing buffer.
// Convert the decoded sonar packet to centimeters.
float reportedDepthCm = raw / 10.0f;
// Correct that range using the measured water temperature.
float correctedDepthCm = correctSonarRangeCm(reportedDepthCm, tempC);
// Ignore values outside the operating depth window.
if (correctedDepthCm >= 2.0f && correctedDepthCm <= 800.0f) {
addDepthSample(correctedDepthCm);
lastValidDepthMillis = currentMillis;
validReading = true;
}By the time a depth sample reaches the moving average, it has already been interpreted and screened. The measurement pipeline is doing physics and quality control before the mapping logic ever sees the point.