salinity doesnt work

Expansion modules and attachments
Post Reply
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

salinity doesnt work

Post by sesame »

hi
i'm very appreciate if some one know how to solve my problem with my salinity expansion.
last week, i just hock up with a new ph expansion to monitor newly added Ca reactor.
after 3 days try out. ph expansion works fine with ca reactor, but my salinity doesnt work at all.
now it shows 6 what ever plug to usb hub or directly to relay box.
anything wrong with my probe or code.

attached code is updated with ph expansion.

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>

// Define Relay Ports by Name
#define Return             1
#define ATOPump            2
#define ZeovitShake        3
#define T5_Channel2        4
#define Co2                5
#define T5_Channel1        6
#define Skimmer            7
#define Wavepump           8

#define CaHCO3             Box1_Port1  //16Ch Port8
#define CaOH2              Box1_Port2  //16Ch Port9
#define ZEO_ST3            Box1_Port4  //16Ch Port11
#define MgCl2              Box1_Port5  //16Ch Port12
#define CaCl2              Box1_Port3  //16Ch Port12


// Define Custom Memory Locations

////// 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.SetTemperatureUnit( Celsius );  // set to Celsius Temperature
    
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    //Co2 Control
      ReefAngel.CO2Control(Co2, 650, 670, true);

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port2Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T2_PROBE;
    
    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    //ReefAngel.DCPump.ExpansionChannel[0] = Sync;
    //ReefAngel.DCPump.ExpansionChannel[1] = AntiSync;
    //ReefAngel.DCPump.ExpansionChannel[2] = None;
    //ReefAngel.DCPump.ExpansionChannel[3] = None;
    //ReefAngel.DCPump.ExpansionChannel[4] = None;
    //ReefAngel.DCPump.ExpansionChannel[5] = None;

    
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;

    // Ports that are always on
    ReefAngel.Relay.On(Return);
    ReefAngel.Relay.On(Wavepump);
    
    ////// Place additional initialization code below here
    
    ReefAngel.CustomLabels[0]="ReturnPump"; 
    ReefAngel.CustomLabels[1]="ATOPump"; 
    ReefAngel.CustomLabels[2]="ZeovitShake"; 
    ReefAngel.CustomLabels[3]="T5_Channel2"; 
    ReefAngel.CustomLabels[4]="Co2"; 
    ReefAngel.CustomLabels[5]="T5_Channel1"; 
    ReefAngel.CustomLabels[6]="Skimmer"; 
    ReefAngel.CustomLabels[7]="WavePump"; 

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

void loop()
{
    //single ATO 
    ReefAngel.SingleATO(true,ATOPump,90,1);
    //Heater
    //ReefAngel.StandardHeater(Heater);
    //ZeovitShake
    
        if (hour()==5 && minute()==26 && second()<20) //Dosing ST3 at 22:31
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==2 && minute()==26 && second()<20) //Dosing ST3 at 6:31
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==18 && minute()==56 && second()<20) //Dosing ST3 at 6:31
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==22 && minute()==58 && second()<20) //Dosing ST3 at 6:31
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else
    {
      ReefAngel.Relay.Off(ZeovitShake);
    }

    
    ReefAngel.Relay.DelayedOn(Skimmer);

    // T5 light setup
    ReefAngel.ActinicLights(T5_Channel2);
    ReefAngel.DayLights(T5_Channel1);

    //dosing pump setup 
    //Main 4    
    ReefAngel.DosingPumpRepeat1(CaHCO3);
    ReefAngel.PWM.SetChannel(2,ReefAngel.Relay.Status(CaHCO3)*100);
    ReefAngel.DosingPumpRepeat2(CaOH2);
    ReefAngel.PWM.SetChannel(3,ReefAngel.Relay.Status(CaOH2)*100);

    //ReefAngel.DosingPumpRepeat(CaCl2,5,120,8);
    //ReefAngel.PWM.SetChannel(0,ReefAngel.Relay.Status(CaCl2)*100);
    
    //ZEO ST3
    ReefAngel.DosingPumpRepeat3(ZEO_ST3);
    ReefAngel.PWM.SetChannel(4,ReefAngel.Relay.Status(ZEO_ST3)*100);
    

    //ZEO SP    
//     if (hour()==0 && minute()==32 && second()<13)
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==3 && minute()==32 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==6 && minute()==32 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==9 && minute()==32 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==12 && minute()==42 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==15 && minute()==32 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==18 && minute()==32 && second()<13) 
//    {
//   ReefAngel.Relay.On(ZEO_SP);
//    }
//     else if (hour()==21 && minute()==32 && second()<13) 
//    {
//    ReefAngel.Relay.On(ZEO_SP);
//    }
//    else
//    {
//    ReefAngel.Relay.Off(ZEO_SP);
//    }
//    ReefAngel.PWM.SetChannel(5,ReefAngel.Relay.Status(ZEO_SP)*100);

    
    //wave pump setup    
    if (now() % SECS_PER_DAY >= 8 * SECS_PER_HOUR && now() % SECS_PER_DAY < (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Lagoon,60,20);//Set 6105 to 60% speed with  pulse in Lagoon Mode from 9:00~9:10
        }
        
       else if (now() % SECS_PER_DAY >= (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) && now() % SECS_PER_DAY < (10 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
        }    
      
       else if (now() % SECS_PER_DAY >= (10 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (11 * SECS_PER_HOUR + 10 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(LongPulse,55,15);//Set 6105 to 60% speed with  pulse in ReefCrest Mode 
        }
        
        else if (now() % SECS_PER_DAY >= (11 * SECS_PER_HOUR + 10 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(ReefCrest,60,20);;//Set 6105 to 55% speed with Long pulse Mode 
        }
        
        else if (now() % SECS_PER_DAY >= (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 15 * SECS_PER_HOUR )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,55,20); //Set 6105 to 45% speed with 20ms pulse in Tidal Swell Mode
        }
        
        else if (now() % SECS_PER_DAY >= 15 * SECS_PER_HOUR  && now() % SECS_PER_DAY < (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(ReefCrest,60,20);//Set RW8 to 40% speed with Lagoon Pulse Mode
        }
        
        else if (now() % SECS_PER_DAY >= (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN))
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
        }
        
        else if (now() % SECS_PER_DAY >= (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (19 * SECS_PER_HOUR + 00 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Lagoon,60,20);//Set 6105 to 55% speed with  pulse in Lagoon Mode 
        }    
        
        else if (now() % SECS_PER_DAY >= (19 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 20 * SECS_PER_HOUR )
        {
            ReefAngel.DCPump.UseMemory=false;
            //ReefAngel.DCPump.SetMode(TidalSwell,50,20); //Set 6105 to 85% speed with 20ms pulse in Tidal Swell Mode
        } 
        
        else if (now() % SECS_PER_DAY >= 20 * SECS_PER_HOUR  && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            //ReefAngel.DCPump.SetMode(ReefCrest,55,20);//Set 6105 to 70% speed with Lagoon Pulse Mode
            ReefAngel.DCPump.SetMode(ShortPulse,65,41);
        }
        
        else if (now() % SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 35 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Lagoon,70,20);//Set 6105 to 90% speed with  pulse in Lagoon Mode, dossing coral feed.
        }
                
       else 
        {
            ReefAngel.DCPump.SetMode(Sine,50,30);
        }
        
        // Set RW-8 WaveMode
        //if (hour() >= 8 && hour() < 9)
       // {
       //     ReefAngel.PWM.SetChannel(0,GyreMode(45,75,60,true));
       //     ReefAngel.PWM.SetChannel(1,GyreMode(45,75,60,false));
       // }
       //else if (hour() >= 9 && hour() < 13)
       //{
       //     ReefAngel.PWM.SetChannel(0,TidalSwellMode(75,true));
       //     ReefAngel.PWM.SetChannel(1,TidalSwellMode(75,false));
       // }
       //else if (hour() >= 13 && hour() < 17)
       // {
       //     ReefAngel.PWM.SetChannel(0, ElseMode(60,20,true));
       //     ReefAngel.PWM.SetChannel(1, ElseMode(60,20,false));
       // }
       //else if (hour() >= 17 && hour() < 22)
       // {
       //     ReefAngel.PWM.SetChannel(0, NutrientTransportMode(40,60,40,true));
       //     ReefAngel.PWM.SetChannel(1, NutrientTransportMode(40,60,40,false));
       // }
       //else 
       // {
       //     ReefAngel.PWM.SetChannel(0,ShortPulseMode(50,40,40,true));
       //     ReefAngel.PWM.SetChannel(1,ShortPulseMode(50,40,40,false));
       // }
        
    // Set timer when in feeding mode
   // static unsigned long feeding;
   // if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
   // if (now()-feeding< 1 *SECS_PER_HOUR) { 
    // Continue NTM for the 60 minutes
   // ReefAngel.DCPump.UseMemory=false;
   // ReefAngel.DCPump.SetMode(NutrientTransport,35,30);
   // }
    
    //Autofeeder 
    if ( ((hour() == 18)) && (minute() == 58) &&(second() == 30) ) ReefAngel.FeedingModeStart();
    if ( ((hour() == 9)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
    if ( ((hour() == 14)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
    //Skimmer off 1.5 hours when coral feeding.
    if (now()%SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now()%SECS_PER_DAY < (23 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
    {
      ReefAngel.Relay.Off(Skimmer); 
    }

    ////// Place your custom code below here
    ReefAngel.UseFlexiblePhCalibration();
  // Power Restored - Turn things back on
  // Turn off Skimmer if Return pump has been shutoff.   
  if (!ReefAngel.Relay.Status(Return)) {
      ReefAngel.Relay.Off(Skimmer);
      //ReefAngel.Relay.Off(Heater);
  }

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

    // This should always be the last line
    ReefAngel.Portal( "sesame");
    ReefAngel.DDNS("sesamehome");
    ReefAngel.ShowInterface();
}
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

i checked my portal and find another interesting thing
salinity drops very slowly from 25 Oct to 28 Oct and stay in 6 from 4pm in 28 Oct.
seems very strange.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

the salinity module was introduced about 8 month ago. It's working find since then even with serval time code update.
This is first time acting like this way after ph expansion hooked up.
Just tried to connect salinity again without hub. But still shows 6. Reboot head and connect again , still 6. Disconnect temp probe and ato, still 6.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

Re-calibrating salinity and reads zero
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

Put into a container of tank water. Show 6 . Re calibrating, zero
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: salinity doesnt work

Post by rimai »

Probably the probe.
You may need a new one.
Roberto.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

What happened with this probe. Always working fine since added ph expansion. Any other root cause?
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: salinity doesnt work

Post by lnevo »

Probes do not last forever. This one sounds like you had a good run. Could also be stray voltage.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

salinity doesnt work

Post by sesame »

means this probe can last less than a year like ph probe?
Let me try a new one and see what's happens
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

Another issue with my ph expansion module. Not sure if should raise another post
Ph expansion can't maintain ph calibration data when after upload code. For exp. before load ph expansion shown 6.5 and after shown 8.03.
Should re-calibrate every time when update my pde
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: salinity doesnt work

Post by rimai »

There is a patch on the next libraries update.
dedvalson reported this bug already and it has been patched in the dev branch.
https://github.com/reefangel/Libraries/issues/219
Let's hard code those values so you don't need to wait until next patch.
Roberto.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

patched with link code just now But nothing improved. Strange. Missing something? And re-calibrate again and again
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: salinity doesnt work

Post by rimai »

Let's just hard code it to be sure.
What were the values you were getting while doing the calibration?
Roberto.
sesame
Posts: 70
Joined: Sun Aug 04, 2013 2:29 am

Re: salinity doesnt work

Post by sesame »

not capture pic, not in home right now. Will check latterly afternoon
Post Reply