5-12V DC pump doesn't start through relay

Hi,
Try this code, the relay and the LED on the UNO should operate 1second OFF, 1second ON.

int RelayPin = 10;
int LEDPin = 13;
int delayinterval = 1000; //delay 1second
void setup()
{
  pinMode(RelayPin, OUTPUT);
  pinMode(LEDPin, OUTPUT);
}

void loop()
{
  digitalWrite(RelayPin, LOW);
  digitalWrite(LEDPin, LOW);
  delay(delayinterval);
  digitalWrite(RelayPin, HIGH);
  digitalWrite(LEDPin, HIGH);
  delay(delayinterval);
}

Can you please post your code?

Tom.... :grinning: :+1: :australia:

Check relay contacts.

  1. Instead motor put small load = LED with resistor, then bigger load = light bulb from car.
  2. LED and motor

You'r code worked fine. Here is mine

int P = 10;
int r_pump = 10;

void setup() {
  Serial.begin(9600);
  pinMode(r_pump, OUTPUT);

}
void loop() {
     int gh = analogRead(A1);
  gh = map(gh, 850, 230 , 0, 100);
  if (gh > P) {
    digitalWrite(r_pump, 255);
  }
  else {
    digitalWrite(r_pump, 0);
  }
  Serial.print( gh);
  delay(200);
}

Hi,
Thanks, so the relay operates and the pump runs?

int P = 10;
int r_pump = 10;

void setup() {
  Serial.begin(9600);
  pinMode(r_pump, OUTPUT);

}
void loop() {
     int gh = analogRead(A1);
  gh = map(gh, 850, 230 , 0, 100);
  if (gh > P) {
    digitalWrite(r_pump, HIGH);
  }
  else {
    digitalWrite(r_pump, LOW);
  }
  Serial.print( gh);
  delay(200);
}

Try that, digital output is 1 or 0, HIGH or LOW.

Tom.... :grinning: :+1: :coffee: :australia:

Yeah, tried Low, High,1,0, nothing changed

You mean LED is not going ON/OFF ?

wrong reply

Is there any change that pump is being overloaded, and that's why it doesn't run?

I suspect that you have a bad connection somewhere. Running power through a breadboard isn't doing you any favours either.

HI,
Just t o clarify, my code worked?

What have you got connected to the analog input?
What does the serial monitor show?

Tom... :grinning: :+1: :coffee: :australia:

Check your relay without arduino, post 36. Vcc = 5V, ground, SIG wire jumper,
connect it;
A. to ground
B to Vcc
you should hear click.

Put ohmmeter to COM and NC

Hi,
Try this code and see if the relay operates and view the serial monitor;

int P = 10;
int r_pump = 10;

void setup() {
  Serial.begin(9600);
  Serial.println("=====PUMP RELAY TEST CODE=====");
  Serial.println("        2/05/2021");
  delay(1000);
  pinMode(r_pump, OUTPUT);

}
void loop() {
  //    int gh = analogRead(A1);
  //  gh = map(gh, 850, 230 , 0, 100);
  for (int gh = 0; gh < 20; gh++)
  {
    if (gh > P) {
      digitalWrite(r_pump, HIGH);
      Serial.print("OUTPUT HIGH...  Value of gh = ");
      Serial.println( gh);
    }
    else {
      digitalWrite(r_pump, LOW);
      Serial.print("OUTPUT LOW...  Value of gh = ");
      Serial.println( gh);
    }
    delay(200);
  }
}

Tom... :grinning: :+1: :coffee: :australia:

Bad brushes can cause that motor sometime is stock, use just motor instead of pump

its humidity sensor

I have used regular dc motor, worked fine

You have some debris inside pump, open it and clean up it.

Hi,

What spec/data?
Does my edited code work?

Tom... :grinning: :+1: :coffee: :australia:

sometime the small wire connector is weaked. change all your wire.

5 pumps $5
Sealed and waterproof.

Youu cannot repace wire or open the unit.

Lets hope the problem is not at the pump.

Pump needs lubrication, without water it can seize like a car engine without oil.
Put some oil into pomp, connect to battery, switch power on/of 10- 20 - forward/reverse -times and see if this helps