My Neptune Apex web interface compatible DIY reef controller

d0ughb0y -

I soldered the TRRS to a prototyping board. I'm basically trying to make a Proto Board to my liking, then have some custom pcb made.
 
I am getting the temp reading of 32 on my second temp sensor. I think the problem may be due to calling ds.reset() in readTemp. I will remove it as reset is not needed there. I am going to try to optimize the temp sensor code by splitting it down to about 500us execution time each call to updateTemp. The current code takes up too much time executing updateTemp.

I optimized the webserver code quite a bit to free up some SRAM space. I think I will need the extra memory once I add the doser and LED code.

I got my doser case and mounted the two dosing pumps. I just need to wire it then I can start writing the code for it, hopefully this weekend.
 
That's a clean way of doing it. How is the spacing of the connectors? I assume you have at least 2 of these? or did you use this for all connections?
 
The updated code seems to work fine and stable.
My second temp sensor is reading fine again.
The temp sensor optimized code seems to work quite well. I timed the updateTemp call and it takes an average of 500us to execute the function. This means in theory, you can add more temp sensors, and it will not affect performance of the controller. It will still take 500us to execute updateTemp function, regardless if you have 1 or 5 temp sensors.
For my 2 temp sensor setup, it takes 24 calls (from main loop) to update the temp readings for both sensors. I figure I am updating at least 80 times per second the value of tempavg, which leaves plenty of room for more temp sensors.

I moved all string constants used by TinyWebserver to PROGMEM and now my free memory at startup is 3861 bytes. This is after I added the variables for dosers and with two temp sensors. I checked my old logs when I only had 1 temp sensor and no doser code yet, and the free memory at startup was 3649 bytes. I think this should be good for now. I think there is enough memory to handle a fully loaded controller with 16 outlets, 3 atlas sensors, 5 temp sensors, 4 jebao pumps, 2 dosers and maybe 4 channel LED. As long as free memory after startup does not go below 1k, I think the program will be fine.

I made one more update to the RTC ntp sync code and running fine for far for at least 2 weeks now.

I made the retrieval of index.htm gzip compressed. It is working quite well. The uncompressed file is 80k and takes about 2.5 seconds to load. The compressed file is about 18k and takes around 300ms to load on my local network. I was concerned the index.htm file will get quite bigger with the additional features. Now with gzip compression optimization, I don't have to worry about the size anymore.

I will upload to github once I have the doser code completed,
 
Last edited:
That's a clean way of doing it. How is the spacing of the connectors? I assume you have at least 2 of these? or did you use this for all connections?

yes I have two of the trrs break out boards, there is plenty of space between those two. Then I have two TRS jacks (with out a break out board).
 
The updated code seems to work fine and stable.
My second temp sensor is reading fine again.

Util we don't see new code just short question :)
We will had to enter each Sensor ID into Config.ini?

I have another question regarding web page. If I open web page in browser and leave it open for few days then I want to refresh page I got answer as "Unable to connect to Apex" Still this is not due as controller would not be on or something that.. It is due webpage again wants to authenticate again still don't show authentication page? How after a while we coudl authenticate and refresh webpage?
Ok this works if we close browser tab or window, wait a bit and then again open controller page.


I made the retrieval of index.htm gzip compressed. It is working quite well. The uncompressed file is 80k and takes about 2.5 seconds to load. The compressed file is about 18k and takes around 300ms to load on my local network. I was concerned the index.htm file will get quite bigger with the additional features. Now with gzip compression optimization, I don't have to worry about the size anymore.

So index.htm will be saved in compression shape?


I will upload to github once I have the doser code completed,
We hardly wait to see new functionalities and new adds :)

& thanks for your time, your hard work and sharing your code with us!
 
Util we don't see new code just short question :)
We will had to enter each Sensor ID into Config.ini?
I'm not sure I understand the question. For temp and ph sensors, you can specify a name in config.h. If you switch to "temperature" branch on my github page, and see the config.h file.

Code:
#define _TEMP  //comment out if no temp probe
#define MAXTEMP 2 //number of temp sensors, 1 or 2
#define TEMPADDR {0x28, 0xdf, 0x5d, 0x89, 0x05, 0x00, 0x00, 0xf8},{0x28, 0xde, 0x18, 0x5a, 0x05, 0x00, 0x00, 0x7d}
#define TEMPNAME {"Temp","Ambient"}
#define PHNAME {"pH"}
#define _PH  //comment out if no ph probe or ph stamp
#define MAXPH 1 //number of ph stamps
ph code is not complete yet, but you can specify the address in a define as well like
#define PHADDR {Serial1, Serial2}

I have another question regarding web page. If I open web page in browser and leave it open for few days then I want to refresh page I got answer as "Unable to connect to Apex" Still this is not due as controller would not be on or something that.. It is due webpage again wants to authenticate again still don't show authentication page? How after a while we coudl authenticate and refresh webpage?
Ok this works if we close browser tab or window, wait a bit and then again open controller page.
Do you see this on a smartphone browser? I do get that as well on iphone safari. I do not get this on firefox on my laptop. I can refresh anytime without logging in again on my laptop. However, on the smartphone, I have to close and reload a new page.

And yes, I noticed the same thing on iphone safari. Whenever I get the cannot connect error, and keep getting that when I retry, I find that if I close the page and open a new page everything works fine. I don't know exactly why this is happening with safari on iphone.

Regarding logging in, what I do is I create a bookmark on my iphone safari browser. Then I edit the bookmark to include my login in the URL. (add the username after http:// then : then the password then @ then the url.) So when I tap on the bookmark, it will prompt me a security warning, then it will load the page without me entering the password.


So index.htm will be saved in compression shape?



We hardly wait to see new functionalities and new adds :)

& thanks for your time, your hard work and sharing your code with us!
Yes, I pre-compress the index.htm file using 7zip using gzip deflate compression, upload it to SD card, then send that compressed file back to the browser instead of index.htm file. The browser knows to unzip the file.
(there is more to it than that, but in general, that is how I implemented it)

BTW, the state machine algorithm I used for temp sensor is quite simple and works well, I am going to test implementing the same for the web server processing. I'll see if that helps minimize the clock on the LCD from pausing whenever the controller is handling a large web browser request without affecting the browser response time.

I will try to finish doser work as soon as I can so I can update github.
 
Last edited:
I'm not sure I understand the question

Yes I was thinking on this line:

Code:
#define TEMPADDR {0x28, 0xdf, 0x5d, 0x89, 0x05, 0x00, 0x00, 0xf8},{0x28, 0xde, 0x18, 0x5a, 0x05, 0x00, 0x00, 0x7d}


Do you see this on a smartphone browser? I do get that as well on iphone safari.

No I use on Win7 notebooks with IE and Chrome and on Android tablets and phones. On all devices same problem after few hours or days.


Regarding logging in, what I do is I create a bookmark on my iphone safari browser. Then I edit the bookmark to include my login in the URL. (add the username after http:// then : then the password then @ then the url.) So when I tap on the bookmark, it will prompt me a security warning, then it will load the page without me entering the password.

Excellent I will try with this!
So basically by default admin/password this means:
Code:
http://admin:password@url



Yes, I pre-compress the index.htm file using 7zip using gzip deflate compression, upload it to SD card, then send that compressed file back to the browser instead of index.htm file. The browser knows to unzip the file.
(there is more to it than that, but in general, that is how I implemented it)

Aha so on SD card index.htm is stored already in zip format and in this format it is send to browser which localy uncompress and use it. Later for communication between browser and controller no compression is used.
By using zip format you reduce transfer time which controller needs to transfer index.htm to remote browser :)
 
Last edited:
ok, now I understand your question.

Yes, you need to enter the temp sensor addresses in the config.h. The first temp sensor will be used for alarm and to control fan/heater. If you want second sensor to be more than just a display value, you can add your own code for it. BTW, if you only have one temp sensor, you do not need to enter the temp address #define, but make sure to #define MAXTEMP 1

Using Firefox, it remembers the username and password, so it automatically sends it on each request. Adding the username and password to the bookmarked URL, you will not have to type it in anymore when you use the bookmark.

The client browser will actually inform the server that it can accept gzipped file, if the controller webserver sees that, then it will send back the gzipped file, otherwise, it will still send the index.htm file. So both compressed and uncompressed version of index.htm files are on the SD card.
 
d0ughb0y quick question is your code compatible with the arudino Due or would I need to purchase a Mega in order to run the arduino code?
 
d0ughb0y,
I am on buissnes trip past 6 days and today I was checking controller log and I see a lot of :

Ethernet and webserver reset?

As I check in controller log this started yesterday and then today and before noone time? Today for example each 20min from midnight to 1PM and in this time no other record in this log except each 20min this error? And then also from 3PM-4:20PM and later few times more.
What could be reason for that?

As I am not at home I didn't make any code change, update or anything and controller runs now for about 2weeks without reset or restart.
I check at home and my family says all day interest works normally.
I also call ISP and they say for longer than a month no errors on Internet line.

Controller runs only with one temp sensor on it without any other device.
 
the controller checks if network is still working every 20 minutes by connecting to your router. If connection fails, it will perform a network and webserver reset.

If you think your network is stable, you can comment out the router ping code in lines 139-141 of outlets.ino file.

Are you using the latest code with the RTC ntp update? I have another bug fix there I have not checked in to github yet.

I'll be done with the doser code probably by next week. I will update github then.
after that I will work on the rest of atlas sensor code, then LED.
 
the controller checks if network is still working every 20 minutes by connecting to your router. If connection fails, it will perform a network and webserver reset.

If you think your network is stable, you can comment out the router ping code in lines 139-141 of outlets.ino file.

Well I will do test with ping in few days when I return home. Now for outside world I can't do that..

Are you using the latest code with the RTC ntp update? I have another bug fix there I have not checked in to github yet.

Well no I use older version with my own NTP changes. Still if code works for a month and now those errors maybe problem is some where else.

I'll be done with the doser code probably by next week. I will update github then.
after that I will work on the rest of atlas sensor code, then LED.

Excellent!
 
ok, now I understand your question.

Yes, you need to enter the temp sensor addresses in the config.h. The first temp sensor will be used for alarm and to control fan/heater. If you want second sensor to be more than just a display value, you can add your own code for it. BTW, if you only have one temp sensor, you do not need to enter the temp address #define, but make sure to #define MAXTEMP 1.

If you write code for the second probe what would you call it
 
My Neptune Apex web interface compatible DIY reef controller

If you write code for the second probe what would you call it


You specify the name in a define in config.h just like how it is now for multiple temp probes.

I'm almost done with doser code. It will not take long to add the additional probes init and update functions, but to add the setup and calibration page will take longer.
 
Last edited:
Back
Top