My Jebao "Else" mode

Expansion modules and attachments
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: My Jebao "Else" mode

Post by iratefrizz »

OK I just got my jebao wp-25 and my jebao cable and want to conrol it with the RA. I like the else mode. except its too strong for my tank i think. just kinda blows my feathers all over.
SO what I want to do is have this else mode on during the day 0600-2000 = 45% +/- 15
and else mode at night 2000 - 0600 = 35% +/- 5%
I have reefbreeders LEDs and they have their own controller so i do not have the lights on a schedule so i am not sure which dimming switch to plug the jebao into. or if it matters.
I have port 5 as my extra power head on during the day
and port 6 is where I will plug my jebao into.

here is my wizard drafted code.
I have not added in the else mode code yet cause i dont completely understand how the actinic / daylight section works or the schedule I want.
Thank you in advance

EDIT: I found some other threads with schedules in them and got them working. however I uploaded my code but both my dimming channels are at 0% right now even though it should be on else mode.
ideas?

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 869 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardHeater( Port3,771,775 );
    ReefAngel.StandardLights( Port4,20,0,8,0 );
    ReefAngel.Relay.Set( Port5, !ReefAngel.Relay.Status( Port4 ) );
    ReefAngel.StandardFan( Port8,775,780 );
    ReefAngel.DCPump.UseMemory = true;
    ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
    ReefAngel.DCPump.DaylightChannel = None;
    ReefAngel.DCPump.ActinicChannel = Sync;
    ////// Place your custom code below here
     if (ReefAngel.DCPump.Mode==Custom)
            {
              if ( (now()%SECS_PER_DAY >= 28800) || (now()%SECS_PER_DAY<= 72000) ) //0800-2000
              {
                ReefAngel.PWM.SetActinic( ElseMode(45,15,true)); // 
              }
              else if ( (now()%SECS_PER_DAY >= 72000) && (now()%SECS_PER_DAY<= 28800) )
              {
                ReefAngel.PWM.SetActinic( ElseMode(35,5,true));   // Else on sync mode, 36 +/- 6%
              }
            }     


    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "iratefrizz" );
    ReefAngel.ShowInterface();
}
    byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
    {
      // Static's only initialize the first time they are called
      static unsigned long LastChange=millis();        // Set the inital time that the last change occurred
      static int Delay = random( 500, 3000);           // Set the initial delay
      static int NewSpeed = MidPoint;                  // Set the initial speed
      static int AntiSpeed = MidPoint;                 // Set the initial anti sync speed
      if ((millis()-LastChange) > Delay)               // Check if the delay has elapsed
      {
        Delay=random(500,5000);                        // If so, come up with a new delay
        int ChangeUp = random(Offset);                 // Amount to go up or down
        if (random(100)<50)                            // 50/50 chance of speed going up or going down
        {
          NewSpeed = MidPoint - ChangeUp;
          AntiSpeed = MidPoint + ChangeUp;
        }
        else
        {
          NewSpeed = MidPoint + ChangeUp;
          AntiSpeed = MidPoint - ChangeUp;
        }
        LastChange=millis();                           // Reset the time of the last change
      }
      if (WaveSync)
      {
        return NewSpeed;
      }
      else
      {
        return AntiSpeed;
      }
    }

Last edited by iratefrizz on Sun Jun 08, 2014 6:03 am, edited 1 time in total.
Image
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: My Jebao "Else" mode

Post by howaboutme »

iratefrizz wrote:OK I just got my jebao wp-25 and my jebao cable and want to conrol it with the RA. I like the else mode. except its too strong for my tank i think. just kinda blows my feathers all over.
SO what I want to do is have this else mode on during the day 0600-2000 = 45% +/- 15
and else mode at night 2000 - 0600 = 35% +/- 5%
I have reefbreeders LEDs and they have their own controller so i do not have the lights on a schedule so i am not sure which dimming switch to plug the jebao into. or if it matters.
I have port 5 as my extra power head on during the day
and port 6 is where I will plug my jebao into.

here is my wizard drafted code.
I have not added in the else mode code yet cause i dont completely understand how the actinic / daylight section works or the schedule I want.
Thank you in advance

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port7Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit | Port2Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 869 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardHeater( Port3,771,775 );
    ReefAngel.StandardLights( Port4,20,0,8,0 );
    ReefAngel.StandardLights( Port5,8,0,20,0 );
    ReefAngel.StandardFan( Port8,775,780 );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( ShortPulse,50,10 );
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = None;
    ////// Place your custom code below here
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "iratefrizz" );
    ReefAngel.ShowInterface();
}

You don't have to plug your jebao into any of the outlets in the relay at all so you can save those for better use. Just plugging them into either the daylight (which is what your code says) or actinic is enough to control them. I have mine in the actinic just because it's where I plugged it in initially.

This may help you w/ the scheduling and the speed:

http://forum.reefangel.com/viewtopic.ph ... 5&start=30

See the complete code in my signature for reference too.
Jack
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: My Jebao "Else" mode

Post by iratefrizz »

Jack,
Thank you for the reply. that is actually the thread that I pulled my jebao code from :) should have given credit but I forgot. I might have missed something. but that is the code that Lee had posted for you towards the end... but with my time of day and using else mode isntead of steady.

I didn't think it needed to be plugged into the box but idk what else to plug in there lol. i have lights fuge light heater fan extra powerhead skimmer and return pump
Image
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: My Jebao "Else" mode

Post by howaboutme »

I see a couple of issues (and maybe Lee or Roberto can chime in).

First, I think you need to eliminate this line:

Code: Select all

ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
You're giving the controller conflicting information. You want else mode, not short pulse.

Second, (this is the one I am not 100% sure on) is to have 2 different settings in else mode, you need to hard code it in. I only have 1 setting when in else mode so I can control that pump settings via the portal. I don't believe you can with your situation. This also means you can't control your else mode pumps via portal on the fly (which I assume is okay). You need to change this:

Code: Select all

ReefAngel.DCPump.UseMemory = true;
This this:

Code: Select all

ReefAngel.DCPump.UseMemory = false;
Changing that means that the controller will take the speed given to it via the code and not from the portal.

And eliminate this:

Code: Select all

if (ReefAngel.DCPump.Mode==Custom)
Lee/Roberto or anyone else, is there a better way to do what he wants w/o eliminating control via portal for other pump settings? Hopefully we can get some experts to chime in as I am far from one. :)
Jack
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: My Jebao "Else" mode

Post by cosmith71 »

I'm actually waaaay behind on this stuff. I took down the tank I had set up for Jaebo control and haven't implemented it on my new tank. It's on my list to do as soon as I can get an expansion hub, dimming module, and some Jaebo cables. :mrgreen:

Try this. It completely eliminates portal control of the pumps but should do what you want.

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 869 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardHeater( Port3,771,775 );
    ReefAngel.StandardLights( Port4,20,0,8,0 );
    ReefAngel.Relay.Set( Port5, !ReefAngel.Relay.Status( Port4 ) );
    ReefAngel.StandardFan( Port8,775,780 );
    
    ////// Place your custom code below here
    
 if (hour() >= 8 && hour() < 20)
 {
    ReefAngel.PWM.SetActinic( ElseMode(45,15,true));
 }
 else
 {
   ReefAngel.PWM.SetActinic( ElseMode(35,5,true));
 }
                 


    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "iratefrizz" );
    ReefAngel.ShowInterface();
}

    byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
    {
      // Static's only initialize the first time they are called
      static unsigned long LastChange=millis();        // Set the inital time that the last change occurred
      static int Delay = random( 500, 3000);           // Set the initial delay
      static int NewSpeed = MidPoint;                  // Set the initial speed
      static int AntiSpeed = MidPoint;                 // Set the initial anti sync speed
      if ((millis()-LastChange) > Delay)               // Check if the delay has elapsed
      {
        Delay=random(500,5000);                        // If so, come up with a new delay
        int ChangeUp = random(Offset);                 // Amount to go up or down
        if (random(100)<50)                            // 50/50 chance of speed going up or going down
        {
          NewSpeed = MidPoint - ChangeUp;
          AntiSpeed = MidPoint + ChangeUp;
        }
        else
        {
          NewSpeed = MidPoint + ChangeUp;
          AntiSpeed = MidPoint - ChangeUp;
        }
        LastChange=millis();                           // Reset the time of the last change
      }
      if (WaveSync)
      {
        return NewSpeed;
      }
      else
      {
        return AntiSpeed;
      }
    }


User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: My Jebao "Else" mode

Post by lnevo »

I'm not sure I follow the questions... sorry this is a long thread. :)

The code I gave Jack should have been good. It allows portal to work and have the custom else mode. Can you please elaborate and point me to the code and the issue.

Thanks,
Lee
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: My Jebao "Else" mode

Post by howaboutme »

Lee the issue I see is that he wants 2 different speed settings based on 2 time frame's in else mode. Cosmith's code I think will work but it will prevent him from using the portal to change pump wave patterns.
Jack
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: My Jebao "Else" mode

Post by lnevo »

That shouldnt be an issue if he uses your base code... Just need another time based if block inside the if CUSTOM mode.

Can you point me to the code again that was initially presented? Sorry for the lazy mode...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: My Jebao "Else" mode

Post by lnevo »

That shouldnt be an issue if he uses your base code... Just need another time based if block inside the if CUSTOM mode.

Can you point me to the code again that was initially presented? Sorry for the lazy mode...
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: My Jebao "Else" mode

Post by howaboutme »

I believe this is his code:

Code: Select all

    #include <ReefAngel_Features.h>
    #include <Globals.h>
    #include <RA_Wifi.h>
    #include <Wire.h>
    #include <OneWire.h>
    #include <Time.h>
    #include <DS1307RTC.h>
    #include <InternalEEPROM.h>
    #include <RA_NokiaLCD.h>
    #include <RA_ATO.h>
    #include <RA_Joystick.h>
    #include <LED.h>
    #include <RA_TempSensor.h>
    #include <Relay.h>
    #include <RA_PWM.h>
    #include <Timer.h>
    #include <Memory.h>
    #include <InternalEEPROM.h>
    #include <RA_Colors.h>
    #include <RA_CustomColors.h>
    #include <Salinity.h>
    #include <RF.h>
    #include <IO.h>
    #include <ORP.h>
    #include <AI.h>
    #include <PH.h>
    #include <WaterLevel.h>
    #include <Humidity.h>
    #include <DCPump.h>
    #include <ReefAngel.h>

    ////// Place global variable code below here


    ////// Place global variable code above here


    void setup()
    {
        // This must be the first line
        ReefAngel.Init();  //Initialize controller
        ReefAngel.Use2014Screen();  // Let's use 2014 Screen
        // Ports toggled in Feeding Mode
        ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port7Bit | Port6Bit | Port7Bit | Port8Bit;
        // Ports toggled in Water Change Mode
        ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit | Port8Bit;
        // Ports toggled when Lights On / Off menu entry selected
        ReefAngel.LightsOnPorts = Port4Bit;
        // Ports turned off when Overheat temperature exceeded
        ReefAngel.OverheatShutoffPorts = Port4Bit | Port2Bit;
        // Use T1 probe as temperature and overheat functions
        ReefAngel.TempProbe = T1_PROBE;
        ReefAngel.OverheatProbe = T1_PROBE;
        // Set the Overheat temperature setting
        InternalMemory.OverheatTemp_write( 869 );

        // Feeeding and Water Change mode speed
        ReefAngel.DCPump.FeedingSpeed=0;
        ReefAngel.DCPump.WaterChangeSpeed=0;


        // Ports that are always on
        ReefAngel.Relay.On( Port1 );
        ReefAngel.Relay.On( Port2 );
        ReefAngel.Relay.On( Port6 );
        ReefAngel.Relay.On( Port7 );

        ////// Place additional initialization code below here
       

        ////// Place additional initialization code above here
    }

    void loop()
    {
        ReefAngel.StandardHeater( Port3,771,775 );
        ReefAngel.StandardLights( Port4,20,0,8,0 );
        ReefAngel.StandardLights( Port5,8,0,20,0 );
        ReefAngel.StandardFan( Port8,775,780 );
        ReefAngel.DCPump.UseMemory = false;
        ReefAngel.DCPump.SetMode( ShortPulse,50,10 );
        ReefAngel.DCPump.DaylightChannel = Sync;
        ReefAngel.DCPump.ActinicChannel = None;
        ////// Place your custom code below here
       

        ////// Place your custom code above here

        // This should always be the last line
        ReefAngel.Portal( "iratefrizz" );
        ReefAngel.ShowInterface();
    }

I think this is leftover from the wizard probably and should be deleted:

Code: Select all

ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
Maybe the above was the only issue?
Jack
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: My Jebao "Else" mode

Post by lnevo »

I think so, but I'm not sure. It really shouldn't make a difference because he had UseMemory=true and then if his memory is set to custom mode then it should do nothing while the PWM commands should have taken affect. I'm not sure.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: My Jebao "Else" mode

Post by iratefrizz »

hey guys, sorry I haven't been keeping up. the pulse mode was leftover from the wizard.
how exactly do i turn it on custom?
I would like to control it via portal if someone could tell me how but if not its no different than it is now. as I do not control it via portal now.
Image
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: My Jebao "Else" mode

Post by howaboutme »

iratefrizz wrote:hey guys, sorry I haven't been keeping up. the pulse mode was leftover from the wizard.
how exactly do i turn it on custom?
I would like to control it via portal if someone could tell me how but if not its no different than it is now. as I do not control it via portal now.
I assume you have the wifi module? Go to the portal and then internal memory and then dcpumps. Choose custom there. See what happens.
Jack
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: My Jebao "Else" mode

Post by iratefrizz »

ok, I will try that tonight. I have to reste my router as I think my port forwarding has messed up. I can't acccess my
RA from phone (outside of personal network) OR from Portal website.
(Edit) finally figured out what I was messing up on port forwarding and causing issues with portal. I set the dcpump to custom.
under pumps it says 255% for duration of 255.
so there must be an issue. I will try and reload the most recent suggested code to see if that works.

Thank you again for assistance
Image
Post Reply