Can I please see some coded examples of anyone who uses the water level expansion module to adjust your DC return pumps control line via the dimming module?
Roberto I know you do this. Can you post some code please?
Thanks!
Josh
Water Level Sensor controlling DC Return Pump
Re: Water Level Sensor controlling DC Return Pump
This is what I started with....
http://forum.reefangel.com/viewtopic.php?p=28750#p28750
Eventually I migrated that code into my controller and used the dimming expansion to change the pump speed.
Here is the code:
Variables to declare
Code inside loop():
I also have a mechanical float switch in series with the jebao cable that cuts off the dimming signal to the pump in case of blockage in the drain pipe.
When there is a blockage in the drain pipe, the level rises too fast for the sensor to instruct the pump to turn off.
http://forum.reefangel.com/viewtopic.php?p=28750#p28750
Eventually I migrated that code into my controller and used the dimming expansion to change the pump speed.
Here is the code:
Variables to declare
Code: Select all
#define Level 50
#define MinPWM 50
long nummillis=5000;
byte PWMValue=0;
unsigned long lastmillis=millis();
boolean override=false;
Code: Select all
PWMValue=InternalMemory.PWMSlopeEnd0_read();
if (ReefAngel.WaterLevel.GetLevel(1)<Level-2)
{
override=true;
lastmillis=millis();
PWMValue+=2;
}
if (ReefAngel.WaterLevel.GetLevel(1)>Level+2)
{
override=true;
lastmillis=millis();
PWMValue-=2;
}
if (millis()-lastmillis>nummillis && override)
{
override=false;
}
if (!override) PWMValue=InternalMemory.PWMSlopeEnd0_read();
if (ReefAngel.WaterLevel.GetLevel(1)>Level+10) PWMValue=MinPWM;
PWMValue=constrain(PWMValue,MinPWM,100);
if (ReefAngel.DisplayedMenu==FEEDING_MODE)
ReefAngel.PWM.SetChannel(ReturnPWM,45);
else
ReefAngel.PWM.SetChannel(ReturnPWM,PWMValue);
When there is a blockage in the drain pipe, the level rises too fast for the sensor to instruct the pump to turn off.
Roberto.
Re: Water Level Sensor controlling DC Return Pump
Great! Thanks Roberto!