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

Delta_G:
...

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

"True test" - dna, of course. But I don't think that's what the OP was looking for. They stated "I want to make a device that can detect a viruses or bacteria". I believe the fluorescence detector (with enzymatic preparation) does exactly that.

I don't know of a way to detect viruses, but my student, Mo Elzein, got his degree by developing this e.coli sensor. I don't claim expertise, but I did work with him to support his research. It's since been commercialized, and is currently being used to monitor waster sources. I'm convinced it works.

Here's another article based on Mo's dissertation.