Solenoid output won't happen!

The following arrangement seems like it should operate the solenoid, the alarm message works for the duration it should (1 minute but nothing happens with the solenoid. I have tested all the connections and everything is sound. Can anyone help?

// alarm set
if (alarmHours == lastHour && alarmMinutes == lastMinute)
//sound alarm

lcd.print("Sprinkler active");
digitalWrite(relay, LOW);


Post your code.

... and a diagram of your wiring.


Have you tested the hardware separately - ie connecting a switch instead of the
Arduino pin to the solenoid driver circuit? What driver circuit are you using?

Firstly, thanks for the speedy response guys. And I should apologise about my lack of understanding of arduino, I am at least humbled by it! OK back to basics, I cant even get my solenoid to operate at all! I have researched how to connect it all up and there are some signs of life but can’t get it to sustain operation even for a few seconds and with a basic instruction like this;

int relay = 9;

void setup()
pinMode(relay, OUTPUT);

void loop()
digitalWrite(relay, LOW); // sets the LED on


Please find attached how i have the solenoid set up to a relay module, it all works when i connect manually to 5v supply.

The nice photo might convey something to you but I can't make any sense of it. How about just making a drawing of the wiring connections and posting a photo of the drawing.

In your sketch you make the relay pin go LOW. But it was never HIGH in the first place !!!!!!!

And if you just want to set a pin high or low for testing you can put the digitalWrite() into setup() - though that won't make any functional difference.


Hello again, to summarise I didnt check the pin layout on the LCD shield, and I assumed it was parallel to the main board whoops! I now have connected the 'IN1' from the relay to pin 11 on the shield. I then used an 'else' to follow on from the alarm 'if' to operate the solenoid/relay only for the duration of the 'alarm' (1 minute) thanks for your help guys, I even got the basis for my script from this website. I continue to be impressed by arduino!...