12 Hr Timer on 2 LED strips & Small Pump (with lower power) all on 12V -

Good Morning,

Have a prototype that I have been piecemealing with timed LED strips on 12 hour timers and a small water pump. A friend suggested an Arduino for initial run of manufacturing. The 2 LED light strips and a small water pump all work on a 12V. I have attached an image of the parts I am using.

Basically what I would like to program:

  • All three things to be powered and put on a 12 hour on/12 hour off timer. I found code and put it at the end of this post.
  • I would also like the power to be lowered for the pump. Right now I have a valve on the tubing of the small pump to reduce water flow (still is surprising too powerful for the application.) I would like to get rid of the valve and just reduce power.

I am trying to get this simple code, but I am new. If anyone can help, I would be tremendously thankful! Also let me know if this code below will work with an Arduino Uno for 12hour on/12 hour off:

#define TWELVE_HRS 43200000UL
unsigned long startTime;

setup()
{
 startTime = millis();
}

loop()
{
 if (millis() - startTime > TWELVE_HRS)
 {
   // Put your code that runs every 12 hours here

   startTime = millis();
 }
}

Just an opinion but for long period timers, I find its easier to break down the period into smaller unit counts, such as seconds, minutes and hours.

I'd add a battery-backed real time clock chip, so if you should lose power for whatever reason, when power is restored you can simply check the time and keep going like nothing happened. https://www.digikey.com/product-detail/en/adafruit-industries-llc/3295/1528-1787-ND/6238007

Then your code can be, using 7AM to 7PM as an example:

void loop()
{
Get time from RTC.
if ( (time >= 7AM) && (time <= 7PM) ) {
   turn on pump, LEDs
   }
else {
   turn off pump, LEDs
   }
}

If the pump is brushed DC, you can slow it down with PWM, if brushless, speed may be fixed but you could tee in another valve and bleed the excess pressure back to reservoir. Post a link to the pump.