4 WP40s alternating on dimming expansion

Do you have a question on how to do something.
Ask in here.
Post Reply
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

4 WP40s alternating on dimming expansion

Post by sabo »

I was originally just going to run 2 wp40s and have had them going great for the last few weeks. I just got two more and was thinking I'd like to have them switch the current back and forth. So say every six hours, ramp down two on one end, ramp up the other two, then switch off the two that have been running. Im not sure if I want them in else mode or to slowly ramp up and down. Sorta trying to simulate a tidal effect and make sure detritus doesn't build up on the downflow side of the rock if I only have two pushing current in only one direction.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Im also abit confused about the difference between the dcpump and pwm functions. The wizard uses dcpump, but I had to change it to the pwm function to get my two wp40s working how I wanted. If you can explain to a newb the difference, that would be great.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 4 WP40s alternating on dimming expansion

Post by lnevo »

DCPump is a wrapper around the PWM commands. It allows you to define which channel pumps you want on Sync and what pumps in AntiSync and coordinates the mode based on memory/portal settings.

Since it really can only handle "2" modes Sync/AntiSync and if people want to do custom schedules throughout the day, etc. then they would need to disable the DCPump class by setting the mode to custom and or/disabling the UseMemory field and manually setting the mode to custom and then setting the PWM modes manually.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

OK, so had a crack at it today and this is what I've managed to come up with. Two on each side f the tank, running reefcrest and alternating every six hours. Also shutoff skimmer if skimmer cup float activates, or skimate bucket is full. Does it all look sane? It compiles OK. Just worried about cutting the plugs off my jebao cable for the dimming expansion before I get it all sorted.

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

#define Return      1
#define Pwm_Exp     2
#define Unused      3
#define ATI         4
#define Jebao1rhs   5
#define Jebao2rhs   6
#define Jebao1lhs   7
#define Jebao2lhs   8

#define ATO         Box1_Port1
#define Fuge_Led    Box1_Port2
#define Heater1     Box1_Port3
#define Skimmer     Box1_Port4
#define Heater2     Box1_Port5
#define Unused      Box1_Port6
#define Unused      Box1_Port7
#define Unused      Box1_Port8

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = Heater1 | Heater2;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 280 );


    // Ports that are always on
    ReefAngel.Relay.On( Pwm_Exp );
    ReefAngel.Relay.On( Return );
    ReefAngel.Relay.On( ATI );
    ReefAngel.Relay.On( Fuge_Led );
    ReefAngel.Relay.On( Heater1 );
    ReefAngel.Relay.On( Heater2 );
    ReefAngel.Relay.On( Skimmer );

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

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

void loop()
{
    ReefAngel.WaterLevelATO( ATO,180,70,90 );
    ReefAngel.Relay.Set(Skimmer,ReefAngel.LowATO.IsActive()); // Turns Port1 when the HighATO float switch isn't floating
    ReefAngel.Relay.Set(Skimmer,ReefAngel.LowATO.IsActive()); // Turns Port1 when the HighATO float switch isn't floating


    ////// Place your custom code below here
    
    if (hour()>=6 && hour()<12)
{
  ReefAngel.PWM.SetChannel( 0, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 1, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1lhs | Jebao2lhs );
  ReefAngel.Relay.On( Jebao1rhs | Jebao2rhs );
}
else if (hour()>=12 && hour()<18)
{
  ReefAngel.PWM.SetChannel( 2, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 3, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1rhs | Jebao2rhs );
  ReefAngel.Relay.On( Jebao1lhs | Jebao2lhs );
}
else if (hour()>=18 && hour()<24)
{
  ReefAngel.PWM.SetChannel( 0, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 1, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1lhs | Jebao2lhs );
  ReefAngel.Relay.On( Jebao1rhs | Jebao2rhs );
}
else
{
  ReefAngel.PWM.SetChannel( 2, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 3, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1rhs | Jebao2rhs );
  ReefAngel.Relay.On( Jebao1lhs | Jebao2lhs );  
}


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

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

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

Re: 4 WP40s alternating on dimming expansion

Post by lnevo »

These lines i dont think are valid, what are you trying to do here?

Code: Select all

ReefAngel.On (jaebo1hs | jaebo2hs);
ReefAngel.On (jaebo1hs | jaebo2hs);
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Turn the two relays off for those pumps on that side of the tank. I know I can just set the pwm to zero, but may as well switch off the power supply. What you posted isn't the code that I posted, so i'm not sure it is dislaying correctly for you (or what you posted for me) here is the two lines that get repeated and reversed.

ReefAngel.Relay.Off( Jebao1lhs | Jebao2lhs );
ReefAngel.Relay.On( Jebao1rhs | Jebao2rhs );
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 4 WP40s alternating on dimming expansion

Post by lnevo »

Yeah you cant do that. You'll need an explicit line for each port your turning off and on.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 4 WP40s alternating on dimming expansion

Post by lnevo »

ReefAngel.Relay.Off( Jebao1lhs );
ReefAngel.Relay.Off( Jebao2lhs );
ReefAngel.Relay.On( Jebao1rhs );
ReefAngel.Relay.On( Jebao2rhs );
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Ah, OK. Thanks. Other than that it looks sane?
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Changed and made a minor change for the defines so its more readable.

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

#define Return      1
#define Pwm_Exp     2
#define Unused      3
#define ATI         4
#define Jebao1_Rhs   5
#define Jebao2_Rhs   6
#define Jebao1_Lhs   7
#define Jebao2_Lhs   8

#define ATO         Box1_Port1
#define Fuge_Led    Box1_Port2
#define Heater1     Box1_Port3
#define Skimmer     Box1_Port4
#define Heater2     Box1_Port5
#define Unused      Box1_Port6
#define Swabby      Box1_Port7
#define Unused      Box1_Port8

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = Heater1 | Heater2;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 280 );


    // Ports that are always on
    ReefAngel.Relay.On( Pwm_Exp );
    ReefAngel.Relay.On( Return );
    ReefAngel.Relay.On( ATI );
    ReefAngel.Relay.On( Fuge_Led );
    ReefAngel.Relay.On( Heater1 );
    ReefAngel.Relay.On( Heater2 );
    ReefAngel.Relay.On( Skimmer );

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

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

void loop()
{
    ReefAngel.WaterLevelATO( ATO,180,70,90 );
    ReefAngel.Relay.Set(Skimmer,ReefAngel.LowATO.IsActive()); // Turns Port1 when the HighATO float switch isn't floating
    ReefAngel.Relay.Set(Skimmer,ReefAngel.HighATO.IsActive()); // Turns Port1 when the HighATO float switch isn't floating
    ReefAngel.DosingPumpRepeat( Swabby,0,360,120 );

    ////// Place your custom code below here
    
    if (hour()>=6 && hour()<12)
{
  ReefAngel.PWM.SetChannel( 0, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 1, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1_Lhs );
  ReefAngel.Relay.Off( Jebao2_Lhs );
  ReefAngel.Relay.On( Jebao1_Rhs );
  ReefAngel.Relay.On( Jebao2_Rhs );
}
else if (hour()>=12 && hour()<18)
{
  ReefAngel.PWM.SetChannel( 2, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 3, ReefCrestMode(70,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1_Rhs );
  ReefAngel.Relay.Off( Jebao2_Rhs );
  ReefAngel.Relay.On( Jebao1_Lhs );
  ReefAngel.Relay.On( Jebao2_Lhs );
}
else if (hour()>=18 && hour()<24)
{
  ReefAngel.PWM.SetChannel( 0, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 1, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1_Lhs );
  ReefAngel.Relay.Off( Jebao2_Lhs );
  ReefAngel.Relay.On( Jebao1_Rhs );
  ReefAngel.Relay.On( Jebao2_Rhs );
}
else
{
  ReefAngel.PWM.SetChannel( 2, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
  ReefAngel.PWM.SetChannel( 3, ReefCrestMode(50,20,true) ); // ReefCrest at 60% +/- 20% on anti-sync mode
  ReefAngel.Relay.Off( Jebao1_Rhs );
  ReefAngel.Relay.Off( Jebao2_Rhs );
  ReefAngel.Relay.On( Jebao1_Lhs );
  ReefAngel.Relay.On( Jebao2_Lhs ); 
}


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

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

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

Re: 4 WP40s alternating on dimming expansion

Post by lnevo »

Looks good from my perspective
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Great. I'll see how it turns out in the morning. Little bit nervous about changing things as im off to work for two weeks on tuesday and I wont be around to fix things.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: 4 WP40s alternating on dimming expansion

Post by sabo »

Had to change the ATO float valves bit because only one was doing as intended. Heres the change just incase anyone uses the two float switches as I have and need something to start with.

Code: Select all

    if (ReefAngel.LowATO.IsActive() && ReefAngel.HighATO.IsActive())
      {
        ReefAngel.Relay.On(Skimmer);
      }
     else
      {
        ReefAngel.Relay.Off(Skimmer);
Post Reply