/*my last few posts were too vague for assistance so i drew up what it is that i need,...please take a look and give me any help you can.i am new to arduino and C/C++...but that is why i come to you....i am studying EE, so i know my way around components and equipment, just not the coding and sketching of the IDE...I have the cookbook on the way... But that will only help so much. thnkx/*

Overall your plan is ambitious but seems well thought of. In this plan, various things need to be monitored or controlled simultaneously, while the lcd keypad accepts inputs. You will need to write your code with state machine. It's extremely difficult for first timers. Plus you have your unique hardware so online forum members that don't have your hardware will be able to provide limited help.

Is there a slightly less ambitious plan that involves less components to control and sense?

yes, i could take the cheesy way out and just buy another 400$ light set with pre made controller, what fun would that be right....i just need the clock to work with the display to control relays.the relays will do the switching of the lights at their respective times.the fan relay will be harder with the temp sensor input for the light fans.and that's it...I'm still looking for alarm codes that i could tweek.. not many to choose from.

Overall your plan is ambitious but seems well thought of. In this plan, various things need to be monitored or controlled simultaneously, while the lcd keypad accepts inputs. You will need to write your code with state machine. It's extremely difficult for first timers. Plus you have your unique hardware so online forum members that don't have your hardware will be able to provide limited help.

Is there a slightly less ambitious plan that involves less components to control and sense?

i looked at the state machine you mentioned, that's where i am going to need the help and guidance from this arduino forum, i just don't know all my options for this project

I didn't quite follow that circuit using a SPDT relay to drive the blue/white LEDs. Firstly because the diagram shows the relay in a mid position, but a conventional SPDT relay has a common contact, a normally open contact and a normally closed contact; except when the relay is in the process of switching, the common terminal is connected to either the NO or NC terminal. Secondly, I don't understand why one LED is backwards and there is another diode between them. Is there something clever going on here - if so, what?

As far as sketch design goes, I suggest that you design the sketch to be non-blocking and modular. Implement each major functional area with whatever global data it requires, and functions to be called from setup() and loop() to carry out the corresponding behaviour. These functions should be non-blocking (should not stop and wait for some external event to occur). The preferred approach to implement this is to design your code to check for events that might need to be handled, such as input arriving on a serial port, or some scheduled action being due. The 'blink without delay' example sketch demonstrates how to use this approach for simple timed activity (blinking an LED on and off at regular intervals) and I recommend that you follow a similar approach for the other things your code needs to do. In this way your code can check for and handle all the tasks that need to be performed, without any piece of the code needing to cooperate with or be aware of what any other parts are doing. The only overriding requirement is that you stay within the total available memory, and that all of your code completes quickly enough that you can complete the loop fast enough to meet your latency requirements.

I only provide help via the forum - please do not contact me for private consultancy.

you're right, i drew the led backwards...oops.. good catch. it was late and nyquil was catching up...and i might be wrong but the SPDT here has three conditions, blue/off/white and bluethe SPDT is the current setup on the lighting fixture. i am going to remove that switch and put a new jack in its place to run the wires to the relay board for switching.that way i can switch between white and blue on both runs of lights at their respective times.i could have the fans come on when the first set of whites come on and go off when the second whites go off.that would eliminate the need for the temp sensor. but it would be way more efficient with it.

and i have minimal to no idea about the sketching parts you mentioned, sorry i'm just new to C++ and arduino IDE

after studying your reply, i believe i know what you are talking about as far as trying to keep it simple(KISS).but as far as all the code language and the usage of each command and function lingo, i am lost. i know i need an "int, include lib, or h., setup, loop the brackets and { }, and all the ;'s ()but i don't know how when or why to use them, that is where i need the assistance i guess.if no one here helps me, maybe this CookBook that comes in monday will. it'll just take alot longer..

Lots of good advice here. A traditional approach for complex system development is "Stepwise Refinement".. championed by Nicholas Wirth, who created the PASCAL language.

You could write the outline of your system with Procedures for each major function like ControlPump or ReadLightSensor or ReadClock or ReadUserInput, but have those procedures at first do nothing at all. You could define your State Machine and debug the logic it implements with long delays and outputting the State Variable to the serial monitor to see where you are. Make your procedures put out phoney expected data to see that it is handled correctly. Leave the real-time type things until last.

I was in your position around 2 years ago when I considered making my own led controller, which over the following 12 months turned into a fully blown controller for all of my equipment i.e. return pumps, skimmer pump etc. This was initially based on a 20x4 LCD display and keypad but I am currently working on a TFT LCD with Touch screen controller.

You may find that someone else has done exactly what you require using your hardware, but the chances are slim. So, if you are going to end up with what you want then you will need to learn the programming language. Take baby steps, add one thing at a time and get that working - start with blinking a led so that you understand what you are doing.

This forum is great for answering specific questions that you may have, but you can't expect someone to teach you the language - my estimate is that my first controller would have taken in excess of 200 hours to complete, spread over 12 months but lots of that was researching how to do things.

There are quite a few threads on Reefcentral which may help get you started.

well it's been a few days and no one has been able to tell me anything new....anyone else?

I, for one, don't know where to get started with helping. Your project is pretty large and you don't have code yet. Everyone here can help you with small steps, not simply because it's a free forum, but more or less because no one knows exactly what you need. With some code, we can say "this portion should look like this" or "that part is missing something". With a plan and no code, I'm not sure I want to dive into it. It's deep water with unknown depth. If you want some simpler plan executed, someone may even come up with a skeleton code. I do consulting work on software and hardware. If this were a consulting job, I'd be asking a lot of questions for details and investing major time to write code to work. I expect your code to be somewhere around 750-1000 lines of code when complete but at least several hundred lines to get it started. I doubt anyone will invest that much time for another forum member. It's work for several nights if the person has the hardware and several hundred dollars of pay. If you get to the several hundred lines status and then ask, you get more responses since we can build upon your existing project now. Not trying to throw you a wet blanket but I'm can't sweep away the feeling in my original reply, too ambitious as your first(ish) project.

*/great reply and very helpful, thank you;fear not, i am working with others with the skeleton and then meat;my last post a few minutes ago was more antagonistic and provoking than anything...stirring the pot, and look, you wrote with a good view and some great advice;like the code, a little will go a long way;i will be sure to post the finished product, the code, and schematics when done;thanks

Have you considered a bottom up approach? Rather than worrying about the big picture and struggling because of the complexity, take a subset of the system and get that working. Either as a standalone sketch or better as a function or two that are called from loop. One place to start might be be reading the RTC - trivial, because you can likely lift all the code from existing examples. Then write something that prints to the serial port what you should be doing at that time of day.

Then add the temp sensor that checks on the lights. Once that's working, put in the stuff to control the fans that cool them. etc. etc.

This way, you'll acquire a set of functions you can use as building blocks for your system and best of all, you'll see some immediate progress. Another advantage is that people here can give you some concrete advice if you're having issues with these sub projects because you'll have some code and circuitry that they can comment on.