Float switches in parallel

Basic / Standard Reef Angel hardware
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Float switches in parallel

Post by lnevo »

Any issue with wiring up my two float switches in parallel? So both will be inactive during normal operation. If either one triggers (water too low or water too high) then I'm going to shut down the return pump.

However, if I'm in Water change mode, I'm going to switch the relay and ATO port into a SingleATO, and then start up a drain pump for X seconds to fill a bucket. This should automate my water change routine. I'm going to re-use my reactor pump to redirect it's output to my drain bucket and get the benefit of automated and continuous water change and media rinsing :)

I can set the level of the float to just a bit over where my water level is when the skimmer and reactor are off. This way it doesn't trigger if doing other maintenance and then during water change, it'll be ready to start topping off as I drain, keeping the level just about the same.

The reason for putting them into parallel is because I'm getting the Avast Marine skimmate locker which has a ReefAngel connector to plug right into the ATO port. I will use this one to disable the skimmer if that gets full :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Float switches in parallel

Post by rimai »

No problem at all :)
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

Sweet.. I'm ramping up for a huge PDE change very soon...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Float switches in parallel

Post by lnevo »

Here's my code for my continuous automatic water change...

This assumes that my reactor port gets overridden during WC mode. If you have dedicated pump, you'll want to use Relay.On/Off instead of the bitSet/bitClear

Code: Select all

  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    // Start automatic water change here.
    ReefAngel.SingleATOLow(Extension); // maintain water level from new SW bucket
    
    // Find out if we are ready to start
    wcReady=InternalMemory.read(Mem_B_WaterChange); // Trigger to start
    wcFillTime=InternalMemory.read_int(Mem_I_WCFillTime);
    if(wcReady) {
      wcTimer.SetInterval(wcFillTime); // One bucket at a time :)
      wcTimer.Start(); 
      bitSet(ReefAngel.Relay.RelayMaskOff,Reactor-1);  // Start draining
      if(wcTimer.IsTriggered()) {
        InternalMemory.write(Mem_B_WaterChange, 0);
        bitSet(ReefAngel.Relay.RelayMaskOff,Reactor-1); // Stop draining
      }
    }
  }
Is it this easy? Am I missing something?
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: Float switches in parallel

Post by rossbryant1956 »

Man, Lee; you kill me.

Here I am floating along behind you, grabbing your code to use what I like and need; and you keep coming up with stuff. I am having trouble keeping up.

Anyway, thanks from me and I'm sure, the rest of the community for your help and ideas.

Roscoe
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Float switches in parallel

Post by lnevo »

No problem. Glad the code can help you! The beauty of open source!

Just keep in mind this block of code is not yet tested, nor is my tidal simulation...it does compile though :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

Ok, just did my first automated water change today. The process worked as expected. I did have to make some changes to the code. I also had to invert the SingleATO function until I can flip my high ato switch around. The biggest problem was the code as written continuously restarted the timer. Here's the modified block below:

Code: Select all

  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    // Start automatic water change here.
    ReefAngel.SingleATOHigh(Extension); // refill from SW bucket

    wcReady=InternalMemory.read(Mem_B_WaterChange); // Trigger to start
    wcFillTime=InternalMemory.read_int(Mem_I_WCFillTime); 
    // Let's get started
    if(wcReady) {
      wcTimer.SetInterval(wcFillTime); // One bucket at a time
      wcTimer.Start();
      InternalMemory.write(Mem_B_WaterChange, 0);
      bitSet(ReefAngel.Relay.RelayMaskOff,Reactor-1); // Start draining
    } 
    if(wcTimer.IsTriggered()) {
      bitClear(ReefAngel.Relay.RelayMaskOff,Reactor-1); // Stop draining
    }    
  }
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

So, I'll have to post my latest code for this, but I changed 15 gallons tonight using this setup and it went the smoothest water change ever.

My parameters hardly moved. Only 0.3 degrees in my sump, no change to display. PH swung a little tiny bit +/- .04.

My fill time was set for 240 seconds. All I had to do was swap the drain bucket, refill the sw bucket and stsrt over, while thats going I go dump the previous drain bucket, rinse and repeat.

I took a video also, I have to figure out how to upload it now..
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Float switches in parallel

Post by lnevo »

So I decided I will wire my switches to a barrier strip so I can wire them up in series or parallel. I'm not yet sure how I want to configure this yet and I figure this way I'll have some flexibility. I have the code in place to leave my switches as-is and use the RevereATO functionality to make them behave as if I flipped the magnet on the switches. If I do this, then I can wire them in parallel. If I decide to flip the magnets I'll have to change the wiring to putting them in series. Anyway, when my swabbie and skimmate locker get here I'll be loading my new code and changing the wiring. Will have a lot of testing to do for sure... I've made a lot of changes!

Anyway, did another automated water change and this was definitely one of the best pieces of code ever. It has made water changes a breeze and I can walk away and get things done as the water is changing and no need to keep a constant watch. I wish I had permanent plumbing in place that I could set this up on a constant basis. Goals for a future build for sure! The other benefit that's been nice is negligible parameter changes. Love the stability I'm getting changing water this way.

I was got to post the current code I've got going but I won't be testing it till this stuff comes in so it's going to have to wait a little longer...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

Ok, with the release of 1.0.5 and a day off to go to the dentist, I'm finally able to do some updates. I currently have my relay boxes out of the stand and ready to plug in all my new goodies (swabbie, dosing pumps, and auto-feeder). So, now I have my new code ready to go, I had to tackle the wiring for my float switches.

So the switches are left configured by the default (in always off position. I will be using the code I wrote to "reverse" them in my code. You could easily do the same thing by flipping the switches and/or reversing the float part. Since they are wired in parallel, if any switch goes on, it will close the circuit. Since the ATO function requires the switch to be ON when the water level is OK, I had to change the software to match.

My low switch is currently at the "min" level of my sump. If the water drops below that it means I left the valve to my ATO reservoir closed and we're out of water... or something else drastic has happened. The high switch is wired just above my water line when my skimmer is off. This way if my skimmer goes off, it does not trigger the return pump to go off.

Now, in my auto-water change mode, I use the high switch turning on/off to control my new water being added to the sump. I redirect my reactors to the drain (I use a bucket) and while the reactors are running the high controls the water being refilled.

Anywhere, here's the wiring I did to have both switches wired in parallel. If it doesn't work out, I can redo the jumpers and wire it up in series.
Attachments
Mounted on door with RA and switches hooked up
Mounted on door with RA and switches hooked up
IMG_0949.jpg (165.6 KiB) Viewed 6440 times
Barrier strip with jumper cable for parallel wiring
Barrier strip with jumper cable for parallel wiring
IMG_0948.JPG (163.3 KiB) Viewed 6440 times
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

All my code is working as expected :)

Lot of changes... the big news is the ReverseATOHigh() and ReverseATOLow() are working as expected! So is my port locking :)
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

Was wandering if it were possible to make 2 of my expansion plugs act like a timer to come on say every other day for say 1 minute at a set time and the second plug come on for 1 minute as soon as the other plug goes off? Thinking of an almost every other day small water change if possible using 2 pumps i.e. 1 pump in sump come on for say a minute draining water then when that pump shuts off have other pump in resevoir of new saltwater come on immediatly after first one shuts off and it run for same amount of time?
How could this be coded? I will send you a copy & paste of my current code if needed.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

You can look at sacohen's INO.

He does similar every 6 hours where one pump does 20 minutes and then the next does 20 minutes. Its for a denitrator but the idea is the same.

The other method is to have one pump drain while another pump acts like an ATO but with saltwater during that time. Thats essentially what i do in my INO but its not automated.

From what you describe you could easily use sacohen's code just need to change duration and the offset between the pumps.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

Lee did a great job working out the code for my Denitrator.

One port (the pump to exchange the water) comes on for 20 min when it is done the the other port (The doser) comes on for 20 min.

It should work for your project too.

A link to my code is in my signature.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Float switches in parallel

Post by lnevo »

Roberto and others helped with that algorithm on the 20minutes for each pump.

My credit goes to deciphering it and finding the big oopsie preventing our ATO disabling during the process... :)
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

True. Sorry. :(
Yes. Lee, Roberto and Collin were the main ones that helped me with it.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

Well lnevo, I need help deciphering my brain that was trying to decipher all that code.......lol
It makes a lil sense to me, but seems like alot for just wanting an outlet to come on say for 2 minutes and immediatley when that outlet shuts off a second out comes on for 2 minutes, only happening once every 36hrs.
what if say i wanted to use the high ato float to be used to turn off second outlet off once tripped rather than putting a time limit on it, and would then only need it to disable my topoff port for say 10 minutes while this event happens once every 36hrs. Currently my topoff is set to only run 1/hr with a max on time of 1 minute.
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

This is the code for the outlet.

Code: Select all

  // Pump comes on first
  ReefAngel.Relay.Set(DeNit_Pump,(now()-3600)%129600<120);       // Runs for 120s every 129600 seconds (or 36 Hrs) 
  // Doser comes on second
  ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-120)%129600<120); // Runs for 120s every 129600 (or 36 Hrs) seconds with 120s offset
  
I'm not sure how to add the code to turn it off with the ATO
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

Do I need this line in the code as well in the code?

// DeNitrate Routine
int DeNit_Offset=3600;
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=1200;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;
Image
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

Ok, added this in and I get an error when I try to verify.....
Attachments
errar.jpg
errar.jpg (55.07 KiB) Viewed 5125 times
Image
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

Ok think I may have it, going to try to attach my code in this post for someone to check. How could I load this code and test run it, if I dont know exactly what time Box1_Port5 & Box1_Port6 is set to start?
Attachments
WATERXCHANGE.ino
(17.07 KiB) Downloaded 340 times
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

Try this...

Code: Select all

  // Water Exchange Routine
  int Box1_Port5_Offset=3600;
  int Box1_Port5_Runtime=129600;
  int Box1_Port6_Offset=120;
  int Box1_Port6_Runtime=120;

  // Box1_Port5 comes on first
  ReefAngel.Relay.Set(Box1_Port5,(now()-3600)%129600<120);       // Runs for 120s every 36 Hours  
  // Box1_Port6 comes on second
  ReefAngel.Relay.Set(Box1_Port6,((now()-3600)-1200)%121900<1200); // Runs for 120s every 36 Hours with 120s offset
I just compiled it and got no errors.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

Unless I'm wrong it should come on at 1pm tomorrow.
The (now()-3600 sets it to 1am in the morning and then the 36 hour delay would make it 1pm tomorrow.

What time do you want it to come on?
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

1pm will be fine. Is there anyway that the current code I am running can be pulled from the controller back to the computer where it can be edited.....lol I have done so many codes I currently dont remember wich code i am running....lmao!!!
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

Nope. It's uploaded as an executable.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

No there is not.
I know the feeling. :)
I always make a copy of my "Working Code" before I start trying to implement something new.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Float switches in parallel

Post by CASPAR »

It I believe is the code I posted earlier, just have to go back and look at my % for my leds, as well as colors I used for my ATO. My current ATO is set to only run for a maximum of 90sec per hr. Is there away I can disable the ATO while controller is calling for the WaterExchange function for say 10minutes during the waterexchange function is active?
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Float switches in parallel

Post by Sacohen »

This line disables mine for 5 min after my 20 min water exchange.

Code: Select all

// Disable ATO
if ( (now()-3600)%21600<1500) ReefAngel.WaterLevelATO(ATO_Pump,720,0,1);
I think yours would be like this...

Code: Select all

// Disable ATO
if ( (now()-3600)%21600<1500) ReefAngel.SingleATO( true,Port3,90,0 );
I'm not 100% sure. I haven't worked with the Single ATO.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

You have to adjust the time algorithm part to match the pump you are starting the disable (1st or 2nd?) and then the <1500 would change to how long you want it disabled.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Float switches in parallel

Post by lnevo »

And you cant use the singlato function like we did to fake out your waterlevelato. I think you'll have to put a relay.off and reset the timeout at the end of the operation.
Post Reply