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

ChrisTenone:
True, however polluted water is populated by fluorescing bacteria. They make fiber optic probes to test water for bacteria content that way. Here's an article.

I spent 5 years running a company that made apps for flow cytometers to measure bacterial loads in water. (My avatar is a space filling model of a rabbit antibody to E. coli) I've got a TON of experience in these various methods of trying to get a number. There must be 10,000 half ass ways to get an answer on how many germs are in a water sample and with almost all of them you'll still end up drinking coliforms. This is just another of them. Under rigorous testing against good standard methods they all fall down. Even the flow cytometer methods. Hence the reason we shut that down and started testing by rtPCR.

The only true test is to either grow them out or do PCR.