logging

Request new hardware or ideas for the controller

Posts: 7
Joined: Thu Dec 19, 2013 1:46 pm
PostPosted: Thu May 07, 2015 4:38 pm
I looked but couldnt find it. Is there something out there that will log each time my controller does a scheduled action. i have my dosers set up from the wizard but I dont know when they dose so if I can see a log of each action I can see when it doses.

Posts: 213
Joined: Mon Apr 01, 2013 7:58 pm
PostPosted: Fri May 08, 2015 1:00 am
You can check on the portal, problem is ir only logs in five minutes incriminates. So you generally wont see a doser because it doesnt run long enough. I do recall someone had a line of code that setup a fake relay that would be triggered every time a port a port was on and it would stay on long enough for it to be seen by the portal
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Sat May 09, 2015 5:29 am
Here you go.


Put this up top in the globals section.

Code: Select all
unsigned long LastUpdate1=0;   
unsigned long LastUpdate2=0;


Put this in loop.
Code: Select all
if (ReefAngel.Relay.Status(AlkPump) && LastUpdate1==0)
  {
    LastUpdate1 = now();
    ReefAngel.Relay.On (VirtAlk);
  }
  if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
  {
    LastUpdate1 = 0;
    ReefAngel.Relay.Off (VirtAlk);
  }
  if (ReefAngel.Relay.Status(CalPump) && LastUpdate2==0)
  {
    LastUpdate2 = now();
    ReefAngel.Relay.On (VirtCal);
  }
  if (now() - LastUpdate2 >= 300 && LastUpdate2 != 0)
  {
    LastUpdate2 = 0;
    ReefAngel.Relay.Off (VirtCal);
  }


Replace AlkPump and CalPump with the ports you are using to control your dosing pumps. Replace VirtAlk and VirtCal with ports on an expansion box you don't actually have, like Box2_Port1 and Box2_Port2 for the second expansion box. You can then look on the portal and these imaginary ports will show when your dosing pumps actuate.

--Colin
Last edited by cosmith71 on Sun May 10, 2015 6:03 am, edited 1 time in total.

Posts: 213
Joined: Mon Apr 01, 2013 7:58 pm
PostPosted: Sat May 09, 2015 9:41 pm
Cool bookmarking for later use
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Sun May 10, 2015 6:04 am
I edited my above post. I left out a section of code at the end. :oops:

--Colin

Posts: 7
Joined: Thu Dec 19, 2013 1:46 pm
PostPosted: Tue May 12, 2015 6:24 pm
Thanks, now how do I put it into the reef angel, lol. I'm a noob never messed with any coding just use the reef wizard.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu May 14, 2015 6:44 am
Sorry for the late reply, been busy with work.

In the Wizard generated code, you'll see a couple of lines like this near the top.

Code: Select all
////// Place global variable code below here


////// Place global variable code above here


Put the first two lines in between those two like this:

Code: Select all
////// Place global variable code below here

unsigned long LastUpdate1=0;   
unsigned long LastUpdate2=0;

////// Place global variable code above here


Farther down, in the void loop() section, you'll see these lines:

Code: Select all
////// Place your custom code below here
   

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


Put the rest of the code between them, like this:

Code: Select all
////// Place your custom code below here

if (ReefAngel.Relay.Status(AlkPump) && LastUpdate1==0)
  {
    LastUpdate1 = now();
    ReefAngel.Relay.On (VirtAlk);
  }
  if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
  {
    LastUpdate1 = 0;
    ReefAngel.Relay.Off (VirtAlk);
  }
  if (ReefAngel.Relay.Status(CalPump) && LastUpdate2==0)
  {
    LastUpdate2 = now();
    ReefAngel.Relay.On (VirtCal);
  }
  if (now() - LastUpdate2 >= 300 && LastUpdate2 != 0)
  {
    LastUpdate2 = 0;
    ReefAngel.Relay.Off (VirtCal);
  }
   

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


Now, you'll need to replace CalPump and AlkPump with the relay ports you have your dosing pumps on. Say if your calcium pump is plugged into port 1 on your relay box and your alkalinity pump is plugged into port 2, replace CalPump with Port1 and AlkPump with Port2.

Now replace VirtCal and VirtAlk with ports on another, non-existent expansion relay box. You can use Box2_Port1 and Box2_Port2 assuming you don't have 3 relay boxes (this would be the second expansion relay, or the third relay box in the system). If we're doing stuff with a port, the RA assumes it exists even if there is no hardware attached. So the software reacts even though nothing is happening in the real world.

What we're doing here is checking to see if the ports the pumps are plugged into are running, and if they are, turn on another port for 5 minutes so the portal can catch it (portal only updates every 5 minutes so it often misses short things like dosing pump activations). This will only show you that it activated at around a certain time. It won't show how long it ran.

--Colin
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu May 14, 2015 6:49 am
Here's a little tutorial on coding. It's not meant to make you a great programmer, but you'll at least have some idea of what you're looking at. :mrgreen:

viewtopic.php?f=14&t=3353

--Colin

Posts: 7
Joined: Thu Dec 19, 2013 1:46 pm
PostPosted: Thu May 14, 2015 3:21 pm
Thanks I'll give it a shot tonight and report back. I appreciate the help

Posts: 7
Joined: Thu Dec 19, 2013 1:46 pm
PostPosted: Fri May 15, 2015 8:51 pm
Well the code seems to load by the portal doesnt work for me, I've searched and tried all the suggestions but nothing
Next

Return to Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron