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....
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....
79galinakorczak:
ED with resisto
Yeah, tried Low, High,1,0, nothing changed
You mean LED is not going ON/OFF ?
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...
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
Bad brushes can cause that motor sometime is stock, use just motor instead of pump
I have used regular dc motor, worked fine
You have some debris inside pump, open it and clean up it.
Hi,
anon78491692:
its humidity sensor
What spec/data?
Does my edited code work?
Tom...
LFRED
May 1, 2021, 5:39pm
58
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