Hi, I recently started my adventure with arduino and for one of my first projects I decided to make a plany watering system. However, I encountered a problem while creating it. The issue is that when I have the whole system connected and I fire off the code that changes the states of the pin in a loop along with a delay, the relay sort of bypasses the delay because it shuts off momentarily when turned on. When the relay has no load, it works flawlessly and turns on/off every two seconds. There is also no problem with operation when the only part of the code is to set the pin to a low state to turn the relay on, then it also works without a problem. As for the relay, it is the SRD-5VDC-SL-C (it a module from here: Buy Relay 5V 10A/250VAC Botland - Robotic Shop). I have included the schematic diagram in the attachment (an arduino is powered from a computer by the usb). What could be the reason for this behavior?
#define pompa 5
void setup() {
pinMode(pompa, OUTPUT);
digitalWrite(pompa, HIGH);
}
void loop() {
digitalWrite(pompa, HIGH);
delay(2000);
digitalWrite(pompa, LOW);
delay(2000);
}