Regolith Water LoopWater pre-treatment

Turbidity from photographs

A phone camera is available and free; a nephelometer is not. Suspended solids wash out a printed target seen through the sample, and that loss of contrast is the measurement.

Principle

A vessel of water sits in front of a printed high-contrast target. As turbidity rises, the target seen through the sample loses contrast. Contrast falls roughly exponentially with concentration, so the calibration is fitted linearly in log-contrast.

A white card in the same frame cancels exposure and white balance differences between shots. Without it a cloudier photograph and a darker room look identical to the code.

Relative, not NTU

Every result is a percentage of the influent. Calibrating to a real turbidity standard needs formazin, which this project does not have, so the output is never reported in NTU. For a pre-treatment stage the percentage removed is the number that matters anyway.

Workflow

Three commands, from rwl, published on PyPI. The first reads contrast off each photograph, the second fits the dilution series, the third compares the influent to each charge and flags any result outside the calibrated range.

pipx install rwl

Or skip the install: the same measurement runs in the browser, from photographs or a live camera, on Measure in the browser.

rwl measure photos/cal*.jpg --setup setup.json --out readings.csv
rwl calibrate --readings readings.csv --levels levels.csv --out calibration.json
rwl measure photos/influent.jpg photos/charge*.jpg --setup setup.json --out run.csv
rwl report --readings run.csv --calibration calibration.json \
    --before influent --after charge1 charge2 charge3

setup.json holds the two regions of interest, read once off any frame in the session and reused for all of it:

{
  "target": [820, 540, 300, 300],
  "white":  [180, 160, 120, 120]
}

Both are [x, y, width, height] in pixels. Check them with rwl roi photos/cal0.jpg --setup setup.json, which draws both boxes on the photograph and warns if the white card is clipped or the target box has no contrast. The calibration prints an R²; below 0.9 the light drifted during the series and the photographs have to be retaken.

Limitations

  • Relative to the stock, not traceable to a turbidity standard.
  • Only suspended load is measured. Dissolved contaminants that do not scatter light are invisible to this method.
  • Saturated highlights break the contrast estimate. Underexpose slightly rather than clipping the white card.
  • Valid only within the calibrated range. An effluent clearer than the lowest calibration point should be reported as such, not extrapolated.