Problem with relay and pump.


I have a project in which i use want to close a relay with a float switch.

The system looks like this:
I have a brick relay that will be closed by the float, and a buzzer will turn on.
I also have a reset switch, that will close the buzzer and start the relay.

On the float switch i have a pull down resistor of 100kOhm.

The pump has a pressure sensor and it closes when it fills a recipient with water. I am using my system to close the whole power if something damages and water will fill my room.

My problem is that when the pressure sensor closes the pump, my buzzer starts and the relay will close, as if it was closed by the float device.

I am e newbie at electronics, but i cannot see how to solve this problem.


A pull down of 100K is rather too high make it 10K.
Otherwise post your code and schematic for more help.

Sorry for the messy schematic, but it is the first time i use Frizz.

The whole system is powered through an adapter from 220V that will give me 5V.

The relay interrupts the live wire from the pump.

The software it’s simple:

const int buttonPin1 = 2;// float
const int buttonPin2 = 3; // button reset
const int ledPin = 7;// Relay
const int pinPower = 9; //Power led

int buttonState1 = 0;
int buttonState2 = 0;

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode (pinPower, OUTPUT);
digitalWrite (pinPower, HIGH);

void loop(){
// read the state of the pushbutton value:

buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState1 == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
//tone(8, 1200, 1000);
// delay (1000);


if (buttonState2 == HIGH) {
digitalWrite(ledPin, LOW);

And as a relay i used this brick relay:

Wow that is a mess! It is very hard to follow.

Do you have a resistor in line with the LED?

As I said before 100K is way too high for R2, change it to 10K. It looks like this input is floating and is being influenced by the pin next to it.


I have a resistor on the LED.

I tried to put a smaller resistor, but it acts like the the float is always on.

Do you think a condenser could help me not to receive noise on the float PIN?

If yes what kind of condenser. I am pretty new in electronics.


I tried to put a smaller resistor, but it acts like the the float is always on.

Then you have not got it wired up like you think you have. If it is wired up like on the schematic then this will not happen.
The long tracks on the solderless bread board has a break in the middle, and check that the ground goes back all the way to the arduino.


I made it work! Not a very nice resolve, but i put a delay on the float, so it wont start if it is not on for 1 second.

Thanx for the help.

I made it work!

But you have not fixed your problem, do you think that is OK or do you think that one day it will byte you in the bum?

For now it works. I will to solve it with a condenser when i have more time.

I will to solve it with a condenser when i have more time.

I don't think that is the problem. :wink: