I'm trying to make a water pump work with arduino but I have a problem, it doesn't work and I don't know why. I'm a beginner with arduino so there are a lot of thing that I don't know.
I'm using a relay and a external energy suply, a battery, because I know that the arduino cannot do it by itself.
The conections in the relay are:
INPUTS
- DC+: positive power supply (VCC)
- DC-: negative power supply (GND)
- IN: Digital 9
OUTPUTS
- COM: Battery +
- NC: Water pump
And finnaly I have the water pump connected to the Battery – and to the relay (NC).
The code I'm using is this:
const int control = 9 ;
void setup()
{
pinMode(control, OUTPUT) ;
}
void loop()
{
digitalWrite(control, HIGH);
delay(2000);
digitalWrite(control, LOW);
delay(1000);
}
Can anybody help me please? I'm in a hurry and I don't know what else to do.
Thanks beforehand.
Best Answer
The relay you have is rated at 12VDC. You need 12V to power the relay you are using when your Arduino can only output 5V max. You probably bought the wrong relay, because the one you linked on eBay which is the right one is different to the one you have.
I can tell because in the photo, your relay is marked as SRD-12VDC-SL-C:
And in the datasheet below... https://www.ghielectronics.com/downloads/man/20084141716341001RelayX1.pdf That 12VDC refers to the voltage needed on the coil to activate the relay. So buy a new relay that has a coil rated at 5V or refund and replace the relay with the SRD-5VDC-SL-C if they gave you the wrong product.