Page 3 of 5

Re: Wave patterns

Posted: Fri May 31, 2013 10:05 am
by coolbird
Can they go to zero then?

Re: Wave patterns

Posted: Fri May 31, 2013 10:07 am
by rimai
Not with this function.
We can code it differently to get the same results in order to go down to zero.

Re: Wave patterns

Posted: Fri May 31, 2013 10:09 am
by coolbird
rimai wrote:Not with this function.
We can code it differently to get the same results in order to go down to zero.
Thanks. For what I have in mind that would be very useful 8-)

Re: Wave patterns

Posted: Fri May 31, 2013 10:14 am
by rimai
Use this instead then:

Code: Select all

  byte Jebao=(now()%(20*2)<20?0:30);
  ReefAngel.PWM.SetActinic(Jebao);
  ReefAngel.PWM.SetDaylight(Jebao==0?30:0);

Re: Wave patterns

Posted: Fri May 31, 2013 10:27 am
by coolbird
rimai wrote:Use this instead then:

Code: Select all

  byte Jebao=(now()%(20*2)<20?0:30);
  ReefAngel.PWM.SetActinic(Jebao);
  ReefAngel.PWM.SetDaylight(Jebao==0?30:0);
Sorry Roberto how does that code work the parameters, just so I can tweak it

Thanks
Dave

Re: Wave patterns

Posted: Fri May 31, 2013 10:36 am
by rimai
This is easier:

Code: Select all

  #define JebaoDuration   20
  #define JebaoMin        0
  #define JebaoMax        30
  byte Jebao=(now()%(JebaoDuration*2)<JebaoDuration?JebaoMin:JebaoMax);
  ReefAngel.PWM.SetActinic(Jebao);
  ReefAngel.PWM.SetDaylight(Jebao==JebaoMin?JebaoMax:JebaoMin);
Change what's in the define section

Re: Wave patterns

Posted: Fri May 31, 2013 10:40 am
by coolbird
rimai wrote:This is easier:

Code: Select all

  #define JebaoDuration   20
  #define JebaoMin        0
  #define JebaoMax        30
  byte Jebao=(now()%(JebaoDuration*2)<JebaoDuration?JebaoMin:JebaoMax);
  ReefAngel.PWM.SetActinic(Jebao);
  ReefAngel.PWM.SetDaylight(Jebao==JebaoMin?JebaoMax:JebaoMin);
Change what's in the define section
And what do I do about the lines I have already put in? Sorry its national daft question day in the UK :-)

Re: Wave patterns

Posted: Fri May 31, 2013 11:09 am
by rimai
Remove them and replace with the post above

Re: Wave patterns

Posted: Fri May 31, 2013 11:23 am
by coolbird
rimai wrote:Remove them and replace with the post above
OK will give it a try and let you know

Dave

Re: Wave patterns

Posted: Fri May 31, 2013 6:32 pm
by rimai
Thanks for contributing!!!
If I don't hear anyone else, I'll lower it to 25 on the next update.

Re: Wave patterns

Posted: Sat Jun 01, 2013 3:04 pm
by coolbird
coolbird wrote:
rimai wrote:This is easier:

Code: Select all

  #define JebaoDuration   20
  #define JebaoMin        0
  #define JebaoMax        30
  byte Jebao=(now()%(JebaoDuration*2)<JebaoDuration?JebaoMin:JebaoMax);
  ReefAngel.PWM.SetActinic(Jebao);
  ReefAngel.PWM.SetDaylight(Jebao==JebaoMin?JebaoMax:JebaoMin);
Change what's in the define section
And what do I do about the lines I have already put in? Sorry its national daft question day in the UK :-)
That worked brilliantly and taught me a bit too, do you thnk that dropping the speed to zero over long periods could cause wear on the pumps?

I remember having 2 sicce voyager pumps and over a period of time they would not start up and you ended up having to change the impellers.

Just a thought but this is working fine until I can work out a wave pattern that suits the tank better.

regards
Dave

Re: Wave patterns

Posted: Sat Jun 01, 2013 6:45 pm
by Seedlessone
Is there a way to have a pattern that I can put a group of speeds and to change every second? So for example: 87,76,100,91,65,46,92, etc. and also have it change speeds every second? If so how many numbers could I use?

Re: Wave patterns

Posted: Sat Jun 01, 2013 6:59 pm
by lnevo
Yes, this should do it...you'll have to put the sequence you want and change the array size and rollover number to match.

Code: Select all

static int speed=0;
byte speeds[4] = { 93, 81, 72, 63 };
if (millis()%1000=0) speed++;
if (speed>=4) speed=0;
ReefAngel.PWM.SetActinic(speeds[i]);

Re: Wave patterns

Posted: Sun Jun 02, 2013 12:13 pm
by coolbird
jerry27 wrote:
coolbird wrote: That worked brilliantly and taught me a bit too, do you thnk that dropping the speed to zero over long periods could cause wear on the pumps?

I remember having 2 sicce voyager pumps and over a period of time they would not start up and you ended up having to change the impellers.

Just a thought but this is working fine until I can work out a wave pattern that suits the tank better.

regards
Dave
since theyre DC pumps they start properly everytime and the wear shouldnt be an issue. if youre worried about it just drop it to around 20 or so. the water movement at that speed for mine is not even noticable but they keep turning.

if youre using the standard menu and you want to experiment with how low your pumps will go and find the minimum that they will turn back on, use this

Code: Select all

  ReefAngel.PWM.Override(OVERRIDE_DAYLIGHT, InternalMemory.LEDPWMDaylight_read());
  ReefAngel.PWM.Override(OVERRIDE_ACTINIC, InternalMemory.LEDPWMActinic_read());
comment out your wave patterns then go to lights>led pwm and the "ap:" will control one pump and the "dp:" will control another.

you can comment out an entire block of code by using /**/.

/*
code
code
code
*/

instead of line by line using //

if you give it a shot post your minimums so roberto can better adjust the libraries.
Will give it a go and post. Thanks

Re: Wave patterns

Posted: Sun Jun 02, 2013 12:13 pm
by coolbird
jerry27 wrote:
coolbird wrote: That worked brilliantly and taught me a bit too, do you thnk that dropping the speed to zero over long periods could cause wear on the pumps?

I remember having 2 sicce voyager pumps and over a period of time they would not start up and you ended up having to change the impellers.

Just a thought but this is working fine until I can work out a wave pattern that suits the tank better.

regards
Dave
since theyre DC pumps they start properly everytime and the wear shouldnt be an issue. if youre worried about it just drop it to around 20 or so. the water movement at that speed for mine is not even noticable but they keep turning.

if youre using the standard menu and you want to experiment with how low your pumps will go and find the minimum that they will turn back on, use this

Code: Select all

  ReefAngel.PWM.Override(OVERRIDE_DAYLIGHT, InternalMemory.LEDPWMDaylight_read());
  ReefAngel.PWM.Override(OVERRIDE_ACTINIC, InternalMemory.LEDPWMActinic_read());
comment out your wave patterns then go to lights>led pwm and the "ap:" will control one pump and the "dp:" will control another.

you can comment out an entire block of code by using /**/.

/*
code
code
code
*/

instead of line by line using //

if you give it a shot post your minimums so roberto can better adjust the libraries.
Will give it a go and post. Thanks

Re: Wave patterns

Posted: Thu Jun 06, 2013 4:47 pm
by lnevo
rimai wrote:Thanks for contributing!!!
If I don't hear anyone else, I'll lower it to 25 on the next update.
Roberto, can we make this number a define or mem location that can be overidden? I'm using these functions to feed the Custom mode on my mp40s and don't need to be constrained at all though I wouldnt mind setting it to 10 or something..

Other option is to set the default but overide the fuction so we can pass the constrain as an argument?

I can submit a pull request but not sure what the preference would be..

Re: Wave patterns

Posted: Thu Jun 06, 2013 4:52 pm
by lnevo
On second thought it would probably be best to override the function and make the current default to whatever number works good for Jaebo.

Re: Wave patterns

Posted: Thu Jun 06, 2013 4:56 pm
by rimai
Actually, I'm thinking I'm just going to remove the constrain.
It seems that you can only get a wave if you set the min speed to 0.

Re: Wave patterns

Posted: Thu Jun 06, 2013 5:29 pm
by lnevo
Works for me.

Re: Wave patterns

Posted: Sun Jun 30, 2013 7:09 am
by tomek77pl
Hi Is it possible to have a both wave patters for one pump? I want it to run nutrition export for 2 hrs a day then go back into the reef crest mode. Is this possible? If yes how can this be done? Thanks :)

Re: Wave patterns

Posted: Sun Jun 30, 2013 8:00 am
by ReeferBee
tomek77pl wrote:Hi Is it possible to have a both wave patters for one pump? I want it to run nutrition export for 2 hrs a day then go back into the reef crest mode. Is this possible? If yes how can this be done? Thanks :)

Yep you can. Which wave patterns are you trying to run, and at what times?

Here's an example. I have different modes run throughout the day.

Code: Select all

if (hour()>=8 && hour()<11)
{
  vtechmode=6;
  ReefAngel.PWM.SetDaylight( TidalSwellMode(40,true) ); // Tidal Swell at 40% on sync mode
  ReefAngel.PWM.SetActinic( TidalSwellMode(40,false) ); // Tidal Swell at 40% on anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
else if (hour()>=12 && hour()<13)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?80:0); // WaveMode on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // ElseMode at 70  on anti-sync mode
}
else if (hour()>=13 && hour()<14)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% + - 20 on anti-sync mode
}  
else if (hour()>=15 && hour()<18)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( ElseMode(70,30,true) ); // Else on sync mode
  ReefAngel.PWM.SetActinic( millis()%1000>800?80:0); // Wave on anti-sync mode
}
else if (hour()>=18 && hour()<21)
{
  vtechmode=5;
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); //   Nutrient Transport on anti-sync mode
}
else if (hour()>=21 && hour()<24)
{
  vtechmode=1;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?70:0); // Wave on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // Else on anti-sync mode
}
else
{
  vtechmode=4;
  ReefAngel.PWM.SetDaylight( LongPulseMode(40,40,10,true) ); // Long pulse at 40% with 10s pulse on syncy mode
  ReefAngel.PWM.SetActinic( LongPulseMode(40,40,10,false) ); // Long pulse at 40% with 10s pulse on on anti-sync mode
} 

 if (ReefAngel.DisplayedMenu==FEEDING_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }
  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }

Re: Wave patterns

Posted: Sun Jun 30, 2013 9:45 am
by tomek77pl
Lets say I want nutrition export to run from 4pm-6pm and reef crest to run the remaining 22 hrs. This is for the jeabo pump.

Re: Wave patterns

Posted: Sun Jun 30, 2013 3:11 pm
by ReeferBee
Try this, although Nutrient export needs to be ran 2.5 hours to complete the mode.

Code: Select all

if (hour()>=16 && hour()<18)
{
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); //  Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); // Nutrient Transport on anti-sync mode
}
else if (hour()>=18 && hour()<16)
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
You can change the values of the modes too, if its too much flow

Re: Wave patterns

Posted: Sun Jun 30, 2013 8:03 pm
by tomek77pl
Thank you!!! I just made it for 3 hrs instead of 2 so at least it finished one cycle of nutrition export.

Re: Wave patterns

Posted: Wed Jan 22, 2014 3:52 pm
by AnesthDoc
Barry,
A question for you.
I am just beginning to learn the arduino language and at the moment only using the Wizard for the basic settings.

If I want to use your wave pattern code (different waves throughout the day), I understand I will have to cut and paste the code in the wizard where it says "your custom code goes below this line" but do I need to remove any lines from the wizard code or make any other changes?

I recall a similar situation where a member suggested to remove a code line before using a custom wave pattern code.
Appreciate your help.

Re: Wave patterns

Posted: Sun Jan 26, 2014 3:45 pm
by AnesthDoc
Can someone else help me?

Re: Wave patterns

Posted: Sun Jan 26, 2014 6:19 pm
by rimai
Did you try to use the code he posted?

Re: Wave patterns

Posted: Sun Jan 26, 2014 7:08 pm
by ReEfnWrX
Anesthdoc,

His code states specific times during the day, and what wave pattern runs during those times. The first line is an if statement everything following that for different times is an else if statement.

Code: Select all

if (hour()>=16 && hour()<18)
{
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); //  Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); // Nutrient Transport on anti-sync mode
}
else if (hour()>=18 && hour()<16)
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
Add as many else if statements as you want. Make sure the times don't overlap. Also, he made a mistake in his code. For the last code in the day, let's say you want it to run between 11pm and 8 am you would use || (or) instead of && (and). the time cannot be greater than 11pm and less than 2am as the RA logic only views a 24 hour time period. So you would use

Code: Select all

else if (hour()>=18 || hour()<16)
Also, I find it easier to always use >= and always use just < by itself.

if you want to add in minutes you could do this

Code: Select all

if ((hour()>=18 && minute()>=30) || (hour()<16 && minute()==0)) // >=6:30pm ||(OR) <4:00pm

Wave patterns

Posted: Mon Jan 27, 2014 5:53 am
by lnevo
That last example with minute() will not work. It will only cover 18:30-18:59 then 19:30-19:59 and so on. Or you'll need another || hour()>=19

Re: Wave patterns

Posted: Mon Jan 27, 2014 8:12 am
by ReEfnWrX
Good catch, I wrote that real quick off the top of my head. I just looked at my old code and I did have the additional || hour()