Dosing pump programming.

New members questions
Post Reply
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Dosing pump programming.

Post by waucedah_joe »

Hello all. I've done a lot of lurking, searching, and copying of code but this is my first post because I just don't have enough knowledge to figure this out. I'm struggling with programming my dosing pumps. I generated the first code for my RA using the wizard with the option where values are read from memory that is accessible via Wi-Fi interface. I saw a snippet on here that only let the alk pump run when the pH was below a certain value. So, to test, I tried to turn the pump on every hour, 5 second offset, for 2 seconds.

So, I commented out this line:

// ReefAngel.DosingPumpRepeat2( Port8 );

And added:

if (ReefAngel. Params. PH < 835) //my code does not have the extra spaces but it wouldn't let me post otherwise.
ReefAngel.DosingPumpRepeat(Port8,5,60,2);
else
ReefAngel.Relay.Off(Port8);

I kept the dose low for testing. I monitored the system for the rest of the day. nothing seemed suspicious. Luckily, I had less than a quart left in the alk bottle because at around 3am I got a text telling me my pH was over 3.6 and all the alk had been pumped into the sump. Hearty livestock I guess cause nothing died. As I said I'm at a loss. Is there something that gets set up by the wizard that is overriding my modifications? I tried playing with just the ReefAngel.DosingPumpRepeat command, by changing the offset to 0 and running it every minute and it would run, (or not), as expected when I adjusted the pH conditional. So, the format of the code there seems correct. Help!

Here's all of the program. Real newbe here so feel free to comment about any aspect of this program not just my dosing pump problem.

Thanks

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 = Port4Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );

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

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

void loop()
{
    ReefAngel.ActinicLights( Port1 );
    ReefAngel.DayLights( Port2 );
    ReefAngel.StandardLights(Port3,18,0,8,0); // Lights on at 6:00pm and off at 8:00am
    ReefAngel.Relay.DelayedOn( Port6 );
    ReefAngel.DosingPumpRepeat1( Port7 );
//    ReefAngel.DosingPumpRepeat2( Port8 );

    ////// Place your custom code below here

    ReefAngel.RF.UseMemory=true;
    
    
    if (ReefAngel. Params. PH < 850)  
      ReefAngel.DosingPumpRepeat(Port8,5,60,2);
    else
      ReefAngel.Relay.Off(Port8);


    //Moonlight Phase 6pm-8am (CH3= Daylight CH4=Actinic)
    if ( (hour() >=8) && (hour() <18) )
    ReefAngel.PWM.SetActinic( (0) );
    else
    ReefAngel.PWM.SetActinic( MoonPhase() );


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

    // This should always be the last line
    ReefAngel.Portal( "waucedah_joe","xxxxxxx" );
    ReefAngel.ShowInterface();
}
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing pump programming.

Post by lnevo »

What I would recommend as best practice would be to declare your dosing pump command and then follow up with the conditional...

i.e.

Code: Select all

ReefAngel.DosingPumpRepeat(Port8,5,60,2);
if (ReefAngel.Params.PH > 850)  
  ReefAngel.Relay.Off(Port8);
This way you don't get caught in a situation where the port may get stuck on, although I'm having a hard time seeing how that could have happened based on the code you posted.

Also from your args you mentioned earlier, the 5 is in minutes not seconds. The 60 is also in minutes. The 2 though is in seconds,so again like you said should not have been on that long and if it got stuck in the on position, the else should have taken care of it.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

Thanks for the suggestion. I'll give it a try.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

Well I tried the modification suggested above but got the same result. I set it for 2 seconds every 60 minutes with 5 minute offset. I was drawing off of a gallon jug 1/4 full of DI. I monitored the level and after 3 hours there was pretty much undectable drawdown, as you'd expect for only 6 seconds of run time. However when I checked this morning, roughly 10 hours later the jug was empty. Just like before. At least I'm using DI for testing so no harm done.

While we're working on this problem I have a couple of general questions. When I do an upload, does the entire controller get overwritten? Is the code that I can see when I upload all there is? When I look at controller memory from my iPod, I see values under Dosing Pump that are different from my hard coded values. I suspect these got populated when I first generated the code with the wizzard but I don't see them in the editor. Could there be some residual code or flags set by the wizzard that are still active, causing the pump to run unexpectedly? Maybe it's not coding at all but the pump itself allowing a siphon. I do not see that happening when I watch it, but in the morning all the material has been added to the tank.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing pump programming.

Post by lnevo »

It could very well be a siphon issue...the code overwrites the entire controller and your statement is hard coded so shouldnt have any residual issues.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

Siphon confirmed. I had two pumps so I programmed the second one on Port7. It performed normally while the original pump on Port8 continued to over-add. Just to be sure, I switched and put the problem pump on Port7 and the "good" one on Port8. The problem followed the pump.

So, how do I go about getting the problem pump repaired/replaced? Product description says "Will not siphon".
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing pump programming.

Post by rimai »

I'd like you to use hard coded to make sure it is not some memory settings error.
So, Try this code here:

Code: Select all

ReefAngel.DosingPumpRepeat(Port7,0,60,2);
ReefAngel.DosingPumpRepeat(Port8,5,60,2);
Can you visually see it??
I highly doubt that a peristaltic pump is siphoning.
They are mechanically designed to operate without siphoning and because they are designed this way, it is virtually impossible to siphon. If you look inside the head of the pump, you will see that there is always one roller pressing the tube and preventing it from siphoning. The only way it could happen is if the pump had only 2 rollers instead of 3, but I don't think the pump would work at all if it had just 2 rollers.
It's got to be something else.
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing pump programming.

Post by lnevo »

I've seen reports of peristaltic pumps getting a siphon.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing pump programming.

Post by rimai »

lnevo wrote:I've seen reports of peristaltic pumps getting a siphon.
How is it possible?
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing pump programming.

Post by lnevo »

Maybe if the rollers don't pinch right and air gets through...maybe thats why its intermittent.

Siphon issues are easily fixed though by having the outlet higher than the level in the container. If need be it can feed into a length of pvc pipe into the sump as a siphon break. Or directly into the DT since head pressure isn't an issue for peristaltic pumps.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

rimai wrote:I'd like you to use hard coded to make sure it is not some memory settings error.
So, Try this code here:

Code: Select all

ReefAngel.DosingPumpRepeat(Port7,0,60,2);
ReefAngel.DosingPumpRepeat(Port8,5,60,2);
Can you visually see it??
I highly doubt that a peristaltic pump is siphoning.
They are mechanically designed to operate without siphoning and because they are designed this way, it is virtually impossible to siphon. If you look inside the head of the pump, you will see that there is always one roller pressing the tube and preventing it from siphoning. The only way it could happen is if the pump had only 2 rollers instead of 3, but I don't think the pump would work at all if it had just 2 rollers.
It's got to be something else.

Pretty sure I accomplished that by what I did already. Using the following code;

ReefAngel.DosingPumpRepeat(Port7,0,60,2);

ReefAngel.DosingPumpRepeat(Port8,5,60,2);
if (ReefAngel.Params.PH > 835)
ReefAngel.Relay.Off(Port8);

First day, Pump A on port 7, Pump B on port 8. Each pump drawing off of 3/4 gallon DI in separate jugs and discharging into a bucket so the head is the same on both.
- Pump A uses less than 1/4c. Pump B uses over 1/2 gallon.

Second day, Pump B on port 7, Pump A on port 8. Each pump drawing off of 3/4 gallon DI in separate jugs and discharging into a bucket so the head is the same on both.
- Pump A uses less than 1/4c. Pump B uses over 1/2 gallon.

Same result regardless of which port is used.

I've not seen it siphon.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing pump programming.

Post by rimai »

Well, you are biasing port7 by disabling port 8 when pH is high.
Can you just use the dosingpumprepeat functions?
When the pumps do pump, do they pump for 2 seconds only?
2 seconds every hour is very little. 1/2gallon seems so strange and I'm still having a hard time getting the idea of siphoning, but since Lee thinks that it is possible, I'd like to eliminate the siphoning out of the equation.
Can you place the bucket above the level of the jugs to test?
Roberto.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

Well, I've got "pump A" working on port 8 adding alk to my sump so, I'm going to leave that alone. I will continue to troubleshoot "pump B". I dissassembled the pumping head to inspect and didn't see anything of concern there. I was using some old tubing on it also. So, over the next few days I will; use the same tubing as on the one that works. (can't see how this could possibly matter but...). I will keep using port 7 to run it unconditionally. First I'll try to duplicate the original problem with the discharge below the source and if it still over-adds I'll raise the discharge above the source and see what happens then. Expect a report back later in the week.

Thanks for the help so far.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

I had to work late yesterday, but this morning before leaving for work, I set up the problem pump with the same tubing that I have on the one that works. I plugged it into a hot outlet to fill the tubing then plugged it into port 7.

Immediately I could see that it was siphoning.

There was a small air bubble in the discharge tube that was visible and it was moving right from the start. Steady drip drip drip out the end too. so, something must be out of spec. Either too much clearance between the rollers and housing or the tubing is too small I suppose. How do I go about getting it repaired or replaced? It is new.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing pump programming.

Post by rimai »

Send me a PM for RMA.
Roberto.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

rimai wrote:Send me a PM for RMA.
PM Sent.
waucedah_joe
Posts: 14
Joined: Wed Dec 25, 2013 3:45 pm

Re: Dosing pump programming.

Post by waucedah_joe »

I got the new pump head on Saturday and it works great! Thanks Roberto.

Now I'd like to switch the Dosing pump commands back to memory based but, again, have questions.

I guess the big question is, is there an index or reference detailing the defined memory parameters?

For instance, the parameters for hard coded dosing are; relay number, offset(minutes), interval(minutes) and duration(seconds). However when I use my android tablet "Internal Memory" page I see 4 parameters; Dosing Pump 1 Timer, Dosing Pump 1 On Hour, Dosing Pump On Minute and Dosing Pump 1 Repeat Interval. Right now I've got them hard coded to run 5 seconds, every 30 minutes, with a 5 minute offset on pump 2 but I'm confused as to where to store these values in memory. Just for fun, the apple app, in the memory section under Dosing Pump looks like; DP1 On:(xx):(yy) (zz), where (zz) has a column heading of interval. OK interval is straight foreword enough but what are xx and yy values for?

Again, if you can point me to a memory definition/map, I can probably answer the rest of my questions myself.

You'd probably never guess that I've got a degree in CS. Of course that was back in the days of Fortran ;-)

Thanks
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Dosing pump programming.

Post by binder »

The best answer for your questions is going to be this: look at the libraries (~/Documents/Arduino)
1. Check out the ReefAngel/ReefAngel.cpp file
2. Check out the ReefAngel/Globals.h file

The first one will show you how the "simplified" functions work. They just call the full functions with the proper internal memory locations.
The second one will show you what the memory locations are.
Post Reply