Is there any thing can i used to detect an bacteria or viruses for iot project?

Sample into a microscope cell, robotic microscope using CV methods assays the types of cells. Doesn't work
for viruses though, probably hopeless at low concentrations without some sort of microfluidic filtering
system to preprocess significant volumes.

I think the consensus is there is no cheap way to do anything like a good job. Pay people to take
samples regularly and post them to a lab.

If you want to measure how hazy the water is, that's another matter!