My DIY Netduino Controller and Multi-channel Multi-chip LED Cannons

Its so amazing for me as a non-understand-electrical person.

I really want to make it by my own, but i still confuse.

anywaay, its really a good work. :thumbsup:

Yhe secret of understanding and dioing it yourself is to work in steps slowly. Start very simple than slowly go step by step adding more "complexity" to the system.
 
Yhe secret of understanding and dioing it yourself is to work in steps slowly. Start very simple than slowly go step by step adding more "complexity" to the system.

Yep. Pick a place to start and don't let someone else "do it for you" until you understand what they are doing and why. Having total understanding of how the less complex systems function is what allows you to get them to function in a complex system together.

Case and point : I added the LCD late in the game after I had a decent understanding of the i2c bus it ran on, never would have gotten it to work on my own strait out of the box.
 
Okay, looking to get some "Modes" programmed into the controller.

I want to be able to push different buttons and get to:

Feed Mode (no return, no power heads)
Light mode (Lights come up to a pre-set level, on push 2 go dark, push 3 go back to whatever the programmer says)
Water change mode (no return pump, no heater, no ATO function, no powerhead) some options will be added back in for bigger tank

What am I missing?

I'll be implementing these via the webserver first, and adding physical buttons later. I also want the ability to send a power per channel to the controller and have it adjust the lights to that power (from a windows app/phone app/web app).
 
Yep. Pick a place to start and don't let someone else "do it for you" until you understand what they are doing and why. Having total understanding of how the less complex systems function is what allows you to get them to function in a complex system together.

Case and point : I added the LCD late in the game after I had a decent understanding of the i2c bus it ran on, never would have gotten it to work on my own strait out of the box.

I really want to make it, i want to learn from you first :)

In my diy, i want to use arduino uno r3 + lcd keypad for arduino. but i dont understand about the RTC and the others :D

do i need relay to? + microcontroller atmega16A?

i really appreciate for ur kindness for teaching me about what part should i buy now. lol :lolspin:
 
I really want to make it, i want to learn from you first :)

In my diy, i want to use arduino uno r3 + lcd keypad for arduino. but i dont understand about the RTC and the others :D

do i need relay to? + microcontroller atmega16A?

i really appreciate for ur kindness for teaching me about what part should i buy now. lol :lolspin:

You'll have to ask elsewhere for help on ARduino, as my controller is NETduino.


Update: I can now send commands to the controller via URL so I can now override my light phase manually, then reset it, and within 60 seconds of resetting it starts fading to the proper light phase for the time of day.
 
Starting the design phase for the "Shield" that the N+2 will sit on to provide all the connections to the other bits and pieces. Not experienced in eagle or the like, so we'll see how this goes.
 
Oh, also started implementing Bean's suggestion of switching to a solved equation for lighting. Looking forward to getting that going. Using the manual over-ride for the lighting and what not a lot right now, so that's handy to have. contemplating a shared secret setup, though it's not exactly super secure since it'll be passed through GET anyway. I'll likely depend on obscurity through port choice. I also revised the ATO setup, though only the hardware, the programming has stayed the same, so no need to detail that here.
 
well, I think I settled on a 5th order polynomial as my basis for the curves I'm building to calculate lights. Right now my example curve is calculating and work just fine, here is the code:

Code:
double[] day1 = new double[] { -0.002, 0.4539, -18.728, 253.68, -936.89, 286.05 };
            double CurrentPower = day1[5];
            double calcTime = DateTime.Now.Hour; // hours in 24 hour format
            calcTime += ((DateTime.Now.Minute / 60)); // convert minutes to fractional hours
            CurrentPower += day1[4] * calcTime;
            CurrentPower += day1[3] * System.Math.Pow(calcTime, 2);
            CurrentPower += day1[2] * System.Math.Pow(calcTime, 3);
            CurrentPower += day1[1] * System.Math.Pow(calcTime, 4);
            CurrentPower += day1[0] * System.Math.Pow(calcTime, 5);
            if (CurrentPower < 0)
                CurrentPower = 0;
            Debug.Print(CurrentPower.ToString());

the equation is this:
y = -0.002 * x^5 + 0.4539 * x^4 - 18.728 * x^3 + 253.68 * x^2 - 936.89 * x + 286.05

that's an example of one I might use for a blue channel: fading in starting as early as 5 AM with no significant light output until 7 AM, peaking at just over 2000 out of 4000 right at 1:30 in the afternoon and fading out to darkness at about 6:00 PM.

I have the code running, but not controlling the lights yet. Did add an LCD message telling me it's "Overriding" the lights when override is active, and that works well.
 
Code:
double[] day1 = new double[] { -0.002, 0.4539, -18.728, 253.68, -936.89, 286.05 };
            double CurrentPower = day1[5];
            double calcTime = DateTime.Now.Hour; // hours in 24 hour format
            calcTime += (((double)(DateTime.Now.Minute) / 60)); // convert minutes to fractional hours
            CurrentPower += day1[4] * calcTime;
            CurrentPower += day1[3] * System.Math.Pow(calcTime, 2);
            CurrentPower += day1[2] * System.Math.Pow(calcTime, 3);
            CurrentPower += day1[1] * System.Math.Pow(calcTime, 4);
            CurrentPower += day1[0] * System.Math.Pow(calcTime, 5);
            if (CurrentPower < 0)
                CurrentPower = 0;
            Debug.Print(CurrentPower.ToString());

Fixed Casting Issue
 
When I put your equation into google, it gives me a really strange graph. It starts out as a bell curve, but then on the drop, just goes to the negatives.
How are you implementing this?
 
When I put your equation into google, it gives me a really strange graph. It starts out as a bell curve, but then on the drop, just goes to the negatives.
How are you implementing this?

Good question! The current curve I"m using looks a bit like this over the 24 hour span we'd calculate for:

08.05.2013-14.50.png


When anything comes back from the calculation as negative, I simply use 0. This gives me a little more control of the curve while being able to bury the 2nd 4th and 5th terms negative to get the shape above 0 how i want it, and simply substitute 0 for a negative number.


I'm now setting the lights based on this calculation. Thank you BeanAnimal for the prodding in this thread to get it done.

I'm also just using 1 equation and scaling blue vs white vs UV. Code time:

Code:
public void calculateLights()
        {
            double[] day1 = new double[] { -0.0346, 2.5909, -69.363, 763.25, -2716.8, 11.33 };
            double CurrentPower;
            double calcTime;

            while (true)
            {
                CurrentPower = day1[5];
                calcTime = DateTime.Now.Hour; // hours in 24 hour format
                calcTime += (((double)(DateTime.Now.Minute) / 60)); // convert minutes to fractional hours
                CurrentPower += day1[4] * calcTime;
                CurrentPower += day1[3] * System.Math.Pow(calcTime, 2);
                CurrentPower += day1[2] * System.Math.Pow(calcTime, 3);
                CurrentPower += day1[1] * System.Math.Pow(calcTime, 4);
                CurrentPower += day1[0] * System.Math.Pow(calcTime, 5);
                if (CurrentPower < 0)
                    CurrentPower = 0;
                int SetPower = (int)(CurrentPower);
                caclLights[0] = SetPower * .75;
                caclLights[1] = SetPower;
                caclLights[2] = SetPower * .25;
                caclLights[3] = SetPower;
                caclLights[4] = SetPower * .75;
                if (mainLights.Override != true)
                {
                    mainLights.fadeTo((int)(caclLights[0]), (int)(caclLights[1]), (int)(caclLights[2]), (int)(caclLights[3]), (int)(caclLights[4]), 2);
                }
                Thread.Sleep(3000);
            }
        }
 
Why did you opt to use your equation instead of a simple bell curve?
Something like 100/(1.001^x^2)?

Prefer to not have to have the morning and the afternoon be the same, and I'm going to have even more complex equation (days) ahead- these are a few things that can be accomplished with more terms vs a simple curve.
 
Realized last night laying in bed I approached the fade method poorly. I knew it had work to be done to make it the best it could be but my solving for step size is silly.

What i should be doing?

Solving for delay. I can fade from zero to 100% very quickly, in only very very special circumstances will I need to go faster than 1 unit per millisecond and I can handle those separately. I think I'll re-write my fadeto method to calculate delay and assume 1 unit step size.

I laid awake last night writing the code in my head, so there isn't much besides finding time in the next few days to get it onto a computer left.
 
Okay haven't re-written the fadeto method (:hammer:) but have sat down and fixed up and tested the webserver a bit more after the controller locked and nuked my tank :facepalm:. My own fault, I felt good enough to use it with a titatinum heating tube (either heating or not, no built in temp control), not a regular heater, so there was no fail safe. I was also running with normal on (since it had been using a normal heater) which led to an overheat.

No worries, it is now normal off, adjusted that code flipped the relay, and have done some stress testing to ensure the controller doesn't lock up when swamped with web requests, seems stable now so that's one bug worked out.

Also begun work on a windows program that get status and has ability to set functions as well, so that will arriving soon, so you don't have to be in the same room to view tank status.
 
MY two cents...

I would NEVER trust temperature control to an aquarium controller (be it DIY or commercial). A dedicated commercial/industrial temperature control as simple as a Ranco, or as expensive as a commercial (not eBay import crap) PID should be used.

In this way, an I/O error or faulting I/O can not alter the systems temperature control, nor can unexpected user written logic. The temperature controller does one thing and does it well. Properly chosen, it will be fail-safe (both on and off) and be stable regardless of what the "aquarium controller" does.
 
MY two cents...

I would NEVER trust temperature control to an aquarium controller (be it DIY or commercial). A dedicated commercial/industrial temperature control as simple as a Ranco, or as expensive as a commercial (not eBay import crap) PID should be used.

In this way, an I/O error or faulting I/O can not alter the systems temperature control, nor can unexpected user written logic. The temperature controller does one thing and does it well. Properly chosen, it will be fail-safe (both on and off) and be stable regardless of what the "aquarium controller" does.

Logical people would agree with you, trust me.


I don't disagree that it's a nice failsafe that my big tank will have, but frankly, if I can't get more than 10 days of stability I'm doing something wrong on the controller end of things. I've spruced up my code a bit, and am off on another stability test- I know it's the webserver or the light calculation method as I went months with it before not having a problem.
 
I would still shoot for the stability, but leave the life support out of the equation. There are simply too many variables to account for related to hardware failure (single point and cascading), platform related bugs and user induced logic failure.

I long ago settled on leaving temperature control and dosing control as isolated systems so that failure modes and probability can be managed. Wave makers, skimmers, closed loops, lights and other non critical systems are all candidates for common control (at least in my opinion).
 
I agree with BeanAnimal, somewhat. I feel that you should always use something that is temperature-controlled (like a Jager) when using heaters with aquarium controllers. Keep the tank at 78* and set the heater to 80*.
 
I would still shoot for the stability, but leave the life support out of the equation. There are simply too many variables to account for related to hardware failure (single point and cascading), platform related bugs and user induced logic failure.

I long ago settled on leaving temperature control and dosing control as isolated systems so that failure modes and probability can be managed. Wave makers, skimmers, closed loops, lights and other non critical systems are all candidates for common control (at least in my opinion).

I agree with BeanAnimal, somewhat. I feel that you should always use something that is temperature-controlled (like a Jager) when using heaters with aquarium controllers. Keep the tank at 78* and set the heater to 80*.

As I said, I'll have a heater controller as a backup but if the controller can't control the temp then it has failed at one of it's duties- the only backup I want is in case the controller completely fails (locks up, burns out, whatever) in which case right now the tank just slowly cools off (no heat) eventually it'll be able to keep temperature without the operation of the controller but I prefer to have the controller keep control in most cases.

Heater operation is something that's interesting to look at, in my 29 gallon tank with a 400 watt heating tube it's a possible 105 degree disaster as I've seen- in a 300+ gallon system two 400 watt heaters things will take quite a while longer to end up at inevitable death and major issues. I've actually got some nice code that handles issues and reboots the board now as well, so if it can't turn off the ATO or heater it just reboots itself.

Overall, the bugs are coming to the surface, which is sort of the goal right now, shake out all the possible issues until I'm happy with the performance.
 
Back
Top