Page 1 of 1

CO2Control - Relay on and Off all the time

Posted: Thu Jun 22, 2017 10:40 am
by rrodriguess
Hi there

I use the code ReefAngel.CO2Control(Port1,620,650); to control a solenoid valve attached to a CO2 cilinder.

The problem is that the PH reading fluctuat a little bit, so the Port1 relay keep's getting On and Off in matter of seconds. I am afraid it can damage the solenoid valve.

Is there a way to prevent that from happening? I dont know.. maybe after X seconds above 650 just then get relay On.

Best regards
Rafa

Re: CO2Control - Relay on and Off all the time

Posted: Fri Jun 23, 2017 11:06 am
by rimai
You would have to create your own code.
Maybe something like this:

Code: Select all

static unsigned long lastmillis=millis();
static enablesolenoid=false;
if (ReefAngel.Params.PH>650 && !enablesolenoid)
{
  enablesolenoid=true;
  lastmillis=millis();
}
if (ReefAngel.Params.PH<620) enablesolenoid=false;
ReefAngel.Relay.Set(Port1,enablesolenoid);
if (millis()-lastmillis<5000) ReefAngel.Relay.Off(Port1);

Re: CO2Control - Relay on and Off all the time

Posted: Fri Jun 23, 2017 6:47 pm
by rrodriguess
Obrigado Roberto!

That's what I was thinking.

Best regards
Rafa