My Neptune Apex web interface compatible DIY reef controller

d0ughb0y,

Thanks for testing but I must have something else wrong. Both on my test unit and the one I have running with pump in my hand does this:

You close ato switch and status of ato changes, and state of outlet changes without any delays. You open switch and state of ato changes and outlet changes without delays. My frag unit, I verified the pump state is as described.

And if you reset the unit the ATO runs for 1 min before it turns off after it boots.

It is impossible for the same code to work differently on another setup, so you have modifications to your code that is doing this.

After a reboot, the ATO outlet can only turn on if checkATO was executed and will turn on only if the float switch is open. checkATO will not get executed until after a full minute. So what you are describing is impossible to happen if you are running the same code as I am (with only the checkATO change).

I suggest you get the latest code, and only change the checkATO part in outlethandlerB, and you will see it will work. No need to copy the complicated apex algorithm, it really does not improve anything.
 
It is impossible for the same code to work differently on another setup, so you have modifications to your code that is doing this.

After a reboot, the ATO outlet can only turn on if checkATO was executed and will turn on only if the float switch is open. checkATO will not get executed until after a full minute. So what you are describing is impossible to happen if you are running the same code as I am (with only the checkATO change).

I suggest you get the latest code, and only change the checkATO part in outlethandlerB, and you will see it will work. No need to copy the complicated apex algorithm, it really does not improve anything.

The only modification I made was remove the ATO1 check because I only have one float. My frag is an older version but my test unit I downloaded code a few days ago. I just power reset that unit and status of Outlet 5 which is my ATO remained on for exactly 1 min after boot complete and I don't even have a float hooked up to it right now. I am running inverted outlets because I use the unmodded chauvet. If you look over my outlets.ino I sent you will see the mod I made to checkATO. It could be related to the fact that when I power reset my unit when it powers up my lights and other come on then go off. Maybe the ATO is doing the same but doesn't go off for 1 min.
 
It's definitely related to INVERTED. I just changed that and reloaded code and it works. I changed it back to INVERTED and it doesn't.

FYI, The boot state of the outlets is also different when only changing that value. :debi:
 
Last edited:
I just updated github. There indeed was a bug in inverted option in outlet initialization.
I fixed it so now you define inverted option if you are using uln2803.

as to reading the float switch 1 minute later, I don't think that will make any difference.

if your float switch bobs up and down and it is in the borderline level, then there is a 50/50 chance you get an open/close reading. Reading it one minute later, the probability is exactly the same. If the float switch reading is closed (regardless if this was correct or not), it will turn on the ATO pump for 1 minute. This will then result in the float switch to be in open state and the ATO pump will be turned off. So I think simply checking once a minute will fix the turbulence issue and is a lot simpler than the apex approach.
 
d0ughb0y,

I am running the updated code. Boot looks good. But for whatever reason...the counter does not work when INVERTED is optioned. When I comment out INVERTED the delay works fine. Why would checkATO care if outlets are INVERTED?
 
d0ughb0y,

the other option you gave me secnow==0......that works on my test unit. I will load on my frag and see the performance.

Thanks
 
I think it is better if you use the code

Code:
if (secnow==0)
checkATO();

What is happening using the counter is, the counter increments every second. It could be at 59,then you pull out the float switch, then at 60 it will checkATO and turn on the ATO pump, so it appears that it does not work. However, the pump will remain on for 1 minute before checkATO is called again and the pump will turn off.

If you use secnow, checkATO will always be called at the top of the minute. This way you know exactly when you pump will turn on or off, it always will happen at the top of the minute only. But just the same, if you pull out the float switch at 59 seconds past the minute, it will turn on the ato pump in 1 second. But the pump will remain on for the full minute.

I just verified this to work.
 
The second option works as you stated. The first option I could only get working when the outlet was not set inverted. When inverted was optioned the outlet came on immediately did not see counter delay. No matter second option should fix my on/off issues. Will test on my tank. Thanks for all the help working through this.
 
I am still have problems with the inverted. Now my lights that I had defined don't function in auto. This is how I had it set up. I can manually turn them on and off but no auto. The ATO works with the changes.

#define OUTLETSDEFAULT {{OUTLET1,0,0,0,EVERYDAY,_auto},\
{OUTLET2,0,0,0,EVERYDAY,_auto},\
{OUTLET3,32400,32400,21600,EVERYDAY,_auto},\
{OUTLET4,36000,25200,25200,EVERYDAY,_auto},\
{OUTLET5,0,0,0,EVERYDAY,_auto},\
{OUTLET6,0,0,0,EVERYDAY,_auto},\
{OUTLET7,0,0,0,EVERYDAY,_auto},\
{OUTLET8,0,0,0,EVERYDAY,_auto}}
 
Last edited:
Only 2 outlets working well are the heater and ato. I had to change the default to this to get the outlet on.

{OUTLET7,0,86400,0,EVERYDAY,_auto}

Outlets 3 and 4 are my lights. They use to work perfectly on the old code.
 
if the 3 time values are 0,0,0, that means it is not controlled at all by schedule and is controlled via a sensor. This is how you must set ATO pump, as it is controlled by float switch state. Likewise for heater, as it is controlled by temp.
For outlet1, if you manually turn it off, then set it to auto, it will remain off. If you manually turn it on, then set it to auto, it will remain on. Until the time the sensor check is done. Say for example the outlet is for ATO pump. If you manually turn it on, then set it to auto, it will remain ON until checkATO is called, then it will turn on or off depending on the state of the float switch. You can always manually turn it off then switch to auto.

for skimmer and return pump that is always on, the second number must be 86400. So whatever you use outlet7 for, it will be ON in auto mode.

your outlet 3 will be off from midnight to 9am, ON from 9am to 6pm, then off from 6pm to midnight.
your outlet 4 will be off from midnight to 10am, ON from 10am to 5pm, then off from 5pm to midnight.

Go to the outlets setup page and check each outlet and make sure the Inverse Cycle checkbox is unchecked.
 
if the 3 time values are 0,0,0, that means it is not controlled at all by schedule and is controlled via a sensor. This is how you must set ATO pump, as it is controlled by float switch state. Likewise for heater, as it is controlled by temp.
For outlet1, if you manually turn it off, then set it to auto, it will remain off. If you manually turn it on, then set it to auto, it will remain on. Until the time the sensor check is done. Say for example the outlet is for ATO pump. If you manually turn it on, then set it to auto, it will remain ON until checkATO is called, then it will turn on or off depending on the state of the float switch. You can always manually turn it off then switch to auto.

for skimmer and return pump that is always on, the second number must be 86400. So whatever you use outlet7 for, it will be ON in auto mode.

your outlet 3 will be off from midnight to 9am, ON from 9am to 6pm, then off from 6pm to midnight.
your outlet 4 will be off from midnight to 10am, ON from 10am to 5pm, then off from 5pm to midnight.

Go to the outlets setup page and check each outlet and make sure the Inverse Cycle checkbox is unchecked.

Thanks for the clarification. Let me test. Thanks again
 
Last edited:
Ok. Running your latest code with the mod you gave me seems to be working perfectly now on my frag tank. I think the last time I was updating I missed some options and forgot to change for eeprom. Thank you for the fixes and getting me back on track.
 
Got my fan circuit sorted now, soldering about done, case drilled and dremmelled, putting it all together tomorrow, then testing continues :)
 
Got it pretty much how I want it now so started playing with different power supplies for the 5v system as the lm7805 gets very hot. Bad idea when you are tired... Stupidly plugged a 12v supply directly to the 5v pins doh! Gotta wait for a new mega now :(
 
use a buck converter instead of 7805. Be careful not to damage the atlas stamps, as they are the most expensive part of the circuit.

I'm still waiting for my led parts to arrive. I made the mistake of ordering items from aliexpress not delivered via epacket. I ordered a 48v led power supply and it was delivered via epacket in a week. I ordered other items that are sent via registered mail, which takes longer and someone has to sign for it to receive the package. I'm just waiting for the lumia 5.1 chip to arrive in the next week or two. I also finally ordered the LDD chips from powergate. I should have just paid a little more and ordered from mouser. powergate said the stock is in MA so I cannot do local pickup. That will take 10 business days to get delivered via UPS.

In the meantime, I've been testing the esp8266 wifi module to see how it works. It seems pretty stable so far, so it looks promising. Once I finish the led code, I will try to make a wifi version of the controller using the esp8266 module. If it works, the ethernet shield can be removed and replaced by a microsd module and the wifi module (which needs a serial port).
 
I have the same probs from hk with delivery times. I was going to use a 1a 5v usb phone charger removed from the casing inside the housing. Seems OK for what I want, what do you think?
 
if your relay board is 5v, you will need a second 5v power supply.

The 5v relay draws 90ma to switch the relay. 12v relay draws 37.5ma.
multiply that by 8 (if all 8 channels are on), you need 720ma for 5v relays, and about 300ma for 12v relays.
 
Back
Top