Automated water test bench prototype with image classification
An inexpensive bench-top prototype that automates water sampling, chemistry readings and sample preparation for imaging, sorts the prepared sample with an image classifier and merges both results into one overall risk rating in plain words.
Problem
A combined check of water chemistry and microbial content usually needs laboratory equipment and trained staff, so places without a lab cannot get a quick answer on whether water is likely to be safe.
Goal
An inexpensive bench-top prototype that automates sampling, water chemistry and sample preparation for imaging, sorts the prepared sample through a microscope camera and an image classifier, and merges chemistry and biology into one overall risk rating in plain words.
My role
I built the software with and for a small team: the microcontroller firmware, the laptop controller, the image classification and training pipeline, the risk rating logic, the optional modules and the documentation. The overall design is shared work with the team.
Solution
A microcontroller runs the liquid handling and sensors and talks to a laptop over a simple line-based serial protocol. The laptop captures microscope frames, classifies what it sees and combines the result with the chemistry through a fixed decision table, showing the rating on a small display and on screen.
How it works
The microcontroller moves the sample past the chemistry probes and then prepares part of it for imaging, running a timed sequence of reagent and rinse steps. It tells the laptop when a sample is ready, so only finished samples are classified.
The laptop reads frames from a microscope camera and passes each to a transfer-learned image classifier; below a confidence threshold the result is flagged as unsure. With no model available, a deterministic fallback classifies by colour thresholds and contour shape measures.
The chemistry is graded into a few bands, and a fixed table of rules crossing that grade with the image class gives one risk rating. With nothing found in the image, the rating falls back to chemistry alone, and an unrecognised class defaults to the cautious level.
Optional extras sit behind feature flags, such as result logging and reports.
Technical challenges
Reliable microcontroller and laptop coordination over plain serial, with explicit handshakes.
Sequencing the hardware steps so each measurement gets a usable sample.
A working system even before a model has been trained.
Safe defaults when the classifier is unsure.
Designing the classifier stage so a different kind of model can take its place later, with a feature extraction module already written for that.
Testing hardware-dependent code with simple hardware checks, and writing documentation that non-expert operators can follow.
Capabilities
- Automated sampling and flow control
- Water chemistry measurement
- Timed, automated sample preparation for imaging
- Microscope capture
- Neural classification with a confidence gate
- Deterministic colour and shape fallback
- Rule-based risk rating from chemistry and image results
- Device display and on-screen results
- Optional extras behind feature flags
Technology
Impact
A complete, documented prototype software stack built with a small team, with a full setup and troubleshooting guide. Without a trained model it remains a prototype, not a validated instrument.
Skills demonstrated
- Embedded programming
- Hardware and software integration
- Serial protocol design
- Computer vision
- Transfer learning
- Rule-based decision fusion
- Fail-safe design
- Python modules with feature flags
- Documentation for non-experts
- Working in a small team