need urgent help :(

I'm working on a project that is due soon, and I've ran into a very puzzling problem. I'm using this ultrasonic sensor to measure water level in a tank.

I'm trying to control the flow of water using solenoid valves and those bilge pumps. As of right now, I'm only trying to test the sensors and pumps and get them to work together, but when I have the pumps connected to the relays, when the sensor reads a certain value needed to turn on the pump the sensor starts reading completely wrong values right at the moment when the pump is turned on.

I'm using those relays with the - terminal of the pump connected to Normally Open, and the - from the voltage supply to load.

heres a very rough looking schematic that i drew up real quick on paint, and this the the code I'm using: http://www.pastebin.ca/3012458

The schematic image doesn't show up. Are you using serial, analog or PWM to get the sensed distance?

I'm using PWM

i reuploaded the schematic: http://i.imgur.com/LG7tGGU.jpg

That relay draws 185mA and may be causing a problem.
Try an external 5V supply for the relay board, connect its GND to the Arduino GND.
Set pinMode for pin 2 in setup(), maybe try pinMode(2,INPUT_PULLUP);

May have to place snubbing across the pump.

Show us a photo of your wiring.

LarryD:
That relay draws 185mA and may be causing a problem.
Try an external 5V supply for the relay board, connect its GND to the Arduino GND.
Set pinMode for pin 2 in setup(), maybe try pinMode(2,INPUT_PULLUP);

do you mean i should connect the GND from the supply and the arduino together for the relay?

LarryD:
May have to place snubbing across the pump.

Show us a photo of your wiring.

heres how the pump is wired to the relay and power supply.

Imgur