The Planted Tank Forum banner

Hunter X's Arduino Whole Tank Controller (52K Warning)

55K views 226 replies 23 participants last post by  HunterX 
#1 · (Edited)
Hello Everyone!

Parts list on post #13
Code on post #156

A few months back I stumbled across an Arduino thread. I can't remember what exactly led me there but I remember a thread about Auto Dosing FERTS sparked my interest. While I was back home, I'm currently deployed to Kuwait, I was growing tired of dosing FERTS every morning before leaving for work. Not so much the mixing of FERTS and playing in the tank, rather having to get up 20 mins early for work was getting old. Naturally, the ability to dose FERTS automatically pecked my interest immediately. Like many I started researching and learning how the "Arduino" worked. As I researched it I noticed several individuals were using it to control parts of their tanks. I hadn't noticed a design that controlled all of aspects of the tank. With that being said, I decided I wanted to try and build one that would control all my filters, heaters, FERT dosing, power heads, CO2, lights and feeding. If had the ability to plumb an ATO I would have it control that as well. (currently renting my house). Seeing how I wanted to control so many components, the Arduino Mega was the only board that would have enough inputs/outputs to meet the requirement.

1ST Step: Fortunately for me, the Army saw fit in its wisdom to have a "Wood Shop" on post so Soldiers could have something to do during their down time. That is where I started. I originally planned to have the controller box fit under my stand but after I completed the box, I decided it turned out locking too nice to be hid under the stand. So it will sit beside the stand.



The stand was designed to hold three bottles of premixed FERTS under it. MACRO, MICRO and FE. I figured that would cover the FERT requirements. Below you can see the 3 dosing pumps as well as how they are wired. I choose to use bricks with quick disconnects to keep the wire as neat and tidy as I could.





Next to the DC motor controller are the three variable DC controllers. I stacked them to create more room in the box. They are used to reduce the 12 volts from the 12v AC to DC converter to 9v for the Arduino, 5v for the relay board, and then 5v for the Sensor Shield. I will run 12 volts straight from the AC to DC converter to power the 12v for the DC motor controller.

Speaking of power, the below pictures shows how I take the 120v coming into the box to the distro blocks and then to the relay board so I have the ability to turn on and off each of the 120 plugs. Each of the fist tank components will plug into the 120v sockets (not the lights).





I loved the idea of everything being on a schedule which is controlled by the Arudino but what if I wanted to shut down just one pump to clean or one of my power heads. I didn't like the idea of having to always unplug it or power down the whole Arduino in order to do that. I decided to have a button that I could press to shut down the corresponding item/relay so I could perform whatever maintenance I needed to do. So across the front you see 8 green buttons. The buttons light up when the corresponding component is power up. The LED within the button works independently of the button. Remember the Arduino controls the relays automatically so if the programming has that component "on" the corresponding button will light up. But if I push the button the automatic control will be interrupted and the corresponding relay will shot off. Ok but what if I want to shut everything down do I press all the green buttons or unplug the Arduino? NAH that is what the two red buttons below the LCD do. If I bush the red button on the left it shuts down everything except for the lights. So guess what the red button on the right does? Give up? It shuts the lights off. With all the buttons all you have to do is release them and the automatic control will take back over.

I still have to get the AC to DC converter installed, it was on back order for three months. I also have to get the DIN connectors installed so the controllers for the LED can plug into the back along with temp probe. The heater is turned off and on by the arduino based on the TEMP of the tank. So as long as the probe doesn't fail it doesn't matter if the heater gets stuck on, the Arduion will just kill the power to heat when it gets to the HIGH Temp Limit. I have to get the DIN for the autofeeder installed to. So yeah I'm about 85%. Below are a few more pictures. I would love any insight or comments you may have!







 
See less See more
9
#188 ·
Wow. Such an awesome thread.
So many pages to read through. I am gonna start a similar project soon. I am getting acquainted with arduino right now.
I have a few more ideas in mind like adding a pH probe and a touchscreen for the interface.
I am glad to find this thread because now I know which people to ask if I encounter a problem ;)

Thanks,
Sumer.
 
#192 ·
Hey guys, I have been working on putting together a custom Arduino Mega Shield that will accomodate a lot of what we're doing here. There's a place for an RTC, an Atlas Scientific ph curcuit (actually, it will fit any of their embedded circuits), a female bnc connecter, you can connect 12v power directly to the shield, which will run the up to 3 pumps connected to the on board screw terminals, there is a group of four I2C device input headers, an IR LED to control the Current Satelite+ (or anything else you can come up with!), and 6 headers for digital inputs/outputs. You can check out my Fritzing File here: https://www.dropbox.com/s/suu31k4vy3s1qv7/MegaMegaWickedAquatic.fzz

Would anyone be interested in buying some? I can get them ordered in batches of 3 for about $18 each, and i can do a bulk order for the components (not including the pH circuit and BNC connector). That will add about $30 to each unit. If I can get an order of 18 or more, then the price for the PCB drops down to like $8.50. The price of the components would drop as well, but I haven't done the math on that one yet.

Here's a render of how it will look:



What do you guys think?

Also, this is my first time doing anything like this so if there's any mistakes, feel free to let me know.
 
#197 ·
#198 ·
I checked iteed out and they look pretty good, lots of reviews say they're pretty good quality with really fast turn around. I can definitely fit into the 10x10cm. I'm working on an alternative layout as well that moves the pH stamp and connector to the back, so you can still put other shields on top. I'm gonna make a whole new thread about this tomorrow to see how many people would be interested.
 
#203 ·
#200 ·
Hello everyone. I finally got home and got my controller connected to my 120g tank. Its working like a charm. The ferts are dosing perfectly. All the components are turning off and on when they should. I still have two things I would like to add to it. I want to test and display the PH on the LCD and I have got to figure out how to use the wifi without locking the Arduino up if it doesn't resolve/connect to a website.

I'll post some pictures of it working away this evening.
 
#202 ·
Welcome HOME!!!
No one give you hard time to cary this project around? :)

Again, awesome project!

Aram
Sorry I didn't reply sooner. I saw this message and then got busy and forgot to reply. Lucky for me I didn't carry it back to the states. I was able to mail it home through USPS with no issues. The did break one of the joints free on the lid. It wasn't a big deal. A little wood glue and it was as good as new!

Bump: Sorry I still haven't posted any new pictures. When I get home from work I start playing with everything and forget to take updated pictures. I'll get some posted soon. I did order the ATLAS ph kit. My first impression is a good one. I'm only having one issue. It's not calibrating correctly. It calibrates to 7.0 ph with no issues but will not calibrate to 4.0 or 10.0. I contacted the ATLAS customer support and they responded right away. I haven't been able to work through their troubleshooting instructions yet but should be able to tomorrow night. If anyone is interetested in adding the abiltiy to track PH to their controller, I really think this is the way to go.
 
#209 ·
I just wanted to drop in and say this is an awesome build! Excellent job Hunter! I somehow missed this thread until recently (I think because I was so engrossed in my own project). I finally read through the whole thing, and I'm super impressed.

One thing that might make things cleaner for scheduling is to use the Time.Alarms library. I used it in my project, and it's nice that you don't have to check time in the loop to catch things. It also makes it easy to change the schedule. If you read the docs, you can adjust the library to do up to 255 timers. It has quite a bit of functionality.

Here is an example. This one line below would be executed at startup and creates a schedule that'll run a routine called "lightsOn" every day at 11:00am.

Code:
Alarm.alarmRepeat(11,00,0, lightsOn);
The lightsOn routine could look like this:

Code:
void lightsOn()
{
   digitalWrite(pwrLightPin, HIGH); // this turns the relay on
}
That's it — super easy! It also opens the doors to making it pretty easy to edit the schedule through a menu, and saving that in EEPROM.
 
#212 · (Edited)
I just wanted to drop in and say this is an awesome build! Excellent job Hunter! I somehow missed this thread until recently (I think because I was so engrossed in my own project). I finally read through the whole thing, and I'm super impressed.

One thing that might make things cleaner for scheduling is to use the Time.Alarms library. I used it in my project, and it's nice that you don't have to check time in the loop to catch things. It also makes it easy to change the schedule. If you read the docs, you can adjust the library to do up to 255 timers. It has quite a bit of functionality.

Here is an example. This one line below would be executed at startup and creates a schedule that'll run a routine called "lightsOn" every day at 11:00am.

Code:
Alarm.alarmRepeat(11,00,0, lightsOn);
The lightsOn routine could look like this:

Code:
void lightsOn()
{
   digitalWrite(pwrLightPin, HIGH); // this turns the relay on
}
That's it — super easy! It also opens the doors to making it pretty easy to edit the schedule through a menu, and saving that in EEPROM.
Hey Hobby,

That does look like it would make my code more simple but I have a question. Say I wanted to turn something on at and exact second and then turn it off at an exact second. Have you seen any issues where the areduing misses that second and skips that alarm. I have an automatic feeder connected to my Arduino. I drive it through a transister using the 5 volts from the Arduino. It takes 5 seconds for it to complete 1 feed cycle. I turn it on say at (11,05,01) and turn it off at (11,05,04). What do you think?

Bump:
Check out what came in the mail today...





The AquaShield boards!

I think they look great! I tested the pump controls, and they all work flawlessly! Really stoked.
Those look great bigd!
 
#220 ·
Check out what came in the mail today...





The AquaShield boards!

I think they look great! I tested the pump controls, and they all work flawlessly! Really stoked.
Bigd,

Do you have the atlas ph board? If so I have a few questions for you.
 
#218 ·
Yes, I just grabbed the line I had in my project. :thumbsup:

Would I really have to use the "Alrarm.delay(5)"? If I just turn it on and then turn it off 5 seconds later wouldn't that do the same thing? Which would be more effecient way of coding?
You have to use Alarm.delay(n) no matter what in your loop (where n can be any number of millis). It's what calls the TimeAlarms library.

The timer library also has "Alarm.alarmOnce" instead of "Alarm.repeat". You could just kick that off when you start, with the Once timer set to kick off 5 seconds later. Go through the readme, it's pretty easy to use.
 
#225 ·
Hey bigD how are you doing? How are the boards working. Are you using the Atlas Ph chip. I noticed it in the picture of your boards. If so what version and how is it working for you. Mine runs great when I load only their code. When I add their code to my sketch it starts responding funny after it reports the PH 12 times. It reports more then 1 reading per line which makes it very hard to display the PH reading on the LCD.
 
#227 ·
Hello everyone. Sorry I haven't added anything to this in a few years. In cause someone stumbles across the thread and is concerned about the longevity of this project, it's still running strong controlling my 220G now. I was able to get the PH added to it with out issue.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top