Water Level Sensor controlling DC Return Pump

Expansion modules and attachments
Post Reply
jgsplat
Posts: 9
Joined: Mon Feb 03, 2014 9:28 am

Water Level Sensor controlling DC Return Pump

Post by jgsplat »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water Level Sensor controlling DC Return Pump

Post by rimai »

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: Select all

#define Level         50
#define MinPWM        50
long nummillis=5000;

byte PWMValue=0;
unsigned long lastmillis=millis();
boolean override=false;
Code inside loop():

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); 
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.
Roberto.
jgsplat
Posts: 9
Joined: Mon Feb 03, 2014 9:28 am

Re: Water Level Sensor controlling DC Return Pump

Post by jgsplat »

Great! Thanks Roberto!
Post Reply