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
#8 · (Edited by Moderator)
this is great! can we get a parts list, schematics?

I've been wanting to build one with one of the raspberry pi's I have here.

I'm rather new to electronics, so i've been having trouble figuring out what components to purchase. But, I'd be surprised if we don't have the same pumps.

gorgeous work all around.

Thank you everyone! I should be able to do a parts list realitively easy. I think I have all the packing list that came with the parts. I schematic may be a little harder....

Nice work! Makes me want to get back to finishing up an aquarium web controller. I'm starting to see limitations though, so the Rasberry PI might be a route.
I was looking at adding WEB Control to mine as well. I'm curious as to what limitations you see. Thank you in advance for your reply!
 
#9 ·
That's impressive, I've been brushing up on my programming because I have an Arduino on the way and I plan to build my own tank controller. I'm sure I'll find quite a bit of inspiration from this thread.
 
#14 ·
Man you are fantastic!

I've been really debating between getting an neptune apex or rolling my own solution. I've got two raspberry pi's here just waiting to be abused. I've been trying to decide between going the respectable, but obvious, route of using python. Or taking the plunge with node.js, well more specifically meteor.js; which is a web sockets based library that uses node.

I'm intending on a fully web based GUI for the controller so i'm really thinking i'd lean towards meteor, with one of the handful of node gpio libraries. meteor js code is shared by the front and back end, with the ability to have front/back specific code that isn't seen.

thanks for your shopping list. hardware is a bit confusing for me as I've really no experience there. :thumbsup:
 
#27 · (Edited)
My AC to DC Convert finally came in. (Don't mind the sloppy wire job. I haven't cleaned that up yet). It works like a charm. It holds @ 12.05 volts on the money. The DC to DC converters hold on their set voltage perfectly as well. I'm really happy how the power management has turned out. I'm now able to plug the box into the wall (110 or 220V) and it runs just as planned. Now it's time to start working on the LED Light controls.









 
#29 ·
The AC to DC converter does supply all of the DC current for the box. 12v straight from it to the power FET. Then from the converter to the step up/down, in my case step down, to the Arduino (9v), the Relay Board (5v) and the Sensor Shield (5v).

I got the AC to DC converter from www.jameco.com. This one is the same specs as mine. I couldn't find the one I got.

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_323300_-1

Yea I was waiting for the converter. Its all running now!
 
#30 ·
Wow, this is looking great!
Thanks so much for the parts list. I've had an Arduino Mega controlling my LED lights for about a year now and wanted to expand it to a complete aquarium controller but never knew how to approach this. Your thread has given me a clear path on how to get things started.
I actually ordered most of the components already and it looks like I'll be building a clone of your project. Thanks again!

Btw, I see that your dosing pumps and fan are connected to the 4 channel MOSFET board. Did you consider placing a diode in parallel to each pump/fan to protect your transistors from flyback?
http://en.wikipedia.org/wiki/Flyback_diode
I think Shift's dosing pump project has some of these installed, but it seems like the transistors are pretty beefy though so it might not be necessary at all. Maybe someone here with electrical experience might be able to offer some advice.
 
#42 · (Edited)
As I got pulled into the diode conversation I didn't thank for your kind comment. Thank you!! :) Please feel free to use any of the design you would like. I only ask in return to post anything you come up with so we all can share and better what we have. Thanks again!

Question? You mentioned you use the MEGA to control your LEDs already? Do you do any fading or just off and on?
 
#31 ·
Btw, I see that your dosing pumps and fan are connected to the 4 channel MOSFET board. Did you consider placing a diode in parallel to each pump/fan to protect your transistors from flyback?
http://en.wikipedia.org/wiki/Flyback_diode
I think Shift's dosing pump project has some of these installed, but it seems like the transistors are pretty beefy though so it might not be necessary at all. Maybe someone here with electrical experience might be able to offer some advice.
Yes, there should be a flyback diode across each of the motors. They are not included in most MOSFET boards, but when driving motors you should always use one to protect the rest of the components.
 
#33 · (Edited)
From what I understand, the opto-isolation will protect the Arduino side of things so the Arduino will be fine, but there is still a possibility that the opto-isolator or the IRF540 MOSFET might be damaged by flyback current/voltage. Looking at the circuit for this board, I'm not entirely sure how it would react immediately after the MOSFET cuts power to the motor, but having a flyback diode would be the safest way to go. Again, I'm not very experienced with this so there is still the possibility that the MOSFETS this board uses are beefy enough that you won't need any diodes.

I'm more concerned about the fan than the 3 dosing pumps. I think the pumps don't pull much current, but a fan that size probably runs around 12V @ 1A. Immediately after shutting the fan off, you might see very large voltage changes on this side or the circuit.
 
#36 ·
I'm more concerned about the fan than the 3 dosing pumps. I think the pumps don't pull much current, but a fan that size probably runs around 12V @ 1A. Immediately after shutting the fan off, you might see very large voltage changes on this side or the circuit.
Completely forgot about the fan - flyback diodes all around then!

And as bigd points out - they are a LOT cheaper than the 4-channel MOSFET board.
 
#34 ·
While not quite as important, I would still include them to protect the MOSFETs from the voltage spike. However - since the pump motors are not that large and aren't exactly 'freewheeling' when turned off, you may be fine without diodes.
It is simply a good idea to include them any time you drive motors or solenoids unless you know for sure that the reverse voltage will cause no damage. :thumbsup:
 
#37 ·
Good input everyone. I looked at the schematic for the board as well. Why the diodes are not included in the design is beyond me. I already have the diodes and will incorporate them into my plans. Thanks everyone!
 
#38 ·
Man, this thread is golden. I've been looking at doing exactly what you are doing with my tank. I've been looking at getting the arduino duemilanove which is the next step up after the mega. I eventually plan on doing an actual LCD display on mine, with options to edit the dosing schedule via toggles and buttons.

But for now, my main goals are basically, auto top off, water changes, DIY LEd ligthing, along with ph probes, and temp probes.

How long did it take you to familiarize yourself with the necessary components?
I'm a sophomore in Elec. Eng, lots of background in coding, but less so with the hardware.

Looking forward to where this thread goes,
Joshua
 
#39 ·
Man, this thread is golden. I've been looking at doing exactly what you are doing with my tank. I've been looking at getting the arduino duemilanove which is the next step up after the mega. I eventually plan on doing an actual LCD display on mine, with options to edit the dosing schedule via toggles and buttons.

But for now, my main goals are basically, auto top off, water changes, DIY LEd ligthing, along with ph probes, and temp probes.

How long did it take you to familiarize yourself with the necessary components?
I'm a sophomore in Elec. Eng, lots of background in coding, but less so with the hardware.

Looking forward to where this thread goes,
Joshua
To be honest, with all of the information on the web, it doesn't take long to become familiar with any of the components. I stumbled across most of it while studying other components for my build. I would like to add ph probes as well but I'm slowly running out of inputs/outputs because of the buttons and LEDs. Having the buttons makes the programming much easier. But one solution would be to use a touch screen LCD and build "buttons" within the touch screen programming. I'm not at that level yet. My design does have an LCD display but it is not a touch screen. It’s the 20x4.
Another added benefit is that my code is only 19,000 bytes. So it's relatively small compared to some of the other full tank codes. Granted, I haven't added the LED code yet. I expect it to almost double in size when I do that.
 
#43 ·
Do any of you use any type of surge protection for your system. Further more, would it be possible to add an uniteruptable power supply to this setup? Set it up so that in the event of a power failure, a power switch with an air pump would oxegenate sump filter material and the tank. I guess you would need a dc to ac converter as well...

I love EE so many possibilities lol.
 
#46 ·
Do any of you use any type of surge protection for your system. Further more, would it be possible to add an uniteruptable power supply to this setup? Set it up so that in the event of a power failure, a power switch with an air pump would oxegenate sump filter material and the tank. I guess you would need a dc to ac converter as well...

I love EE so many possibilities lol.
Yea I was thinking about doing something along those lines but in the 3 or 4 years I have had my tanks up and running, I have never had a power outage. Because of that, it really isn't a priority for me. A surge protector is always a good idea. I do also use a line conditioner on my box in order to keep the signal clean.

Hunter
Never added my compliments! It's a beautiful build, really looking forward to see it working. And I can't wait to see your light unit and code. If you want storms and clouds I think reef forums are a good bet - it seems they are more into that stuff :) I have been too lazy to write that sort of fancy stuff myself!
Thank you! I have had it running without anything connected to it for the last couple of days to run the schedules through the paces and to make sure nothing funny happens. So far so good!

I do want to have the storms and what not during my light cycle but I have a lot of programming to do first. Thanks for your input.

Check this out:
http://www.newegg.com/Product/Product.aspx?Item=N82E16833704134

Its a tiny WiFi router, smaller than a credit card, that will run in client mode. Basically its a WiFi shield, but its only $25 and it will easily fit into your box. I've seen a lot of people have great success connecting these to their arduinos at a fraction of the cost of a WiFi shield. I'm gonna pick one up in the next couple days and play around with it. I'll let you know what I think.

Sent from my Galaxy Nexus using Tapatalk
Please do! If you can get that to work I'm in. It was actually $19 today!

Keep all of the ideas comming!
 
#50 ·
I got the DINs installed in the box. The will be for the Tank Temp Probe, controls for the tank lights (LED), fan control for the tank light LEDs, and one extra for future upgrades. Hopefully a PH probe!

I was bummed how the hole came out. My drilled slipped on me and they are a little out of line. GRRRR at least the will be at the back of the box. It still drives me nuts.



 
#54 · (Edited)
Hey Scape. technically yes it would work but it would be some serious over kill. The relay board is designed to control high voltage electronics using a low voltage control. Did you look on amazon for the FET Board. I found it on there as well. It cost a little more.

EDIT: I guess you did look on Amazon! LOL I didn't see that when I originally read your post!

EDIT 2: I found the FET board on Amazon: Amazon.com: 4 Route MOSFET Button IRF540 V2.0+: Everything Else
 
#57 · (Edited)
Hey, so I just noticed that you have 9 plugs and only 8 green buttons. Do you plan on having 1 hot at all times. (I noticed in your initial pic, the bottom left plug wasn't wired up to hot)

Also, say I wanted to control 4 or more pumps. Would I need an additional MOSFET board? Or just another model that incorporates more than 3 items? What about this Mosfet board? http://www.adafruit.com/products/1438#Description

Also, what would you say is more important? Faster processor speed on the arduino or more PWM ports? I've been researching and apparently, the Arduino Due has a much faster processor, however only 6 pwm ports, whereas the arduino mega2560 has 14 pwm ports but a little bit slower of a processor.
 
#59 · (Edited)
Hey, so I just noticed that you have 9 plugs and only 8 green buttons. Do you plan on having 1 hot at all times. (I noticed in your initial pic, the bottom left plug wasn't wired up to hot)

Also, say I wanted to control 4 or more pumps. Would I need an additional MOSFET board? Or just another model that incorporates more than 3 items? What about this Mosfet board? http://www.adafruit.com/products/1438#Description

Also, what would you say is more important? Faster processor speed on the arduino or more PWM ports? I've been researching and apparently, the Arduino Due has a much faster processor, however only 6 pwm ports, whereas the arduino mega2560 has 14 pwm ports but a little bit slower of a processor.
Wow great eye. Like you said, the last plug is wired directly to the power strips and will remain "hot" the entire time. I figured this would be easy to add a power strip or something if need be. Might plug the power for the Fish Tank lights in here as well. I'm surprised you caught that!

I just want to be clear, when you say "pumps", are you talking about dosing pumps (12v) or larger (120v) pumps? That motor controller looks like a great controller but unfortunately it isn't designed to work with the MEGA. It's also a stackable design which would mean you couldn't use a sensor shield which really makes the wiring much cleaner and easier in my opinion. The FET Board I'm using controls 4 DC motors though. IF you needed to control 4 dosing pumps one option would be to not use the fan in the box. I think the box would be ok with just vent holes.

If you want a "whole tank" controller, to me it is way more important to have more input/outputs to work with. The smaller boards are going to seriously limit you to what you can control. The mega is running all my code with no issues what so ever. I'm very please with the speed. I just don't think the Due would have enough inputs/outputs for you to control everything. If you just want to control one aspect of the tank you will be fine with the due.
 
#60 · (Edited)
Unfortunately, I bought the wire on the economy here in Kuwait. It isn't measured the same as back in the states. Just google HOME 110v wire size. I think you will be fine with 18gauge. The runs are very short.

The connectors are standard #6 Spade Terminal connectors. Be sure to get ones that fit the wire size you want to use. Mine were designed for 16-22 gauge wire. Here is a link to the ones I used on Jameco:
http://www.jameco.com/webapp/wcs/st...Id=10001&ddkey=http:StoreCatalogDrillDownView

Those DC controllers you posted should work fine as well. I was looking at them when I built mine. The only think I didn't like about them is that they do not step the voltage up. The input v has to be at least 1v higher then the output voltage. Which if you are using a 12 AC to DC converter you should well above the required 1v.
 
#63 ·
Hey guys, I just found these little guys over at Sparkfun, Little tiny mosfet boards for like $4 a piece:

https://www.sparkfun.com/products/10256

Each one controls one motor, but just buy as many as you need and they're small enough to put wherever you need them in the build. Shipping with USPS is only a few bucks too, and they ship from Colorado. Only downside is each board will need it's own 12v power line.
 
#68 ·
So I picked up that nano router yesterday, and holy smokes it is TINY. Smaller than an Arduino Uno and probably about as thick as a stack of 5 quarters. I had it working, but then when I upgraded the firmware it just died completely...I knew I shouldn't have tried the beta firmware...So, back to Fry's tonight for a replacement :-/ I'll give you guys more updates once I have the replacement up and running.
 
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