HELP Dosing function use as a food timer on port 2

Requests for new functions or software apps
Post Reply
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

HELP Dosing function use as a food timer on port 2

Post by mikedizon »

First of all, Great products.
I have been using RA for years.

Now, I need a little help pls.
Im not a code maker I use the
wizard to get things done.

But this specific task I need help below.

As we all know we like to keep our fish
healthy all the time without over feeding
or polluting our tank.

so I decide to built and design a heavy duty
food timer. Basically the motor power is approx 4watts
and I have plug it using port 2. so far without any
permanent fish food yet. coz I need help to fix this
one major thing.

I used the wonderful wizard and select for
memory setting - Internal memory
then in Port 2 i used the function Dosing Pump.

This function turns on every 240 (m) for 2 (s).

This is great function. Except the problem is I
do not want it to dose at night from 8:30pm until 8:30am.
Because during this time some fish maybe sleeping
and my lights almost all dim and ready to be OFF.

Please let me know what code can
bypass the function during this specific
sleeping and wake up hour of the fish.
and resume running normal auto mode after 8:31am til 8:29pm

Note: The code I wish to use should not affect the options like change of setting during the day
feeding mins and seconds.

I wish still have the benefit of changing the two
the functions (mins and seconds) in my apps internal memory during the hours my lights are
on Auto mode. I have radion lights above my tank on a separate timer.

Do let me know were to insert this custom code you suggest so I can cut and past it
in my ino file.

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

Re: HELP Dosing function use as a food timer on port 2

Post by cosmith71 »

Put this line after your dosing pump code.

Code: Select all

  if ((hour()>19 && minute()>29) || (hour()<8 && minute()<30)) ReefAngel.Relay.Off(Port2); 
--Colin
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Instead of 19 for the hour I made it 20. I think this is what you mean.

Before I update my code. I got a question.

I wonder how does the internal clock run now.
Lets assume I set the function in the dosing pump for example
turns on every 180 (m) for 2 (s).

The internal timer should be ON after 8:31 AM and
does this means it will feed at 11am, 2:00pm, 5pm and 8pm. Is this correct.

if ((hour()>20 && minute()>29) || (hour()<8 && minute()<30)) ReefAngel.Relay.Off(Port2);
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: HELP Dosing function use as a food timer on port 2

Post by cosmith71 »

19 is correct. It states >19. If you make it 20, it won't shut off until 21. You could also change it to >=20.

Every 180 minutes means it will run every 3 hours with a base at midnight, so with this code it would be 0900, 1200, 1500, 1800.

--Colin
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Great! Thanks I will test it.
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Hi Colin,
Works exactly what is its suppose to do. I watch it different hours of the day by monitoring it during the time it is suppose to be ON and the time it is suppose to OFF and timing the seconds too.
Thanks lot!
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: HELP Dosing function use as a food timer on port 2

Post by cosmith71 »

You're welcome

--Colin
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Hi Colin,
I have another post in the forum I posted it in hardware request but I think it should be software.
Maybe you can help me over there.

Thanks
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Can anyone help me.

My DIY food timer is set using the Dosing function.

My problem is recently when i upgraded the RA STAR controller I began to experience negative effect.
When controller began to restarts or reboots itself automatically one day.
I was sleeping when it all began.

Port 2 is where I am connecting to my DIY FOOD TIMER. Its run by a RC SERVO.

What I ignored before and did not realise that can cause a crash was every time the RA STAR reboot or restarts I could here myDIY FOOD TIMER SPINS and stops. I taught this was ok. But if it happens to often this can be deadly.

What i need help is how to cut that short electricity from the relay when it RA STAR Reboot or restarts.

My tank almost crash because this erratic experience of this unstable on and off.

The RA STAR just one day started to go crazy. Kept on rebooting and restarting in the middle of the night til
early morning. I was still a sleep. When i woke up my entire tank was cloudy due to the uneaten pellets by my food timer spinning ON then OFF when ever the RA RESTARTS.

Anyway. Can anyone help me create a fail safe code.

I need a code that if the RA STAR Restarts or reboot. It will not throw electrical current in port 2.
The code should not remove the dosing function I set it with. Example If i set it to dose every 180 mins for 2 seconds, this function should still work.

The problem is this short electrical currents make my DIY Food timer spins when it sense this short surge power in the port then stops.


Thanks
MD
tngo
Posts: 131
Joined: Wed Apr 27, 2011 9:08 am

Re: HELP Dosing function use as a food timer on port 2

Post by tngo »

Although I'm not sure if this can be done in code as the RA reboots all the relays before running the code I think. What you can do is get a relay delay and set it to run say 10 sec after power is on to your feeder. You would just make the feeder run for 10 sec longer. This will prevent power from going to your feeder on any reboot.

tim
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

I think there must be another way. If I can have someone help me write a code to kill the power of port 2 for 5 sec only every time it reboot. This should work perfect. I dont want to risk having another device and later find out it starts to be unstable and end up almost crashing my tank. The best is kill the power for 5 sec after reboot. I hope someone can help me hack the system. Im sure this can be done. Only on 1 port not all the ports.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: HELP Dosing function use as a food timer on port 2

Post by rimai »

Try this:

Code: Select all

ReefAngel.DosingPumpRepeat( Box1_Port2,0,180,2 );
if (millis()<60000) ReefAngel.Relay.Off( Box1_Port2 );
Roberto.
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

sorry I tried the code it did not work.

ReefAngel.DosingPumpRepeat( Box1_Port2,0,180,2 );
if (millis()<60000) ReefAngel.Relay.Off( Box1_Port2 );

I Even tried increasing it to <1100000
and still did not work. It still turn, it must be powering port 2 cause if there is no power it should not turn.

I wonder whats going on
Im including the specification of my power supply below.

This is the spec of the DC power supply for my food timer.

INPUT AC100-240V 50/60hz
Output DC 5v 3A

Even if the RA now i believe is stable as I dont see it shutting OFF AND ON.

I firmly believe as a SAFETY FEATURE I need a code to keep the power not entering.
This port 2 which i am using with the food timer should not spin at all.

I almost crash my tank 2x, i wont sleep well at night if i now anytime it can happen again.
so for me this is very important that I get this code command not to give power on this particular port.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: HELP Dosing function use as a food timer on port 2

Post by rimai »

Can you post your code?
Roberto.
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

CHECK YOUR emailed.

Also You cannot instruct it not to feed at any time because it can sense electricity in the port.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: HELP Dosing function use as a food timer on port 2

Post by rimai »

Others can't see my email.
Roberto.
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

Ok I did not understand what you wanted me to do. Now I get it, you want me to post the code created by the wizard.
Last edited by mikedizon on Sat Jan 13, 2018 5:03 am, edited 1 time in total.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: HELP Dosing function use as a food timer on port 2

Post by rimai »

PMing me doesn't help.
Nobody can see it.
Roberto.
User avatar
mikedizon
Posts: 31
Joined: Fri May 04, 2012 10:13 am

Re: HELP Dosing function use as a food timer on port 2

Post by mikedizon »

#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_TS.h>
#include <RA_TouchLCD.h>
#include <RA_TFT.h>
#include <RA_TS.h>
#include <Font.h>
#include <RA_Wifi.h>
#include <RA_Wiznet5100.h>
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetDHCP.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_ATO.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 <RA_CustomLabels.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <PAR.h>
#include <DCPump.h>
#include <ReefAngel.h>
#include <SoftwareSerial.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.Star();
ReefAngel.AddSalinityExpansion(); // Salinity Expansion Module
ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = 0;
ReefAngel.FeedingModePortsE[1] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
ReefAngel.WaterChangePortsE[0] = 0;
ReefAngel.WaterChangePortsE[1] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
ReefAngel.OverheatShutoffPortsE[0] = 0;
ReefAngel.OverheatShutoffPortsE[1] = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
ReefAngel.LightsOnPortsE[0] = 0;
ReefAngel.LightsOnPortsE[1] = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 335 );

// Ports that are always on
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port3 );
ReefAngel.Relay.On( Box1_Port4 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );

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


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

void loop()
{
ReefAngel.DosingPumpRepeat( Box1_Port2,0,180,2 );
ReefAngel.StandardLights( Box1_Port6,10,30,14,0 );

boolean buzzer=false;
if ( ReefAngel.isOverheat() ) buzzer=true;
if ( ReefAngel.isBusLock() ) buzzer=true;
if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();

////// Place your custom code below here
if ((hour()>19 && minute()>29) || (hour()<8 && minute()<30)) ReefAngel.Relay.Off(Box1_Port2 );


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

ReefAngel.Network.Cloud();
// This should always be the last line
ReefAngel.ShowTouchInterface();
}



// RA_STRING1=U2FsdGVkX1+4VN0SJWgbihJGhrPoZNW48utW3/7MRgQ=
// RA_STRING2=U2FsdGVkX1+XHP8X+u5QIW7n+ZpRlTkBCSo6V2xVozs=
// RA_STRING3=Greenhouse
// RA_LABEL LABEL_ACTINIC=Actinic
// RA_LABEL LABEL_ACTINIC2=Actinic 2
// RA_LABEL LABEL_DAYLIGHT=Daylight
// RA_LABEL LABEL_DAYLIGHT2=Daylight 2
// RA_LABEL LABEL_PORT1=Port 1
// RA_LABEL LABEL_PORT11=Pump 1
// RA_LABEL LABEL_PORT12=Food Timer
// RA_LABEL LABEL_PORT13=Pump 2
// RA_LABEL LABEL_PORT14=Pump 3
// RA_LABEL LABEL_PORT15=Pump 4
// RA_LABEL LABEL_PORT16=Ozone
// RA_LABEL LABEL_PORT17=Skimmer 2
// RA_LABEL LABEL_PORT18=Skimmer 1
// RA_LABEL LABEL_PORT2=Port 2
// RA_LABEL LABEL_PORT21=Port 21
// RA_LABEL LABEL_PORT22=Port 22
// RA_LABEL LABEL_PORT23=Port 23
// RA_LABEL LABEL_PORT24=Port 24
// RA_LABEL LABEL_PORT25=Port 25
// RA_LABEL LABEL_PORT26=Port 26
// RA_LABEL LABEL_PORT27=Port 27
// RA_LABEL LABEL_PORT28=Port 28
// RA_LABEL LABEL_PORT3=Port 3
// RA_LABEL LABEL_PORT4=Port 4
// RA_LABEL LABEL_PORT5=Port 5
// RA_LABEL LABEL_PORT6=Port 6
// RA_LABEL LABEL_PORT7=Port 7
// RA_LABEL LABEL_PORT8=Port 8
Post Reply