Wave patterns

Related to the development libraries, released by Curt Binder
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post by coolbird »

Can they go to zero then?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post by rimai »

Not with this function.
We can code it differently to get the same results in order to go down to zero.
Roberto.
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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-)
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post 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);
Roberto.
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post 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
Roberto.
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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 :-)
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post by rimai »

Remove them and replace with the post above
Roberto.
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post by coolbird »

rimai wrote:Remove them and replace with the post above
OK will give it a try and let you know

Dave
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post by rimai »

Thanks for contributing!!!
If I don't hear anyone else, I'll lower it to 25 on the next update.
Roberto.
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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
Image
Seedlessone
Posts: 135
Joined: Tue Jan 24, 2012 6:20 pm

Re: Wave patterns

Post 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?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post 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]);
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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
Image
coolbird
Posts: 90
Joined: Thu Apr 18, 2013 2:16 am
Location: Stockport, Cheshire, UK

Re: Wave patterns

Post 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
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post 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..
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post 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.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post 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.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

Works for me.
tomek77pl
Posts: 21
Joined: Sun Jun 09, 2013 3:17 pm

Re: Wave patterns

Post 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 :)
ReeferBee
Posts: 55
Joined: Wed May 08, 2013 6:23 pm
Location: North GA

Re: Wave patterns

Post 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);
  }
Barry

Current tank info: 150g mixed reef

"Some of the worst mistakes of my life were hair cuts" -Jim Morrison
tomek77pl
Posts: 21
Joined: Sun Jun 09, 2013 3:17 pm

Re: Wave patterns

Post 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.
ReeferBee
Posts: 55
Joined: Wed May 08, 2013 6:23 pm
Location: North GA

Re: Wave patterns

Post 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
Last edited by ReeferBee on Sun Jun 30, 2013 8:20 pm, edited 1 time in total.
Barry

Current tank info: 150g mixed reef

"Some of the worst mistakes of my life were hair cuts" -Jim Morrison
tomek77pl
Posts: 21
Joined: Sun Jun 09, 2013 3:17 pm

Re: Wave patterns

Post by tomek77pl »

Thank you!!! I just made it for 3 hrs instead of 2 so at least it finished one cycle of nutrition export.
AnesthDoc
Posts: 17
Joined: Mon Dec 09, 2013 8:08 am

Re: Wave patterns

Post 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.
AnesthDoc
Posts: 17
Joined: Mon Dec 09, 2013 8:08 am

Re: Wave patterns

Post by AnesthDoc »

Can someone else help me?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post by rimai »

Did you try to use the code he posted?
Roberto.
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: Wave patterns

Post 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
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Wave patterns

Post 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
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: Wave patterns

Post 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()
Image
Post Reply