Thanks for posting you code Hunter. I finally had time to go through it today and I think I have a better idea of how I'm going to code my scheduler.
It's very easy to follow and well commented, thanks again.

I do have a question tho. Say that your powerhead #1 (relay3) automatically turns off at 5pm. What happens if you want to manually turn it on after 5pm?

Not sure if I read the code correctly or understand it completely, but it seems like your buttons can either turn a relay off OR allow the scheduler to take over. Do you consider the opposite where you might want force a relay on?

That's where I ran into the problem and started coding 3 states for each button: ON-OFF-AUTO (unless you don't care about forcing a relay ON)

Thanks for posting you code Hunter. I finally had time to go through it today and I think I have a better idea of how I'm going to code my scheduler.
It's very easy to follow and well commented, thanks again.

I do have a question tho. Say that your powerhead #1 (relay3) automatically turns off at 5pm. What happens if you want to manually turn it on after 5pm?

Not sure if I read the code correctly or understand it completely, but it seems like your buttons can either turn a relay off OR allow the scheduler to take over. Do you consider the opposite where you might want force a relay on?

That's where I ran into the problem and started coding 3 states for each button: ON-OFF-AUTO (unless you don't care about forcing a relay ON)

You make a great point. I didn't think about needing to "force" a relay on. I think this can be done pretty easy by adding another "if" statement to the "if" statement that shuts the relay off. It would just ask it to check the Boolean to see if it is true. If it's true, turn the relay on. Let me play with it and I'll get something back to you. Thanks for pointing that out.

SO I have been making a lot of good progress on my project (after not doing anything for far too long), and I have got the thing online, its serving data to a website hosted on a raspberry pi (check it out here, but keep in mind its still very early in development), and the site has graphs fed from Xively, but im having some issues with some timing aspects of my sketch. I want the arduino to to feed the data to Xively every ten seconds without using a delay command so the rest of the sketch doesn't get held up in the mean time. I'm using the millis method from the Blink Without Delay example. It works well for a while, but after several hours it stops the feed until i reset the Arduino. I think it has something to do with the millis crossing over, but I don't really know how to fix it. Anyone have any ideas? Here's my sketch:

I want the arduino to to feed the data to Xively every ten seconds without using a delay command so the rest of the sketch doesn't get held up in the mean time. I'm using the millis method from the Blink Without Delay example. It works well for a while, but after several hours it stops the feed until i reset the Arduino. I think it has something to do with the millis crossing over, but I don't really know how to fix it. Anyone have any ideas?

Nice to see someone is making progress!
Any particular reason for using millis rather than a timestamp from the RTC? If you do want to use millis you will have to handle rollover. That could be done with something like this:

Nice to see someone is making progress!
Any particular reason for using millis rather than a timestamp from the RTC? If you do want to use millis you will have to handle rollover. That could be done with something like this:

Thanks Benjaf, I didn't do the RTC time stamp at first because I was also worried about a rollover scenario (if it checked if lastXivelyPut >= second() + 9 or something like that) when the second rolled over into the next minute. But thinking about it, I could just have it check if second = 0, 10, 20, 30, 40, or 50. That would give me the same result without worrying about a rollover. Thanks!

Thanks Benjaf, I didn't do the RTC time stamp at first because I was also worried about a rollover scenario (if it checked if lastXivelyPut >= second() + 9 or something like that) when the second rolled over into the next minute. But thinking about it, I could just have it check if second = 0, 10, 20, 30, 40, or 50. That would give me the same result without worrying about a rollover. Thanks!

You're welcome!
Most RTC libraries also have an option to return a proper timestamp, usually Unix time (seconds since 01-01-1970) or seconds since 01-01-2000 which would be ideal for this use since it doesn't roll over any time soon.

You're welcome!
Most RTC libraries also have an option to return a proper timestamp, usually Unix time (seconds since 01-01-1970) or seconds since 01-01-2000 which would be ideal for this use since it doesn't roll over any time soon.

Benjaf to the rescue! Thanks Ben. I have been so busy. I'm getting ready to redeploy back to the states. Can't wait!

Well, someone has to troll the board, and it is a lot easier to find time for than playing around with the soldering iron.. Don't you just hate when real life gets in the way of a hobby!

Hey Ben,
Sorry if I sounded sarcastic. You have made a huge contribution to this thread and project. I sincerely appreciate your help and input. As soon as I get back to the states I can get back to giving this thread the attention it deserves!

Hey Ben,
Sorry if I sounded sarcastic. You have made a huge contribution to this thread and project. I sincerely appreciate your help and input. As soon as I get back to the states I can get back to giving this thread the attention it deserves!

Oh, not at all! :-) I just had a kid not long ago - and really don't have time to get anything done. That part rather sucks! ;-)

Looking forward to see the final result once you get back to the States!

Most of the parts are in, but I'm still missing the 8-channel relay board, 4x24 LCD, and the 10P terminal blocks. They are coming in from China so it still might be 1-3 weeks from now. Also, I ordered a wood box for the project since I don't have any woodworking skills or tools. That's still about 2 weeks away from arrival. I don't think I'll really be able to start before getting the box.

Here's a quick pic of where everything stands:

This will be very similar to your project except I have less space to fit everything in so it will be a bit of a challenge.

I will be adding an in-line fuse for the AC line before the terminal blocks just to be safe.
Also, I'll have a second LCD screen inside the box (above the power supply). The screen has pushbuttons so I was thinking of making the second screen a menu that will allow me to select LED brightness, morning ramp-up time, nightime, time set, and fan speed.

I kinda decided not to do temperature or PH readings from the tank. My tank is a small 10G rimless tank, and I'd like to minimize the amount of wires going in and out. I won't be doing any sort of ethernet/wireless communication since I don't see the point with my specific setup, it also keeps things simple.

I think the biggest thing for me is that I'll be able to control relays, LEDs, and dosing pumps from the same RTC module. Right now I have 3 different timers in my tank and already had several accidents happen while I'm on a trip. Also, with pushbuttons to control the relays, it will be a breeze to disable outlets for doing maintenance.

Thanks again for posting your project up so everyone can see it. It made me take the plunge and get started on this. I'll keep you posted on any new ideas or discoveries I make while working on this.

I used a 10A 20mm fuse. There is a fuse drawer included with the module where the power cord plugs in.
The relays' max current spec is 10A so that's the main reason I chose this value.
Also, I don't expect the current draw for the controller to be more than 10A even with heater, filter, lights, skimmer, etc all connected and on at the same time. If for some reason my controller is drawing 10A at 120V, then there's a huge problem happening somewhere lol.

I used a 10A 20mm fuse. There is a fuse drawer included with the module where the power cord plugs in.
The relays' max current spec is 10A so that's the main reason I chose this value.
Also, I don't expect the current draw for the controller to be more than 10A even with heater, filter, lights, skimmer, etc all connected and on at the same time. If for some reason my controller is drawing 10A at 120V, then there's a huge problem happening somewhere lol.

Is this what you used for the power module? There's a place to put a fuse in that little guy?

I ended up changing the power entry module from what you see in the picture above.

I'm using Corcom PSJS0SBX0(Warning PDF). It doesn't have an EMI filter, but it has a switch and fusebox. I figured that I didn't need an EMI filter since my 12V power supply has one included. It was pretty much the only thing available at my local electronics store that met my requirements.

You can take a better look at the pictures I posted on post #141 earlier. It's the big plastic box on the back right corner.

First of all, Hunter thank you for your service. i make it a habit to thank all who have served, and i am teaching my 5 y/o to have the same respect that the service men and women of our country deserve. Second all i can say is WOW on this build. i did a diy aquarium controller about 15 years ago, all timers, relays and 2 PLC ( setup by the maintenance tech for me) for the heating and cooling, no dosing. with all i have been reading about the arduino's lately i am becoming very interested, and my wife can tell you that is not a good thing when it comes to my wallet. you have taken every aspect of normal aquarium attention, and automated them all. i am curious to know who easy would this be for someone like me with very little experience with PCB and no experience with coding be to do?again great work and have a safe trip home.

Register Now

In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:

Password

Please enter a password for your user account. Note that passwords are case-sensitive.

Password:

Confirm Password:

Email Address

Please enter a valid email address for yourself.

Email Address:

Location

Your Location. As precise as you feel comfortable with.

Security Question

While balancing on a piece of wood, two inches by four inches known as a 2x4, John and his friend Sally both spotted a dalmatian inside of a truck with sirens. The animal with John and Sally is a _ _ _?

Insurance

Please select your insurance company (Optional)

Log-in

User Name

Remember Me?

Password

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.