Page 1 of 1

Adjust dosing pumps with app?

Posted: Mon May 30, 2016 4:04 pm
by jjdezek
Can it be set up to adjust when and how long dosing pumps come on from the app? It's a pain to go in and reprogram them every time you want to adjust them.

Re: Adjust dosing pumps with app?

Posted: Mon May 30, 2016 8:00 pm
by lnevo
Yes. They need to be set to be used from InternalMemory and then you can change them under that section.

Re: Adjust dosing pumps with app?

Posted: Tue May 31, 2016 12:18 am
by jjdezek
How would I go about doing that?

Re: Adjust dosing pumps with app?

Posted: Tue May 31, 2016 3:30 pm
by lnevo
Post your dosing pump code and what app you are using on your phone. Take a look in the portal to start and look under Internal Memory. There is a section inside for Dosing Pumps. You can put your settings in there and once we update your code it will get the numbers from there instead of hard coded in your program.

Re: Adjust dosing pumps with app?

Posted: Tue May 31, 2016 4:01 pm
by jjdezek
im using the iphone app on my iphone 6s.

Code: Select all

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

[color=#7E7E7E]////// Place global variable code below here[/color]
#define NUMBERS_8x16
[color=#CC6600]void[/color] DrawCustomMain()
{
[color=#7E7E7E]// the graph is drawn/updated when we exit the main menu &[/color]
[color=#7E7E7E]// when the parameters are saved[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawDate[/color](6, 112);
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color](COLOR_INDIGO, COLOR_WHITE,25,5, [color=#006699]"Jeremy's Reef"[/color]);
[color=#CC6600]pingSerial[/color]();

DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
[color=#CC6600]pingSerial[/color]();
[color=#CC6600]byte[/color] TempRelay = [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayData[/color];
TempRelay &= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOff[/color];
TempRelay |= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOn[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawOutletBox[/color](12, 93, TempRelay);
}

[color=#7E7E7E]////// Place global variable code above here[/color]


[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
    [color=#7E7E7E]// This must be the first line[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]Init[/color]();  [color=#7E7E7E]//Initialize controller[/color]
    [color=#7E7E7E]// Ports toggled in Feeding Mode[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePorts[/color] = [color=#006699]Port5Bit[/color] | [color=#006699]Port6Bit[/color] | [color=#006699]Port8Bit[/color];
    [color=#7E7E7E]// Ports toggled in Water Change Mode[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePorts[/color] = [color=#006699]Port1Bit[/color];
    [color=#7E7E7E]// Ports toggled when Lights On / Off menu entry selected[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPorts[/color] = 0;
    [color=#7E7E7E]// Ports turned off when Overheat temperature exceeded[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPorts[/color] = [color=#006699]Port3Bit[/color] | [color=#006699]Port7Bit[/color];
    [color=#7E7E7E]// Use T1 probe as temperature and overheat functions[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]TempProbe[/color] = [color=#006699]T3_PROBE[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]OverheatProbe[/color] = [color=#006699]T3_PROBE[/color];
    [color=#7E7E7E]// Set the Overheat temperature setting[/color]
    [color=#CC6600]InternalMemory[/color].[color=#CC6600]OverheatTemp_write[/color]( 820 );

    [color=#7E7E7E]// Feeeding and Water Change mode speed[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]FeedingSpeed[/color]=0;
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]WaterChangeSpeed[/color]=0;


    [color=#7E7E7E]// Ports that are always on[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port4[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port5[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port6[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port8[/color] );

    [color=#7E7E7E]////// Place additional initialization code below here[/color]
    

    [color=#7E7E7E]////// Place additional initialization code above here[/color]
}

[color=#CC6600]void[/color] [color=#CC6600]loop[/color]()
{
      [color=#CC6600]ReefAngel[/color].[color=#CC6600]DosingPumpRepeat[/color]( [color=#006699]Port1[/color],15,360,8 );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DosingPumpRepeat[/color]( [color=#006699]Port2[/color],15,360,8 );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardATO[/color]( [color=#006699]Port3[/color],30 );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardHeater[/color]( [color=#006699]Port7[/color],770,775 );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 0, [color=#CC6600]PWMSlope[/color](8,0,20,0,5,55,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 1, [color=#CC6600]PWMSlope[/color](8,5,20,5,5,45,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 2, [color=#CC6600]PWMSlope[/color](8,10,20,10,5,55,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 3, [color=#CC6600]PWMSlope[/color](8,15,20,15,5,45,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 4, [color=#CC6600]PWMSlope[/color](8,20,20,20,5,55,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 5, [color=#CC6600]PWMSlope[/color](8,25,20,25,5,45,180,5) );
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]DaylightChannel[/color] = [color=#006699]AntiSync[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ActinicChannel[/color] = [color=#006699]Sync[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][0] = [color=#006699]None[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][1] = [color=#006699]None[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][2] = [color=#006699]None[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][3] = [color=#006699]None[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][4] = [color=#006699]None[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ExpansionChannel[/color][5] = [color=#006699]None[/color];
    [color=#7E7E7E]////// Place your custom code below here[/color]
      [color=#CC6600]if[/color] ([color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]Mode[/color]==Custom)
  {
    [color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]UseMemory[/color] = [color=#CC6600]true[/color];    
  }


    [color=#7E7E7E]////// Place your custom code above here[/color]

    [color=#7E7E7E]// This should always be the last line[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]Portal[/color]( [color=#006699]"jjdezek"[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]ShowInterface[/color]();
}

[color=#CC6600]void[/color] DrawParamsa([color=#CC6600]int[/color] x, [color=#CC6600]int[/color] y){
[color=#CC6600]char[/color] buf[16];
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color](DPColor,DefaultBGColor,x+70,y+10,[color=#006699]"WP40L:"[/color]);
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawSingleMonitor[/color]([color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]GetDaylightValue[/color](), DPColor, x+108, y+10,1);
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color](APColor,DefaultBGColor,x+70,y+20,[color=#006699]"WP40R:"[/color]);
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawSingleMonitor[/color]([color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]GetActinicValue[/color](),APColor, x+108, y+20,1);

}

[color=#CC6600]void[/color] DrawParams([color=#CC6600]int[/color] x, [color=#CC6600]int[/color] y) {
  [color=#CC6600]char[/color] buf[16];

  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color](COLOR_BLACK,DefaultBGColor,x+5,y,[color=#006699]"Temp:"[/color]);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color](COLOR_BLACK,DefaultBGColor,x+80, y, [color=#006699]"PH:"[/color]);
  [color=#7E7E7E]// Temp and PH[/color]
  y+=10;

  [color=#CC6600]ConvertNumToString[/color](buf, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color].[color=#006699]Temp[/color][[color=#006699]T1_PROBE[/color]], 10);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
    [color=#CC6600]ConvertNumToString[/color](buf, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color].[color=#006699]Temp[/color][[color=#006699]T2_PROBE[/color]], 10);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](T2TempColor, DefaultBGColor, x+5, y+12, buf, Num8x16);
    [color=#CC6600]ConvertNumToString[/color](buf, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color].[color=#006699]Temp[/color][[color=#006699]T3_PROBE[/color]], 10);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](T3TempColor, DefaultBGColor, x+40, y+12, buf, Num8x16);
  [color=#CC6600]ConvertNumToString[/color](buf, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color].[color=#006699]PH[/color], 100);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
  y+=5;
   [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color]( COLOR_DARKKHAKI,DefaultBGColor,10,18, [color=#006699]"SAL:"[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawSingleMonitor[/color]( [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color].[color=#006699]Salinity[/color],COLOR_DARKKHAKI,33,18, 10 );   
}

[color=#CC6600]void[/color] DrawStatus([color=#CC6600]int[/color] x, [color=#CC6600]int[/color] y) {
  [color=#CC6600]int[/color] t=x;
  
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](COLOR_INDIGO,DefaultBGColor,15,y,[color=#006699]"High"[/color],Font8x16);
  [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawLargeText[/color](COLOR_INDIGO,DefaultBGColor,85,y,[color=#006699]"Low"[/color],Font8x16);
  
  [color=#CC6600]if[/color] ([color=#CC6600]ReefAngel[/color].[color=#006699]HighATO[/color].[color=#CC6600]IsActive[/color]()) {
    [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]FillCircle[/color](55,y+3,5,COLOR_GREEN);
  } [color=#CC6600]else[/color] {
    [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]FillCircle[/color](55,y+3,5,COLOR_RED);
  }
  
  [color=#CC6600]if[/color] ([color=#CC6600]ReefAngel[/color].[color=#006699]LowATO[/color].[color=#CC6600]IsActive[/color]()) {
    [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]FillCircle[/color](70,y+3,5,COLOR_GREEN);
  } [color=#CC6600]else[/color] {
    [color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]FillCircle[/color](70,y+3,5,COLOR_RED);
  }
}

[color=#CC6600]void[/color] DrawCustomGraph()
{
}

[/quote]

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 4:23 am
by lnevo
Change the DosingPumpRepeat lines to this

Code: Select all

DosingPumpRepeat1(Port1);
DosingPumpRepeat2(Port2);
In the iphone app, go to Settings. Click on the Internal Memory tab, then open the Dosing Pump section and set your values. You can set the before you upload or after.

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 5:06 am
by jjdezek
Ok I will try that when I get home. Could I also do that for my dimming expansion?

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 4:01 pm
by lnevo
Pretty much. We'd have to go line by line to see what would change. It might be easier to build a new INO from the wizard and choose memory settings. That would at least let you see how those functions would change in that case.

Looking at your lighting settings, your case may be a little trickly because you have offsets every 5 minutes. We support that in memory but I have to see the easiest way to utilize it.

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 4:02 pm
by lnevo
Your heater settings and ato timeout can be removed from code and just leave the ports. Make sure they are set first before uploading or right after.

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 5:16 pm
by jjdezek
Ok do I just delete the numbers from the temp and ato?

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 5:17 pm
by lnevo
void Channel0PWMSlope(int MinuteOffset);
void Channel1PWMSlope(int MinuteOffset);
void Channel2PWMSlope(int MinuteOffset);
void Channel3PWMSlope(int MinuteOffset);
void Channel4PWMSlope(int MinuteOffset);
void Channel5PWMSlope(int MinuteOffset);
void Channel0PWMSlope(int PreMinuteOffset, int PostMinuteOffset);
void Channel1PWMSlope(int PreMinuteOffset, int PostMinuteOffset);
void Channel2PWMSlope(int PreMinuteOffset, int PostMinuteOffset);
void Channel3PWMSlope(int PreMinuteOffset, int PostMinuteOffset);
void Channel4PWMSlope(int PreMinuteOffset, int PostMinuteOffset);
void Channel5PWMSlope(int PreMinuteOffset, int PostMinuteOffset);

Those are the functions we have for Slope on the PWM Dimming expansion. It means you could just change what you have for Channel 0 to just the following

ReefAngel.PWM.Channel0PWMSlope();

Now since you have an offset, the default behavior is like the actinic offset which will start the lights early and end them later. Since you're just shifting your start time and end time to match you would do the following channels

ReefAngel.PWM.Channel1PWMSlope(-5,5);
ReefAngel.PWM.Channel2PWMSlope(-10,10);
ReefAngel.PWM.Channel3PWMSlope(-15,15);
ReefAngel.PWM.Channel4PWMSlope(-20,20);
ReefAngel.PWM.Channel5PWMSlope(-25,25);

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 5:19 pm
by lnevo
jjdezek wrote:Ok do I just delete the numbers from the temp and ato?
Pretty much :)

If you look at the API search at http://www.easte.net/ra/html you'll find this when you search for StandardATO

ReefAngelClass::StandardATO(byte ATORelay, int ATOTimeout)
ReefAngelClass::StandardATO(byte Relay)

Which means we have one function that just needs the relay and one that needs the relay and the timeout. If you don't set things in the function call then it will usually get from memory :)

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 5:30 pm
by jjdezek
ReefAngel.PWM.SetChannel( 0, PWMSlope(8,0,20,0,5,55,180,5) );
ReefAngel.PWM.SetChannel( 1, PWMSlope(8,5,20,5,5,45,180,5) );
ReefAngel.PWM.SetChannel( 2, PWMSlope(8,10,20,10,5,55,180,5) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(8,15,20,15,5,45,180,5) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(8,20,20,20,5,55,180,5) );
ReefAngel.PWM.SetChannel( 5, PWMSlope(8,25,20,25,5,45,180,5) );
so for the light I would change the part in () to the -5,5 -10,10 and so on?

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 6:04 pm
by jjdezek
ok heres what I have changed. does this look right before I load it? also how do my light know when to turn on with this code? when I went into the internal memory and set the lights for the duration it only allowed me to set it at 60 mins. does this mean my lights will only be on for an hour? or is that how long there at the top %? I didn't mess with the ato because I wasn't sure what to put in the internal memory and im not worried about needing to adjust that.

ReefAngel.DosingPumpRepeat1( Port1);
ReefAngel.DosingPumpRepeat2( Port2);
ReefAngel.StandardATO( Port3,30 );
ReefAngel.StandardHeater( Port7);
ReefAngel.PWM.Channel0PWMSlope();
ReefAngel.PWM.Channel1PWMSlope(-5,5);
ReefAngel.PWM.Channel2PWMSlope(-10,10);
ReefAngel.PWM.Channel3PWMSlope(-15,15);
ReefAngel.PWM.Channel4PWMSlope(-20,20);
ReefAngel.PWM.Channel5PWMSlope(-25,25);

Re: Adjust dosing pumps with app?

Posted: Wed Jun 01, 2016 10:23 pm
by lnevo
You can change this one and set the timeout in the ATO section.

ReefAngel.StandardATO( Port3,30 );

to

ReefAngel.StandardATO( Port3 );

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 8:06 am
by jjdezek
What would I put in the internal memory for the ato?

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 9:41 am
by lnevo
30

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 2:44 pm
by jjdezek
Ok got the lights and dosing codes loaded going to see how they work before I mess with ato.

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 4:34 pm
by jjdezek
My lights aren't dimming down. Is there something I need to do to control when they ramp up and down?

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 6:41 pm
by lnevo
Is everything set in the portal / app? You also need to set the time schedule for 8:00-20:00

Re: Adjust dosing pumps with app?

Posted: Thu Jun 02, 2016 6:50 pm
by jjdezek
Yeah I found that after I posted. Changed it and everything seems to be working good. Thanks for all the help. Made my task easier.

Re: Adjust dosing pumps with app?

Posted: Fri Jun 03, 2016 9:49 am
by lnevo
Cool. This is a good thread. Gonna try and rename and pin it later. Great exercise to convert from hard coded config to memory based. Glad it worked out good for you.

Re: Adjust dosing pumps with app?

Posted: Fri Jun 03, 2016 11:30 am
by jjdezek
That works for me hopefully others can get some good info from this.