ATO and Dosing code suggestions

Share you PDE file with our community
Post Reply
Cruzer
Posts: 39
Joined: Sun Nov 06, 2011 10:14 pm

ATO and Dosing code suggestions

Post by Cruzer »

Hello All.

Last weekend I was able to get some of the programing done with your help and have many of the functions working that I wanted. I think I am going to just try one thing at a time each weekend until I have it all together. Thank you for all the help so far.
Now I want to get the ATO and some dosing setup. Here is what I would like to end up with:
(1) float switch in the sump
(1) float switch in the ATO reservoir
(1) dosing pump

If Sump switch is not showing a high reading dose every hour for 30 sec.
If sump switch is showing high do not dose.
If reservoir switch is showing low then don't dose
If reservoir switch is showing low then show low status somewhere (Iphone app).
Is all of this possible? Will a float switch survive in a lime water mixture or will I have problems? Will be researching to try and figure it out, any help would be appreciated. I am also very open to suggestions on how to accomplish the basic idea of what I am proposing in another way if it makes more since.

Here is my current PDE file;

Code: Select all

// Autogenerated file by RAGen (v1.1.0.127), (01/22/2012 09:53)
// RA_012212_0953.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
 #define DateTimeSetup
 #define DirectTempSensor
 #define wifi
 #define SIMPLE_MENU
 */


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "Cruzer";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "N/A";
prog_char probe3_label[] PROGMEM = "N/A";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Light 1";
prog_char relay3_label[] PROGMEM = "Light 2";
prog_char relay4_label[] PROGMEM = "Power Head";
prog_char relay5_label[] PROGMEM = "WM2";
prog_char relay6_label[] PROGMEM = "Pump";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Skimmer";

PROGMEM const char *webbanner_items[] = {
  id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
  relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};


void setup()


{
  ReefAngel.Init();  //Initialize controller

  ReefAngel.FeedingModePorts = B10111001;
  ReefAngel.WaterChangePorts = B10111001;

  // Ports that are always on
  ReefAngel.Relay.On(Port6);
  ReefAngel.Relay.On(Port8);
  ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
  ReefAngel.Timer[4].SetInterval(180); // set interval to 180 seconds
  ReefAngel.Timer[4].Start();
}


void loop()
{
  if(ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.Timer[4].Start();
    ReefAngel.WebBanner();
  }


  // Specific functions
  ReefAngel.StandardATO(Port1);
  ReefAngel.StandardLights(Port2);
  ReefAngel.MHLights(Port3);
  ReefAngel.Wavemaker1(Port4);
  ReefAngel.Wavemaker2(Port5);
  ReefAngel.StandardHeater(Port7);

  ReefAngel.ShowInterface();
}

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

Re: ATO and Dosing code suggestions

Post by rimai »

Ok, the first thing I'd recommend is moving the wavemakers to port 5 and 6.
Also, make sure that you have WDT feature checked on RAGen.
Now, to the ATO.
Try this code.
It will only dose if LowATO is closed and HighATO is not closed and it is the first 30 seconds of every hour.

Code: Select all

// Autogenerated file by RAGen (v1.1.0.127), (01/22/2012 09:53)
// RA_012212_0953.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
 #define DisplayImages
 #define DateTimeSetup
 #define DirectTempSensor
 #define wifi
 #define SIMPLE_MENU
 */


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "Cruzer";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "N/A";
prog_char probe3_label[] PROGMEM = "N/A";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Light 1";
prog_char relay3_label[] PROGMEM = "Light 2";
prog_char relay4_label[] PROGMEM = "Pump";
prog_char relay5_label[] PROGMEM = "Power Head";
prog_char relay6_label[] PROGMEM = "WM2";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Skimmer";

PROGMEM const char *webbanner_items[] = {
  id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
  relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};


void setup()


{
  ReefAngel.Init();  //Initialize controller

  ReefAngel.FeedingModePorts = B10111001;
  ReefAngel.WaterChangePorts = B10111001;

  // Ports that are always on
  ReefAngel.Relay.On(Port4);
  ReefAngel.Relay.On(Port8);
  ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
  ReefAngel.Timer[4].SetInterval(180); // set interval to 180 seconds
  ReefAngel.Timer[4].Start();
}


void loop()
{
  if(ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.Timer[4].Start();
    ReefAngel.WebBanner();
  }


  // Specific functions
  if (ReefAngel.LowATO.IsActive())
    if (~ReefAngel.HighATO.IsActive())
      if (now()%3600<30) ReefAngel.Relay.On(Port1); 
      else ReefAngel.Relay.Off(Port1);
    else ReefAngel.Relay.Off(Port1);
  else ReefAngel.Relay.Off(Port1);
  ReefAngel.StandardLights(Port2);
  ReefAngel.MHLights(Port3);
  ReefAngel.Wavemaker1(Port5);
  ReefAngel.Wavemaker2(Port6);
  ReefAngel.StandardHeater(Port7);

  ReefAngel.ShowInterface();
}
Roberto.
duck
Posts: 28
Joined: Tue Jan 24, 2012 4:12 pm

Re: ATO and Dosing code suggestions

Post by duck »

i would setup your topoff separate from dosing. your dosing will always happen throughout the day, spread it out to make it more stable. no ph swing. your topoff would never kick in, but would be a redundant feature if you ran you alk or kalk dry, at least you would topoff and not have a salinity swing or suck air.
Post Reply