I am new to hardware of electronics. I have an Ardunio 2 module relay switch and a Arduino Uno USB Microcontroller Rev 3. I will have about a clear PVC pipes attached with automatic shut off valve and a contamination sensor. For the contamination sensor I will use a LDR with a LED light that will shine on it. When it senses contamination, I want the relay switch to cut off the valve and stop water flow. Im still in the beginning stages of the project I just need to get the basics down.
The relay module should have 4 pins, VCC (+), relay1, relay2, and GND (-). Connect VCC and GND directly to the 5V and ground pins on the Uno. Connect the relay1 and relay2 pins to Uno digital pins of your choosing. When writing your code, configure those ports as OUTPUTs. Do a digitalwrite HIGH to them when you want to switch the relays on.
From there you run in a loop sampling the analog pin and writing your digital pins LOW when the value reaches some threshhold (you'll need to do some testing to see what that threshhold is).
Please note that if your relays are switching mains / line voltage (110VAC-240VAC) you should take appropriate safety precautions due to the danger of death or fire.