My Neptune Apex web interface compatible DIY reef controller

I have question regarding "Outlets" screen.

If I open in browser on PC this section and press refresh I should get last valid preview of states of outlets?

I guess so?

As then I change some outlets state, press refresh and changes are visibile also controller on each change give some sound.

Still when I open same "Apex" windows on my mobile (android) even if I press refresh or reload whole page I got different states of outlets???
And when I try to change those states again controller reacts with sound.

When I refresh state on PC browser changes are not visibile?
I have also third device Samsung Note tablet and aslo there different outlets?

How is that and how should I make as outlets would be always the same on all devices?

As I check temperature and clock reading changes on each press of refresh button what is correct and that is how also outlets should work?
 
Now as clock is working normally I do some additional tests.
So before few hours I unplug network cable form controller and plug it again after 4 hours.
I notice logging to log files stops after unplug? Still in File manager I see some additional folders with new log files?
And even now network is connected again I was thinking controller will react in such way to continue logging into original files but no??

Can anyone explain me this feature of logging when Internet line drops ?
I was thinking that is why battery operated RTC is used and until Internet line comes again controller works normally including logging still when Internet live comes back again sync clock with NTP server?
 
Teslo -

Good question on the outlets screen. I haven't tested that out yet, but I can later once I get my Relay board hooked up.

As for the clock, what you are seeing is normal behavior as how the code is written. Currently the clock only pulls time on initial boot up, and that is it. If I get time this weekend, I'll toy around with the code some, and see about setting up an 1-2 hour check in with NTP, so time stays accurate. Mine currently after 7days will be running 2 minutes fast. Is that a big deal, not really, but something I'd like to fix down the road.

As for the logging, I'll have to test that as well, to see if I'm getting the same results. As I don't actually look at my logs much. Currently my controller is sitting on my dinning room table connected to a breadboard for testing.

d0ughb0y - Sorry, not trying to take over your project. Figured I could just give a hand, helping out other reef. So please don't take offense.
 
d0ughb0y said his clock is updated every 10 second, as mine is right on everyday my led fan goes off at exactly 8 o'clock everyday. I check with my phone and it is right on. I bend running mines for since last year. I think it is somewhere in the post. I will fine it.
 
wgraham -

I seen that post. That's is why originally I never monitored the time. However after letting mine run for 7 days, and noticing the time was speeding up, I monitored the controllers traffic, and nothing is ever sent.

Also most ntp pools today will block you if you check anymore than once every 60 minutes.
 
wgraham -

I seen that post. That's is why originally I never monitored the time. However after letting mine run for 7 days, and noticing the time was speeding up, I monitored the controllers traffic, and nothing is ever sent.

Also most ntp pools today will block you if you check anymore than once every 60 minutes.

I understand I just know that I have two of them running and I can see that the time of both is dead on. All the relays come on at exactly the time I set them too. Let me know what you come up with, but as right now I'm not losing any time
 
So got my relay board connect, and I can only controller relay 1. I noticed on the web interface that the names for the outlets are gone. Anyone else run into this?
 
Aha...

#define EEPROMSIG 0xA1 //change this everytime you want the eeprom defaults to change


This value had to be changed after every change of names of outlets :)
 
hello, I was out of town for two weeks, and am now back.

The router ip is only used to test if the network is up. I make the controller ping the router (every 20 minutes) to see if it is reachable. If not, it will do a complete ethernet reset. You will know ethernet is down when you hear a periodic beep (sort of like a smoke detector with low battery).

I do not use any socket code that will require a DNS lookup in order to get faster execution time. So I don't know why adding the dns IP will make a difference, but I will just take your word for it that is fixed ntp problems you are encountering. it certainly won't hurt to add it.

BTW, pretty much all router will act as DNS server. Actually, router will automatically forward DNS requests it receives to the actual DNS server. So if you think the DNS ip is needed, you can always use the router ip address.

just an aside, I've only heard of how bad traffic and driving in Boston is, and now I have experienced first hand how bad it is. And drivers there get to use their car horn a lot. I can go for months here in norcal without hearing a car horn. :)
 
Anyone explain the purpose of the blue led in the schematic?

in addition to being a power on indicator, it is designed to blink ON for 1 second and OFF for 1 second. This tells you the arduino code is not hung and is running. Simply leaving it ON will not tell you if the code is hung.

On my webcam (which I can access independently from the controller), I position it so I can see the blue blinking light whenever I check my tank.

If for some reason you are not able to connect via web to the controller, if you can still access your webcam and can see the blue blinking light, then you need not worry as the core code of the controller will still be running. meaning you can be assured your ATO pump is not hung to ON position or any similar type of disaster.
 
As I live in Europe at -1h CGT I change in config.h setting and on main web page hour and date is shown correct.
For example now 06-24-2014 14:44:00
Still when I change one outlet setting and then check in Outlet log I see all log entries are made for past time so in outlet log I see 06/24/2014 5:44:00 ?

Where and how to change also this to be accurate and sync to current time?
 
d0ughb0y -

The reason for DNS, is not to use DNS, but to use the full ethernet.begin options. For people like me, who do not use a off the shelf wireless router, I need to use the full ethernet.begin options. The way you have it, it will use x.x.x.1 for DNS, and x.x.x.1 for the gateway if you don't specify. As for me, my gateway is x.x.x.254.

Granted I'm sure going to be the odd ball here, as my house is not setup like typical, as I run a full enterprise network setup at home, since my daily job is a Network Engineer.

However I do have a question. I don't see in your code where you pull NTP again after initial boot, but in a prior post your pulling like every 5 minutes. Would you be able to comment on that?
 
d0ughb0y -

The reason for DNS, is not to use DNS, but to use the full ethernet.begin options. For people like me, who do not use a off the shelf wireless router, I need to use the full ethernet.begin options. The way you have it, it will use x.x.x.1 for DNS, and x.x.x.1 for the gateway if you don't specify. As for me, my gateway is x.x.x.254.

Granted I'm sure going to be the odd ball here, as my house is not setup like typical, as I run a full enterprise network setup at home, since my daily job is a Network Engineer.

However I do have a question. I don't see in your code where you pull NTP again after initial boot, but in a prior post your pulling like every 5 minutes. Would you be able to comment on that?

ok, I have to correct my previous statement.
The 5 minute update is in the Time library. You can specify where to update from (setSyncProvider function). I was initially using ntp for updates (early on when the original circuit design did not use an RTC module), but later switched to rtc since ntp updates simply just take too long. And you are right, on boot time, when time is succesfully retrieved via ntp, the rtc value is updated. I've run my controller for months without rebooting and I still see the correct time. But I do see how others might see the drift since there is no accuracy guarantee for the cheap RTC module. I am using the cheapest RTC module I can find on ebay. The Time library keeps track of time in Arduino, based on arduino clock, which is not exact, hence the need to resync with a source periodically (every 5 minutes by default),

I'll test adding a once a day ntp time sync to rtc and if I don't see any problem, I'll add it to the github code. Please ignore all my previous statements regarding RTC accuracy. sorry for the mixup.

regarding ethernet/network. To those having problems with NTP, is your router address not x.x.x.1? If so, then non of the network function would work, not just ntp. That would be the only reason for using the Ethernet.begin with dns and gateway parameter. For which you could use the router_ip for both dns and gateway. I will make the fix to use the specified router_ip for dns and gateway parameter.
 
As I live in Europe at -1h CGT I change in config.h setting and on main web page hour and date is shown correct.
For example now 06-24-2014 14:44:00
Still when I change one outlet setting and then check in Outlet log I see all log entries are made for past time so in outlet log I see 06/24/2014 5:44:00 ?

Where and how to change also this to be accurate and sync to current time?

The only place to specify timezone is in config.h #define STDTZOFFSET
do you have lcd display? is it showing the correct local time?

are you sure your timezone is -1 GMT? are you in Iceland?

timezone is offset from GMT. I can't find anything on CGT timezone on google.
 
Last edited:
Hold tight this might be a long one!

D0ughboy: I've read the entire thread a couple of times and broke out the arduino box. So far impressed with the performance and useability of this. I have a mega 2560 with ethernet shield, RTC, LCD display, DS18B20 and a 4 relay module so most of the parts! I've been tinkering with these things for years but never really got them running well enough, the interupt method works wonderfully. I am digesting the code at the moment so I might be able to pitch in.

Just looking at adding sensors such as a 2nd and 3rd temp probe, a DHT22 amongst others! It looks like you are working on something to allow defining new sensors in the config.h So I am holding off tweaking at the moment, is that still the plan?

LED modules. I have a 2nd arduino that will be running my light circuit but there is definitely space left in this sketch for it! has anybody got a basic 'plugin' code they would be willing to share?

Time offset is working for me set to 0 and autodst correct time for the UK is shown.

I also changed the temperature to show Celsius rather than Farenheit by changing these lines in sensors
Code:
 lasttemp = t / 16.0;
 // * 1.8 + 32.0;

 if (getTemp()>2.0) {

I do have an issue with my Sr04 I think I may have turned into a bat as I can hear it pulsing! any way of changing the frequency? Just about to tear apart an old auto top up for a buzzer and a couple of float switches.

My LCD is a different one to yours and I had to make a few changes, this may work for the guy that is having issues and should mean cheap ebay i2c displays work. You need to change the NEGATIVE to POSITIVE and set the correct pin defs in config.h..
This is my string.
Code:
[U]Chauvet.ino[/U]

LiquidCrystal_I2C lcd(LCD_ADDR,LCD_EN,LCD_RW,LCD_RS,LCD_D4,LCD_D5,LCD_D6,LCD_D7,LCD_BACKLIGHT,[B]POSITIVE[/B]);

[U]Config.h[/U]

#define LCD_ADDR 0x27
#define LCD_ROWS 2
#define LCD_COLS 16
#define LCD_NUM_MSGS 4+MAXPWMPUMPS/2
#define LCD_MSG_CYCLE_SECS 2
#define LCD_EN 2
#define LCD_RW 1
#define LCD_RS 0
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
#define LCD_BACKLIGHT 3
//0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE

I shall keep checking in here seen as I am actively looking at using this on my reef. Well I need a reef first I have a 5.5'x2'x2' sat empty for the last 6 months. I need my slice of ocean back and this might just be the way to look after it :)
I am OK at coding and testing and my electronic knowledge is pretty useful too. Let me know if I can help or my much better coding friends if I can tempt them into it!
:thumbsup:
 
Back
Top