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
CO2Control - Relay on and Off all the time
-
- Posts: 133
- Joined: Sun Mar 09, 2014 11:01 am
- Location: Santos - Brazil
Re: CO2Control - Relay on and Off all the time
You would have to create your own code.
Maybe something like this:
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);
Roberto.
-
- Posts: 133
- Joined: Sun Mar 09, 2014 11:01 am
- Location: Santos - Brazil
Re: CO2Control - Relay on and Off all the time
Obrigado Roberto!
That's what I was thinking.
Best regards
Rafa
That's what I was thinking.
Best regards
Rafa