CO2Control - Relay on and Off all the time

Do you have a question on how to do something.
Ask in here.

Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil
PostPosted: Thu Jun 22, 2017 10:40 am
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
Image

Posts: 12272
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Jun 23, 2017 11:06 am
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);
Roberto.

Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil
PostPosted: Fri Jun 23, 2017 6:47 pm
Obrigado Roberto!

That's what I was thinking.

Best regards
Rafa
Image

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 2 guests

cron