12v Solenoid valves with arduino

Thank you man, it's more easy with this only line and fix my mess :slight_smile:

Except, it overflows because your math is wrong.

90 minutes is

90 * 60 * 60 *1000 = 324000000 milliseconds

I just need 24 hours, now you are saying i put it on a calculator and it says 24 h = 86400000 ms
thanks again man!

also found this and fix it:
delay(5000); // add delay 5 secs

You don't need a calculator. The language has a calculator:

const unsigned long HOUR_PER_DAY = 24;
const unsigned long MIN_PER_HOUR = 60;
const unsigned long SEC_PER_MIN = 60;
const unsigned long MS_PER_SEC = 1000;

const unsigned long MS_PER_DAY = HOUR_PER_DAY * MIN_PER_HOUR * SEC_PER_MIN * MS_PER_SEC;
...
{
...
  delay(MS_PER_DAY);

oh this is so nice, I had it in my mind to put some clock into it, but you could also use it for delay too!

It's all good, until you decide that you need something else done during that 24 hour thumb twiddling time.

I know what you mean, I must try to write a new code only to test the solenoids before try it on my main.
The pictures are not so clear, you will see the PSU adapter it's like a breakout pinout

The solenoids are from here:
https://www.aliexpress.com/item/1005003797207726.html

The soil moisture sensor is :
https://www.aliexpress.com/item/4001058962949.html

no no I will stay with the default value. In near future I will see for the clock, step by step

It still wired wrong

Please assure me, that this is not connected to the AC mains power
image

yeah I know it's old photo, I am not near, I won't forget it jim-p

of course It's not connected to the AC mains power and the cloth is temporary !
It's connected to the soil moisture sensor man, I know wrong cable but this is I have to use it on outside area. Have you got any better idea what cable to use outside for the soil moisture sensor?

What is it connected to? the 3 conductor white sheathed wire, I mean?

of course It's not

...hang around here a while and witness what people do...

Thank you man it worked!

You're welcome