My Neptune Apex web interface compatible DIY reef controller

is your webserver running on ethernet shield? it push data to an external server or all the pages served from the arduino? its just status and no control?

I use web interface for all UI, it keeps the arduino code small. everyone has a smartphone nowadays.


Hi!

I haven't a webserver. My ethernet shield only send values to Xively.

This is just status. I don't find interesting the control via web.
 
Fernando,

I am working on revising my code to increase resolution, you know you can optimize your code for speed by just converting your sin function formula into a lookup table similar to mode 3. the table lookup will run several times faster than using the sin function.

this function

value = int(128 + 127 * sin(2 * PI / periodo * times));

you can just create a 30 value array and map the time to an index just like in your mode 3.
since you use the same function in modes 1,2 and 4, you can use that same array for the 3 modes.
</pre>

My code spends 3.9 milliseconds at every turn with Wavemaker () in the loop and 3.7 without.

So he spends about 0.2 millisecond to make this calculation. It's not much.
 
I just finished testing the program.

pwm signal without RC filter works just fine.

The program can be configured to control 2 or 4 pumps. (makes me want to buy a second wp-25).
I have programmed H1,H2,H3,W1,W2,W3,ELSE, Feed and 4 custom waveforms.
(actually H2 and H3 are not needed since you can control level of H1 so I will probably drop them to reduce program and memory space usage)
you can control the pulse width and level for any wave mode.
level can be controlled from 128 to 255
pulse width can be controlled from 0-10 (translates to 200ms to 650ms per pulse).
Each pump can be programmed into 6 intervals.
you specify the following for each interval
start and end time, start and end level, wave mode, pulse width

pump0 is always master. you can define pumps 1-3 to run in sync or antisync of pump 0, on any wave mode.

I'll be running the test program while I figure the web interface code to program and control the pumps.

I ordered 2 peristaltic pumps. I will be writing the code for controlling the two pumps for dosing or for auto water change once I complete the jebao pump code.
 
no need for the stock controller anymore, as my code replicates all modes. H1, H2, H3, W1, W2 and W3 are perfect replica (it's actually ironic to be reverse engineering a Chinese product). ELSE I just randomize between 128 and 255 (that seems to be how it works for the controller). The controller Feed simply turns off the pump, on my code, I kick up the pump to 128 for 200ms every 1.6 seconds.

I do not recommend to unsolder and use the cable from the controller, just in case you want to sell the pump later. I got a cable from ebay for $0.99 shipped (seller probably realized he lost money, and is now listed at $6). The connections fit, but the locking nut thread does not. If anyone can find the exact kind of cable on ebay, let me know. I also ordered the DC connector. It was either $0.99 for one, $1.49 for two, or $1.99 for 10, I ordered the 10, but has not yet arrived.
 
I suppose you mean to invert the logic level right? and not the order of the outlets.
if you look at the original _outletOn function code, to turn on the first 8 outlets, the code is
PORTA &=~_BV(p);
and the code for the next 8 outlets is
PORTC |= _BV(p-8);

for the PORTC code, you set the pin high to turn on the outlet, for the PORTA code, you set the pin low to turn on the outlet. So if you want to invert the logic for PORTA, just do the same as PORTC
if (!(PORTA & _BV(p))) {
PORTA |=_BV(p);

and then do the same for _outletOff function
if (PORTA & _BV(p)) {
PORTA &= ~_BV(p);
 
yes the logic level and what happen I copy and paste the PORTC code to PORTA and did not change the C to A and left in the p-8, instead of p.
Thanks
 
I got the dc power connector today. The peristaltic pumps should arrive in another day or two. I plan to do the rewiring and assemble the jebao cable this weekend.

I have started to merge the jebao test code into the main code. In the process I did some reorganization. The mega provides 15 PWM lines, of which 12 are usable since 2 lines are used by ethernet shield and one by the led on pin 13. All 12 PWM lines are now available for use. By default, 2 will be used for jebao pumps (with option to make it 4), and 2 are 10v PWM for LEDs. You can reconfigure anyway you want it. If you use 4 jebao pumps, you still have 8 PWM lines left to control an 8 channel LED light, enough to control a full spectrum LED light fixture.

As to LED control, I see plenty of arduino code for controlling LED that should be pretty straightforward for anyone to integrate into the main program loop. Most code seems to follow the standard of calling an update_leds() function in the main loop().
Perhaps one day if I have time I will open up my maxspect razor to see if I can rewire it to control from my controller.
 
Were are you getting your parts from, I like to order what I need to get the pumps running and the peristaltic pumps
 
I get them from ebay. I cannot recommend the sellers I got them from though.
the peristaltic pump came today, it did not have the barb connectors. before you order peristaltic pump, ask the seller if it comes with the hose barb.
I had to order some from fleetfarm (60 cents each, free shipping)

the dc connectors are fine but seller does not provide tracking, shipping time is not too bad though. its the seller that sells 10 for $1.99

the 3 pin LED connector is not a perfect fit to the jebao connector (can connect, but thread does not exactly match). I'm not sure how to tell from looking at pictures on ebay listing if a connector is the same as the jebao connector. make sure to get one with the notch on top, not the flat one. The description of the one I got is
1pcsX 3x0.75 SQMM LED Light Strips 3 Pin Waterproof Connector Cable
 
finished assembling the cable. cost me around $3. I got the stereo extension cable cheap on ebay. Only 2 of the 4 wires are connected.
I currently have one jebao pump, if I add another, I will just use a stereo splitter cable to connect the second jebao cable since I'll be wiring 2 pins to the stereo jack but currently only one is used.

I've seen home made cables sold here on RC for $25.
6gYyZF2.jpg

I'll be rewiring the arduino circuit next.
 
Last edited:
Question if I wanted to use one of the outlets for a time program for like on at a certain time of day and off at a center time. Like to come on at 6:30pm and off like at 10:30am,
can that be done.
 
How is your controller doing with the WP25, having any issues

I was not going to have enough time to do it sunday night, so I have to reschedule the rewiring. I will try again this weekend. I do not expect any issues, as I ran the test program for 2 days on another mega board. I was also playing around with my version of nutrient export mode to kick up detritus and make it go into the overflow. The possibilities are endless by programming your own wave mode. I find the other vortech mode more like novelty mode. I think the jebao W1 and ELSE modes are really all that's needed.

Question if I wanted to use one of the outlets for a time program for like on at a certain time of day and off at a center time. Like to come on at 6:30pm and off like at 10:30am,
can that be done.

currently there is no direct way to doing it, since that cycle logic is the reversed. you have two on times and one off time.

you can program the outlet in two macro definitions though to achieve that schedule (convert the values to seconds).
first macro has initial off=0, on=10.5 hrs, off=13.5 hrs.
then in that macro, add the outlet with init off=0, on=10.5hrs, off=0.
second macro has initial off=18.5hrs, on=5.5hrs, off=0.
then add the outlet with init off=0, on=5.5 hrs, off=0.

the macros are run just like an outlet program, and within the on time of the macro, you can program your outlets with init off+on+off time to match the macro ON time.

I think it is simple enough to add a flag to indicate the reverse logic for the outlet cycle schedule, so it will actually be init on, off time, on time.
 
How secure is the email info and can I assume its unnecessary unless you want alarm notification?

I really jacked up my libraries. I think some of the line counts in the instructions are off but I don't have a nice editor and am not a programmer. If anyone wants to PM me a set if working files I would appreciate it.
 
How secure is the email info and can I assume its unnecessary unless you want alarm notification?

I really jacked up my libraries. I think some of the line counts in the instructions are off but I don't have a nice editor and am not a programmer. If anyone wants to PM me a set if working files I would appreciate it.

you can get the source from github, the link is in first page of this thread.
the arduino source for this controller is still quite small in size.
 
I just finished rewiring the controller. The main change is moving temp sensor wire from pin 46 to 48, buzzer from D5 to A0, and adding NPN transistors to the IO on pins A14 and A15 to control the 12v peristaltic pumps. I'm only using 2 channels for jebao pump controls and I use D11 and D12. I will update the schematic once I confirm everything works. I freed up pretty much all usable PWM pins on the arduino.

I'll be testing the software next. I got a second wp-25 since it went on sale again. I have not hooked it up yet. I might just use the 3pin connector from the stock controller on the second one to build my cable.
 
Back
Top