Dosing Pump not running on Schedule

Do you have a question on how to do something.
Ask in here.
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Dosing Pump not running on Schedule

Post by kirkwood »

I am using port 3 for ALK and port 4 for CAL dosing pumps. In the Wizard I entered port 3 to run every 60 minutes for 120 seconds with 0 offset. On Port 4 I entered to run every 60 minutes for 120 seconds with a 30 minute offset.

The problem is that when I look at my relay history in the portal I only see ports 3 and 4 running properly for a 9 hour period where they will run their 120 seconds at the top of the hour and then at half past. But the rest of the day they do not trigger on/off. I haven't actually hooked up the dosing pumps yet so don't worry about my tank being out of whack. I want to make sure the relays are firing correctly before I put my 2part in the hands of the RA.

What am I missing?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

The portal only logs every 5 minutes.
If the pump turns on and off in between the 5 minute interval, you won't see it in the portal.
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: Dosing Pump not running on Schedule

Post by rossbryant1956 »

I tested this by setting the times to be long enough for the portal to catch them in its 5 minute window. Worked like a charm.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

rimai wrote:The portal only logs every 5 minutes.
If the pump turns on and off in between the 5 minute interval, you won't see it in the portal.

Ok. With that being the case I would expect to see a lot more randomness in when the portal logs the relay activity. Instead it logs consecutively on 9 runs of ports 3 and 4 and then it will not log for about 15 hours.

The most important aspect of the relay functionality in the Portal to me is to be able to monitor my dosing pump activity to ensure that it is running the specified amount of time each day to ensure that I am dosing the proper amount. After overheat control, this is the 2nd most important function that my RA controls.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

You would have to make the running time longer than 5 minutes if you want it to show in the relay activity 100% of the time.
Or, you could code an expansion outlet port to be triggered on dosing pump port, but it would stay on for more than 5 minutes.
Roberto.
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

rimai wrote:You would have to make the running time longer than 5 minutes if you want it to show in the relay activity 100% of the time.
Or, you could code an expansion outlet port to be triggered on dosing pump port, but it would stay on for more than 5 minutes.
The RA Wizard only allows you to enter a MAXIMUM of 255 seconds of run time. How do i make it run for over 300 seconds?

I just generated the code in the Wizard and manually changed 255 to 340. It worked. Now I will monitor to see if the relays fire every 2 hours.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Dosing Pump not running on Schedule

Post by lnevo »

I bet we can use a few custom variables to log the hour when the dosing pump goes on and the minute when the pump goes off. Then you can graph those values instead of the relay and have them be more persistent then the relay status.

How does that sound?
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

lnevo wrote:I bet we can use a few custom variables to log the hour when the dosing pump goes on and the minute when the pump goes off. Then you can graph those values instead of the relay and have them be more persistent then the relay status.

How does that sound?
After temperature control, managing my dosing pumps is the second most critical issue for my RA to control. So any feature that can be added that would allow me to see the port pumps operating for the specified amount of time on every cycle is greatly appreciated.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing Pump not running on Schedule

Post by lnevo »

Ok, so here's some code that will use two of the CustomVar variables (per pump) to report to the portal. Since the variables are byte and can only hold 0-255, I am using one to store minutes and the other to store seconds that the pump is running. The numbers reset at midnight. You can then use the portal to chart the variables. You should see them increment on your schedule and at the end of the day the total number of minutes / seconds should be viewable to see what the total was.

We could also use memory locations to store and then we could store an int. You would lose the graphing capabilities, unless you did something on your own, but it would store the variables if the controller reboots and we could use one location and store total seconds run for the day. For ease of use, this is probably your easiest bet for now.

The URL to use to chart the variables would be:

http://forum.reefangel.com/status/chart ... &filter=c0
http://forum.reefangel.com/status/chart ... &filter=c1
http://forum.reefangel.com/status/chart ... &filter=c2
http://forum.reefangel.com/status/chart ... &filter=c3

Below is the code to log both pumps to the first four variable locations. Change DPump1 and DPump2 to the relays you use for your pumps.

Code: Select all

  
static time_t running1, running2;

  // Reset the counter each day
  if (now()%SECS_PER_DAY==0) {
    running1=0;
    running2=0;
  }  
  
  // If the Dosing Pump 1 is on and it's a new second...
  if (ReefAngel.Relay.Status(DPump1) && (millis()%1000==0)) {
    running1++; // increment the counter;
  }

  // If the Dosing Pump is on and it's a new second...
  if (ReefAngel.Relay.Status(DPump2) && (millis()%1000==0)) {
    running2++; // increment the counter;
  }
  
  // Normalize and assign to CustomVar for reporting on the portal
  ReefAngel.CustomVar[0]=running1/60; // Number of Minutes for DPump1
  ReefAngel.CustomVar[1]=running1%60; // Number of Seconds for DPump1
  ReefAngel.CustomVar[2]=running2/60; // Number of Minutes for DPump2
  ReefAngel.CustomVar[3]=running2%60; // Number of Seconds for DPump2
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

Inevo,

Thank you very much for your input. I really like where you are going with this. Reporting a cumulative log on the number of minutes that my dosing pumps run is very helpful. Taking this one step further, if I know my pump doses 1.1ml per minute could we add in the simple math and instead of producing minutes run produce mililiters dosed?

Also, is it possible to integrate into the RA Main Screen a daily running tally of MLs dosed per pump? I don't have dimmable LEDs nor powerheads so I have some room on my RA Display to show some other data. I haven't seen anyone compliling daily ALK and CAL data on the main screen so it would be cool to go a different direction with it.

Where do I paste the code you provided?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Dosing Pump not running on Schedule

Post by lnevo »

You can paste the code in the loop section where the comments say put custom code below this line and above the line that says put custom code above here.

As far as tracking and displaying on main screen that should be pretty straight forward.

Let me look at it a little later and I can give you something to work with. I'm assuming you've already done some custom main programming and have an understanding of that aspect?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing Pump not running on Schedule

Post by lnevo »

Ok, try this...

Move this section above the setup where it says to put global code here...

Code: Select all

  
////// Place global variable code below here
time_t running1, running2;
You can leave this section in your loop();

Code: Select all

  // Reset the counter each day
  if (now()%SECS_PER_DAY==0) {
    running1=0;
    running2=0;
  }  
  
  // If the Dosing Pump 1 is on and it's a new second...
  if (ReefAngel.Relay.Status(DPump1) && (millis()%1000==0)) {
    running1++; // increment the counter;
  }

  // If the Dosing Pump is on and it's a new second...
  if (ReefAngel.Relay.Status(DPump2) && (millis()%1000==0)) {
    running2++; // increment the counter;
  }
  
  // Normalize and assign to CustomVar for reporting on the portal
  ReefAngel.CustomVar[0]=running1/60; // Number of Minutes for DPump1
  ReefAngel.CustomVar[1]=running1%60; // Number of Seconds for DPump1
  ReefAngel.CustomVar[2]=running2/60; // Number of Minutes for DPump2
  ReefAngel.CustomVar[3]=running2%60; // Number of Seconds for DPump2
You can now access running1 and running2 in your CustomMain function. If you want minutes and seconds look at the CustomVar assignments for how to do that, otherwise you could just display total seconds of running.

As far as ml, I'll try and get some time to do that later... I'm actually working on some code to store my calibration number and use a ml setting instead of second setting to distribute the amount throughout the day automatically.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing Pump not running on Schedule

Post by lnevo »

For the record, the conversion from seconds to ml with a 1.1ml dosing pump should be

ml = .0184 * seconds

That's assuming the pump is accurate. What I plan on doing is using my calibrate routing to run my pumps for 10 minutes each. At then end of 10 minutes, I will have X ml. I am planning on taking that number and putting it into a memory location. Then, take that number and divide it by 600. Whatever number that will be will be my "ml/second", which would be .0184 if we're accurate :)

Now I can take the number of ml I want to dose...let's say 30ml / day. I'll put that number into a memory location and then I'll take that number and divide it by the ml/second number above and then divide it by 24 doses. That should give me the amount to dose each increment.

So... 11 ml in 10 minutes = .01834 ml/seconds.

30ml/day / .01834 = 1635 seconds / 24 = ~68 seconds per dosage = ~1.25 ml/dosage

Now if I want to increase the dosage by 1ml, I can just update the memory location for that dosing pump and it should do the math for me.

I have yet to put this into code, but I was testing the math so I figured I could use it.

Now if you want to just go with the .01834 (it's really .018333333) you can take the running1 and running2 variables and multiply them by the .01834 to get the total number of ml you've dosed and display that on the screen.

Here's an example.
ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor,x,y,running1*.0834);

It may be easier to use the DrawSingleMonitor, but I wasn't sure on the conversion.. Either way, need to play around with it.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

Hey Lee,
It's hard for anyone to measure ml over 10 minute run.
Can you do something easier?
Like how long does it take to fill up 8oz? And then have the math do the rest?
With the upcoming dosing pump hub module, I plan on adding the additional memory locations for DP4 through DP8.
It would be cool if we had calibration mem locations for each of the 8 too :)
That would mean, the function would need to request which pump you are calibration.
What do you think?
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Dosing Pump not running on Schedule

Post by lnevo »

Well i wrote a function to do a 10minute calibration...the problem with doing a measure of liquid is that one you have to be accurate and dose into something that can hold the measure and then you have to watch it...

Over time is much easier for us to code for and requires no human intervention to time and stop it. Once the function is complete simply measure the amount of liquid and plug it in...

I could make it a bit more flexible, but let me know if we're at least on the same page now.

It would be great to program by ml in the portal :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

How would I measure it?
I was just thinking on easy accessible measuring tools. I have a 1cup measurement in the kitchen...lol
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Dosing Pump not running on Schedule

Post by lnevo »

When you get the dosing kit from BRS, it comes with graduated measuring cups. How would you dose manually if not using a doser?

Your kitchen 1 cup measuring cup would be fine to measure with as long as it's got smaller measurements to see what the actual amount is.

You could also weigh it and convert grams to ml. (1 gram of water = 1 ml) using a kitchen scale.

You could do a total liquid volume based calibration also I guess. It's really what's easier which I think would be up to each persons installation and circumstance.

The reason I went with the 10 minutes was because the BRS doser suggested that in the directions. 10 minutes is easy to divide to find out ml/minute. It's also a larger number than the 1.1ml/minute which could vary more and be harder to find out your actual rate if you only do a short calibration.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Dosing Pump not running on Schedule

Post by cosmith71 »

Doesn't everyone have lots of syringes laying around? No? Just me? :?

My Reef Angel pumps dose at 0.6 ml/sec and 0.58 ml/sec. I built that into my dosing code, although not as fancy as Lee's idea.

--Colin
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

cosmith71 wrote:Doesn't everyone have lots of syringes laying around? No? Just me? :?

My Reef Angel pumps dose at 0.6 ml/sec and 0.58 ml/sec. I built that into my dosing code, although not as fancy as Lee's idea.

--Colin
syringes are a god send when it comes to dosing. I've been using a 60ml syringe for dosing for the past year.

Medical tubing kits are the best. Love the IV for drip acclimation. Pinpoint control. Luckily I married into the medical field.
Image
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

lnevo wrote:You can paste the code in the loop section where the comments say put custom code below this line and above the line that says put custom code above here.

As far as tracking and displaying on main screen that should be pretty straight forward.

Let me look at it a little later and I can give you something to work with. I'm assuming you've already done some custom main programming and have an understanding of that aspect?

I've had the RA up and running for 1 week. So this is my first take at custom coding. I will try to learn fast.
Image
kirkwood
Posts: 173
Joined: Mon Apr 29, 2013 6:50 am

Re: Dosing Pump not running on Schedule

Post by kirkwood »

Inevo,

I loaded in the code you posted. Where do I find the data it is tallying? I don't know what the "Custom main function" is.

thanks
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Dosing Pump not running on Schedule

Post by cosmith71 »

rimai wrote: Or, you could code an expansion outlet port to be triggered on dosing pump port, but it would stay on for more than 5 minutes.
How might this be coded? Using an actual port, or a virtual one?

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

Re: Dosing Pump not running on Schedule

Post by rimai »

kirkwood wrote:Inevo,

I loaded in the code you posted. Where do I find the data it is tallying? I don't know what the "Custom main function" is.

thanks
Take a look at this thread about Custom Main screens:
http://forum.reefangel.com/viewtopic.php?f=14&t=109

Basically a way to create your own screen
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

cosmith71 wrote:
rimai wrote: Or, you could code an expansion outlet port to be triggered on dosing pump port, but it would stay on for more than 5 minutes.
How might this be coded? Using an actual port, or a virtual one?

--Colin
It's actually an actual port, but could be considered as virtual, because you are using a port from a relay box that you don't have the physical box itself.
For example, if you code anything for Box1_Port1, it will use port1 of the expansion box 1, but if you don't have that physical box, nothing will be turned on/off, but as far as the controller is concerned, it is treating as if it was there.
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Dosing Pump not running on Schedule

Post by cosmith71 »

rimai wrote:
cosmith71 wrote:
rimai wrote: Or, you could code an expansion outlet port to be triggered on dosing pump port, but it would stay on for more than 5 minutes.
How might this be coded? Using an actual port, or a virtual one?

--Colin
It's actually an actual port, but could be considered as virtual, because you are using a port from a relay box that you don't have the physical box itself.
For example, if you code anything for Box1_Port1, it will use port1 of the expansion box 1, but if you don't have that physical box, nothing will be turned on/off, but as far as the controller is concerned, it is treating as if it was there.
OK, got that part. Is there an easy way to turn on a port for a specified amount of time?

if (ReefAngel.Relay.Status(AlkPump))
{ Turn on another port for 5 minutes } // not sure what this functinon would be

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

Re: Dosing Pump not running on Schedule

Post by rimai »

The easy way to do without having to declare new variables is to use the timers, but we only have 2 available.
Timer[1] and Timer[2].
The other option is to declare a new global variable that holds the time the change has happened.
Something like this:

Code: Select all

unsigned long LastUpdate=0;
..
..
..
void loop()
{
  if (ReefAngel.Relay.Status(AlkPump) && LastUpdate==0) 
  {
    LastUpdate=now();
  }
  if (now()-LastUpdate>=300 && LastUpdate!=0)
  {
    LastUpdate=0;
    // Do something;
  }
}
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Dosing Pump not running on Schedule

Post by cosmith71 »

It's too late at night for me to wrap my head around this. I think I have the tools I need. I'll work on it Monday when I'm off again. I think it'll be a fun project for me. :mrgreen:

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

Dosing Pump not running on Schedule

Post by lnevo »

Roberto,

What were you thinking on how to instantiate 8 different calibrations? From a menu? What would you use to pass in which relay we were calibrating?

The function I wrote does my two pumps at the same time.

Just trying to figure out how the interaction would work.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dosing Pump not running on Schedule

Post by rimai »

I didn't think of anything :(
I've been focusing on the touch unit and the upcoming products... sorry...
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Dosing Pump not running on Schedule

Post by cosmith71 »

Roberto, how does now() work? What does it return?

Thanks,

--Colin
Post Reply