My Neptune Apex web interface compatible DIY reef controller

You have one of the newer version boards, nice! are these not still limited to only having 2 pwm pins capable of high resolution dimming?
 
is the sketch for this board use one from existing led controller? or was it written from scratch specifically for the board? is the i2c for lcd?
 
The boards were made to try and incorporate all you would need for basic led control and temp monitoring. I use i2c for a 2004 lcd with backpack on mine and use o2's adapted led code to control the led's, display the temp and turn a fan on and off with the lights.
c3c2489d68064f42eb41029eb47d92bf.jpg


The temp sensor started to rust so I put it on the heatsinc to display that temp for now which is why it's low.
 
I don't suppose there is a condensed version of this thread? I'm putting together a 12 gallon biocube for my office and would love to put a controller on it. This seems to fit the bill for that I want. It would be nice to have all the current info in something not 63 pages long. ;-) Thanks for making this project possible.
 
I will try to put together a page on GitHub containing the current info once I get the LED code done. For now, just read the first page, and scan the rest, then refer to the circuit diagram and code. Email me if you have questions.
 
I updated github with more bugfixes to atlas sensor code.

I removed temp compensation for ph probe, but left the one for conductivity probe, but is off by default.
I also fixed the calibration code. I added a reset button to reset the atlas stamp before calibration (for ezo, it only clears the calibration).
 
http://reefcentral.com/forums/showpost.php?p=22789633&postcount=408

I have the best idea in line!
Good I2C connector onboard everything is there, 4 wires run to the leds!! woop woop

Yeah I also have the pro mini, I just said nano because there are so god damn many variants

I took a quick look at this, and I don't think you can do 5 led + 1 fan pwm.

The atmega328 has 3 timers for 6 pwm outputs.
2 are 8 bit timers and 1 is 16 bit.

The pca chip is 16 channel 12bit pwm.

The PWM fan MUST use a pwm frequency of 21khz or higher as per specs.
Timer0 is used for millis and micros function hence MUST remain at pwm frequency of 980hz.
Either Time1 or Timer2 can be configured to run at 21khz pwm, but that means that both pwm lines must run at 21khz and cannot be used on the meanwell ldd, as meanwell ldd pwm max freq is 1khz.

So in order to use an atmega328 i2c slave as led and fan conroller, you can only use it to control 4 8-bit channel led + 2 21khz pwm for fans or 6 channel 8-bit pwm.

I think a more acceptable setup is to have 6 8-bit pwm channels plus fan On/Off only control and temp monitor.

Using pwm with frquency lower than 21khz on fan will have an audible hum coming out of the fan.

of course going this route means you are willing to drop down to 8 bit pwm (which I think is probably just fine).
 
It still seems the way to go, could you have 2 slave i2c ardu's?
or even more?
And address the channels as more then 1-4?

Also the Arduino micro (based on ATmega32u4) has 7 pwm pins? I didnt check how many clocks but
 
Last edited:
My board uses the default 328 pwm output frequency and the 6th channel is used for fan on/off control. It works great and the I2C connection is brought out on the board as well for Display or other use. It's a very similar board to the smartycat board that O2 built. Krazie :jester:
 
is higher bit pwm really better than 8 bit pwm for LED? or is it just a marketing gimmick?

someone told me you need to go 10 bit to get smooth transitions. Anything higher than 10 bit does not really improve much.
 
My board uses the default 328 pwm output frequency and the 6th channel is used for fan on/off control. It works great and the I2C connection is brought out on the board as well for Display or other use. It's a very similar board to the smartycat board that O2 built. Krazie :jester:

if you are just using it for on/off control as you stated, then pwm frequency does not really come into play, as the pwm line will be high or low only. If this is the case, another pin can be designated for that use, hence one of the option I was thinking is 6 8-bit pwm led channels plus fan on/off control.
 
The only time I notice the steps in the PWM is the first few steps in the morning on the blue channel one it is at about 5% I don't notice it anymore abs when more channels are running out is even harder to notice a single channel change. I think it's all marketing.

My board has a jumper that let's me select to use channel 6 as either PWM to an ldd driver or analog on / off for fan. I can also jumper it to fans always on so for me is no big deal to decide what to do with the fans.
 
I use the high res at the minute and it has 1024 steps rather than 256 but it also depends on how long you ramp it up for. From nothing to full over one hour the difference is 3.5 seconds compared to 14 seconds per jump. On the 1024 setting you only notice it over the first minute or so then very smooth. If you are only going to say 40% over an hour and only had the 256 setting then that's 35 seconds per jump. Not the end of the world but a little more noticeable.
 
Since the pwm duty cycle changes only during ramp up/down, it makes sense that the transition is noticed only during this time. It's not only the seconds between change, but also the amount of change. I suppose you will be able to notice 1/256 more than 1/1024 or 1/4096. If the ramp up/down is using a sine function (instead of linear ramp), then first 1/3 will change quite a bit more, so I can see it even more noticeable with 8 bit pwm. And once ramp is done, then there is no difference between 8bit,10bit or 12bit.

I don't know if it matters if I use 10 or 12 bit for 2 channels (maybe use on white and royal blue channels), and 8 bit for the rest. I might be able to generate a 25khz pwm for the fan using timer interrupt code, while keeping the other channel on 490hz pwm.

As for the fan, I think the way others implement this is the fan is powered directly by 12v wall wart, and pwm controls the speed. However, most fans will not turn off even if pwm is 0. By spec, fans are required to run at 30% if powered, even if pwm is off. I can use another pin to control the fan on/off to truly turn off the fan. Also since all fans have tach signal, I can use that to detect if fan stops spinning and sound a buzzer.
 
Sounds good. Will you still support 12bit with the pwm chip you showed earlier as well?

Software aside, I have been meaning to ask, how's your build coming hardware wise? What are you running on your tank while you get this tweaked? Also, have you had to make another box to put the extra hardware in or have you managed to cram it into the chaveut?
 
yes I will still code for pca chip.

I am using the chauvet on my tank and have another test circuit on breadboard I use for development. I originally thought I will be needing 16 outlets, but now with devices controlled by arduino pins, I am not even using all 8 outlets. So I'll probably end up revising the circuit in my chauvet. I'll remove the ULN since I won't be connecting a second chauvet. I'm figuring If I can get all the circuit on a shield and still fit the ethernet shield (or wifi module).

On my test circuit, I am using a really small buck converter (it is smaller than the rtc module) and it seems to work quite well. I use this to power the arduino and the rest of the 5v circuit. I'll use this in the chauvet as well when I revise the circuit.

http://www.ebay.com/itm/Mini-DC-DC-...408?pt=LH_DefaultDomain_0&hash=item4adc7128b0

the external circuit includes rtc, uln2003 to drive doser and fan, 3 pnp+base resistor to drive fan, and a buzzer. I'm thinking of using the stamp carrier for atlas stamps since the stamp must be connected right next to the bnc.
 
Last edited:
d0ughb0y - question regarding the ATO function.

On my Neptune Apex you can put in defer statements like this:

Fallback OFF
Set OFF
If Sw1 CLOSED Then ON
If Sw1 OPEN Then OFF
Defer 001:00 Then ON
Defer 002:00 Then OFF

This makes the switch have to be closed for 1 min before the pump kicks on. Then when the switch goes open it continues to pump for 2 mins. This helps reduce the cycling of the ATO pump when there is turbulence on the surface that affects the float. Any way to do this with your controller?
 
currently checkATO function is called once per second. Looking at my outlet logs, my ato pump usually comes on 20 seconds or more, though I don't have much turbulence in my sump return section.

you can modify the code to check it at a different interval. That will give you the same effect. The interval will then be the minimum amount of time the ato pump comes on when triggered. One way to do this is to add a static int counter and call checkATO only once counter reach the interval you want.

Code:
static int counter=0;
if (counter++>=60) {
checkATO();
counter=0;
}
the above will call checkATO once every minute instead of once every second.
 
Back
Top