wavemaker pump with hour and minutes

18 views
Skip to first unread message

Mantu

unread,
Jan 5, 2011, 10:00:21 AM1/5/11
to Reef Angel Controller
hello,
i'm thinking if is possible to modify wavemaker setup (using curt
libraries)
now, with my PLC i use 2 pumps alterated every 6 hours (with half an
hour that they are on both) 00:00 - 06:00 - 12:00 - 18:00 - 24:00

with wavemaker function i loose the possibility to have every time
both pump on for 30 minutes... and the timer starts when i power on my
RA...
is there a way to plan to start the timer at specified hour and
minutes (like lights timer for exmple... ) ??

many tnx in advice and sorry for my bad explanation :)

Roberto Imai

unread,
Jan 5, 2011, 11:09:22 AM1/5/11
to reef...@googlegroups.com
Hi Mantu,

The wavemaker function uses timer 1 and timer 2 for their intervals.
Simply place this in the setup():
ReefAngel.Timer[1].Interval=21600; //21600s = 6hr
ReefAngel.Timer[2].Interval=21600; //21600s = 6hr
Then, in the loop():
if (ScheduleTime(6,0,0)) ReefAngel.Timer[1].Start(); // starts timer 1 at 6:00:00
if (ScheduleTime(11,30,0)) ReefAngel.Timer[2].Start(); // starts timer 2 at 11:30:00
Let me know if this doesn't work for you.

Roberto.

Mantu

unread,
Jan 5, 2011, 4:16:26 PM1/5/11
to Reef Angel Controller
mmm... i'm thinking that i cannot use those 2 timers since (i suppose)
they are used also for dosometrics pumps that i'm using...

Mantu

unread,
Jan 7, 2011, 6:03:58 AM1/7/11
to Reef Angel Controller
uhm... for dosometric pumps i can use relay4 (free) since they never
occours together....
your code seems good... but if i power on the unit for example at
07:00 no pumps will run until 11:30... right?

On 5 Gen, 17:09, Roberto Imai <robe...@imlogo.com> wrote:

Roberto Imai

unread,
Jan 7, 2011, 11:11:51 AM1/7/11
to reef...@googlegroups.com
Yes, no pumps would turn on until the next cycle.
If you need any other alternative, we can probably come up with a different solution for you.

Roberto.

Mantu

unread,
Jan 7, 2011, 4:52:30 PM1/7/11
to Reef Angel Controller
i think that the right way is looking for a solution like the
standardlight function... buth with 2 start time and end time...
i'll work on it...
any suggestion or idea is appreciated :)

bye...

Roberto Imai

unread,
Jan 7, 2011, 6:15:55 PM1/7/11
to reef...@googlegroups.com
Just because it says standardlight doesn't mean it should only be used for lights.
You could use it like this:

ReefAngel.StandarLights(Relay4,6,0,12,0);
if (bitRead(ReefAngel.Relay.RelayData,Relay4)==0) ReefAngel.StandarLights(Relay4,18,0,0,0);

Try it and let me know if it works.

Roberto.

Mantu

unread,
Jan 9, 2011, 5:12:17 PM1/9/11
to Reef Angel Controller
gret idea! i was looking for rewriting all the function... supid
idea! :D
tomorrow i'll try... i'm pretty sure it will work!
i'll give a feedback!
many tnx!!

LukeLuke

unread,
Apr 6, 2011, 9:09:36 AM4/6/11
to reef...@googlegroups.com
Hi,
i try to add this line to my .pde for on && off the pumps each 6 hours:

void setup()
{  
   ReefAngel.Timer[1].SetInterval(21600); //21600s = 6hr
   ReefAngel.Timer[2].SetInterval(21600); //21600s = 6hr
}

void loop()
{
      //accensione pompe di movimento
     if (ScheduleTime(6,0,0))   ReefAngel.Timer[1].Start(); // avvia timer1 alle 06:00:00
     if (ScheduleTime(12,00,0)) ReefAngel.Timer[2].Start(); // avvia timer2 alle 12:00:00
     if (ScheduleTime(18,00,0)) ReefAngel.Timer[1].Start(); // avvia timer1 alle 18:00:00
     if (ScheduleTime(0,00,0))  ReefAngel.Timer[2].Start(); // avvia timer2 alle 24:00:00

     if (ReefAngel.Timer[1].IsTriggered()) ReefAngel.Relay.On(Port4); //Accendi pompa 1
     else ReefAngel.Relay.Off(Port4);

     if (ReefAngel.Timer[2].IsTriggered()) ReefAngel.Relay.On(Port5); //Accendi pompa 2
     else ReefAngel.Relay.Off(Port5);
}

but don't work... the relay don't start.

What can i do ?

Bye
Luca


2011/1/9 Mantu <mant...@gmail.com>

Roberto Imai

unread,
Apr 6, 2011, 9:42:53 AM4/6/11
to reef...@googlegroups.com
Hey Luca,
 
The code you sent does not work because the IsTriggered event happens only once.
When the timer runs out, it turns pump on.
A fraction of a second later, the code will look for the IsTriggered event and it will find it is not Triggered anymore turning the pump off.
This happens so fast that there's not even time to hear the relay clicking.
I suggest you use Curt's new libraries to implement the dosing.
 
Roberto.

LukeLuke

unread,
Apr 6, 2011, 10:47:28 AM4/6/11
to reef...@googlegroups.com
Do you think of this :

void AlternaPompe(byte Pump, byte PTimer, byte OnHour, byte OnMinute, byte RunTime)
{

// Let's see if it's supposed to start running the timer now
if ( (NumMins(hour(), minute()) == NumMins(OnHour, OnMinute)) && (second() == 0) )
{
Relay.On(Pump);
Timer[PTimer].SetInterval(RunTime);
Timer[PTimer].Start();
}

// is the timer expired?
if ( Timer[PTimer].IsTriggered() )
{
// timer expired, so let's shut off the pump
Relay.Off(Pump);
}
}


Loop()
{
AlternaPompe(Port3, 1, 6,0,21600);
AlternaPompe(Port4, 6, 12,0,21600);
AlternaPompe(Port3, 1, 18,0,21600);
AlternaPompe(Port4, 6, 0,0,21600);
}


Bye
Luca


2011/4/6 Roberto Imai <rob...@imlogo.com>

LukeLuke

unread,
Apr 6, 2011, 10:48:18 AM4/6/11
to reef...@googlegroups.com
Ops digit errors:


void AlternaPompe(byte Pump, byte PTimer, byte OnHour, byte OnMinute, byte RunTime)
{

// Let's see if it's supposed to start running the timer now
if ( (NumMins(hour(), minute()) == NumMins(OnHour, OnMinute)) && (second() == 0) )
{
Relay.On(Pump);
Timer[PTimer].SetInterval(RunTime);
Timer[PTimer].Start();
}

// is the timer expired?
if ( Timer[PTimer].IsTriggered() )
{
// timer expired, so let's shut off the pump
Relay.Off(Pump);
}
}


Loop()
{
AlternaPompe(Port3, 1, 6,0,21600);
AlternaPompe(Port4, 2, 12,0,21600);
AlternaPompe(Port3, 1, 18,0,21600);
AlternaPompe(Port4, 2, 0,0,21600);
}

Bye
Luca


2011/4/6 LukeLuke <lukelu...@gmail.com>

LukeLuke

unread,
Apr 7, 2011, 3:33:16 AM4/7/11
to reef...@googlegroups.com
I try this but don't work!

Can we help me ?

TNKS ;-)

Curt Binder

unread,
Apr 7, 2011, 8:26:47 AM4/7/11
to reef...@googlegroups.com
One problem I see with the code is with the declaration line. If you
are trying to use 21600 as a RunTime, you cannot have "byte RunTime".
It has to be "int RunTime" due to the limitations of byte. Byte can
only have a max value of 255 (if you exceed that value it turns it
negative and you don't know what the value really is). Int can have a
max value of 32767. So your line should be this:

void AlternaPompe(byte Pump, byte PTimer, byte OnHour, byte OnMinute,

int RunTime)
{
...
}

And then your function calls:

AlternaPompe(Port3, 1, 18,0 ,21600);

should work.

curt

--
/*
Curt Binder
http://curtbinder.info/
*/

LukeLuke

unread,
Apr 7, 2011, 10:03:32 AM4/7/11
to reef...@googlegroups.com
you are the best... ;-)

Thanks a lot.

Bye
Luca


2011/4/7 Curt Binder <curt....@gmail.com>

LukeLuke

unread,
Apr 7, 2011, 10:20:22 AM4/7/11
to reef...@googlegroups.com
Nothing... don't work.

I think that the problem is the global declaration of Timer[1] and Timer[2] that is in byte...

What do you think, if i make so ?

ReefAngel_TimerClass MyTimer;


void AlternaPompe(byte Pump, byte PTimer, byte OnHour, byte OnMinute, int RunTime)
{

// Let's see if it's supposed to start running the timer now
if ( (NumMins(hour(), minute()) == NumMins(OnHour, OnMinute)) && (second() == 0) )
{
Relay.On(Pump);
MyTimer[PTimer].SetInterval(RunTime);
MyTimer[PTimer].Start();

}

// is the timer expired?
if ( MyTimer[PTimer].IsTriggered() )

{
// timer expired, so let's shut off the pump
Relay.Off(Pump);
}
}


Loop()
{
AlternaPompe(Port3, 1, 6,0,21600);
AlternaPompe(Port4, 2, 12,0,21600);
AlternaPompe(Port3, 1, 18,0,21600);
AlternaPompe(Port4, 2, 0,0,21600);
}

Bye
Luca


2011/4/7 LukeLuke <lukelu...@gmail.com>

Roberto Imai

unread,
Apr 7, 2011, 12:07:40 PM4/7/11
to reef...@googlegroups.com
Why don't you try this instead?
 
Reply all
Reply to author
Forward
0 new messages