Full tank automation system - The Planted Tank Forum
 7Likes
Reply
 
LinkBack Thread Tools Display Modes
post #1 of 70 (permalink) Old 08-06-2016, 08:23 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Full tank automation system

So, spent some time writing stuff down, finally got it diagrammed.

This will be Arduino-controlled (maybe Raspberry Pi?), because it's simple/available/proven/relatively cost-effective. The entirety of the design is based around 'ensuring control is maintained'. i.e. no disasters are being allowed for because I cheaped out on $50 of sensors.

Disclaimer: I have 3 boys aged 4 and under...so when this actually happens is up in the air. If nothing else the layout of the systems should clarify to folk the 'how' of automating systems like this. If you find errors, please ping me and I'll update the diagram.

The whole point of this is twofold. First, how would one go about doing all these things. Second, what parts and code are required to actually pull it off. I want folk to view this as open-source/community-built. So please, if you have ideas/improvements let me know.

Features
  • Automation of water changes and top-offs (via constant slow trickle, instead of 25%/week)
  • PWM control of lighting (based on CO2 levels, sunrise/sunset, thunderstorms for bling)
  • Automated CO2 injection (dual pH sensors ensure correct CO2 levels maintained at all times)
  • Automatic system shutdown (since flow meters are present at all major points, disaster scenarios can be coded in)
  • Data gathering (for long term monitoring/analysis)
  • Alerts/notifications to email/SMS

I left heaters off because I ran out of time...but you get the idea. "Temperature Control System", comprised of temperature sensors and heaters on relays.

Why build instead of buy?
  • Easily add/remove redundancy
  • Sensors are cheap, controllers are not
  • One of my work 'goals' is to write my own not-work-related software project...so hay
  • There are a lot of folk interested in this kind of thing these days - the code will be posted on Github
  • 3-12v system instead of 120v means a LOT of fun options (think small 12v pumps)
  • The proliferation of Chinese components means parts cost is stupid cheap
  • I am a tinkerer/builder by nature, so this project immensely interests me
  • Buying an equivalent system would easily run into multi-$k territory

I will update the diagram here as I have time. It was created using the absolutely fabulous: https://www.draw.io/



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26

Last edited by crazymittens; 08-07-2016 at 06:36 PM. Reason: Updating diagram link.
crazymittens is offline  
Sponsored Links
Advertisement
 
post #2 of 70 (permalink) Old 08-07-2016, 06:36 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Added the temperature control system bits.

Next have to map out the electrical (actual) & sensor wiring...

Annnd we have a github repo... https://github.com/christrotter/aquariumAutomation

If there are any interested parties, weigh in on: Arduino vs. RaspberryPI vs. ?


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26

Last edited by Darkblade48; 08-08-2016 at 07:14 AM. Reason: Please use the edit function for back to back posts to keep threads cleaner
crazymittens is offline  
post #3 of 70 (permalink) Old 08-07-2016, 08:24 PM
Planted Tank Guru
 
Nordic's Avatar
 
PTrader: (0/0%)
Join Date: Nov 2003
Location: Cape Town
Posts: 4,032
I'm also designing a semi-automatic system. It is for multiple tanks with air driven filtration so it doesn't need the recirculating bits.
I am going to make PVC draining overflows with joint top intakes. The pipes will all run to a control panel on the outside wall where they will each go through a 12V solenoid valve. There will also be an intake solenoid and maybe float valve in each tank.

I will program a PIC to open the intake valve, and then one or two drain valves sequentially a few seconds later, when air is purged.
Refill will be from a Raised 100gal tank or selectable direct from hose. This means no power drinking pumps required.
Tanks will be dosed with prime via perestaltic pump during refill. I will never have enough water in the tank to do all the tanks in one go, but being able to alternate which banks are being cleaned is much less work than carrying buckets with a bad back.



I like your style of design. My thought pattern works better with visualising the result and then working my way back to the product.
BettaBettas and BettaBettas like this.

Cape Town, South Africa.

Hi. I'm back.
Nordic is offline  
 
post #4 of 70 (permalink) Old 08-08-2016, 12:19 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Nice! Is that for a fish room scenario? Also, nice Sketchup! That program came in handy when I was designing the original display/sump system a few years back. I will probably do a 3D version of the near-finished full system to help visualize what this would look like all put together.

The peristaltic pump for prime dosing is a great idea - the whole dosing system piece (for ferts) was in the back of my mind, but never thought about adding this to the dosing process.


Did more reading, Arduino is what we'll be going with.
  • We are really only looking to take sensor input and make decisions (key point being analog sensor input - something not native to R.Pi)
  • We do not need on-board graphics, etc (data visualization will be handled by either 3rd party or something Heroku-based)
  • The current Arduino stuff has on-board ethernet (which is our key to sending data out)
  • The Arduino Mega has enough juice/pins to provide for almost the entire/fully redundant system set (dosing system probably will send over the edge)


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #5 of 70 (permalink) Old 08-08-2016, 01:08 PM
Algae Grower
 
PTrader: (0/0%)
Join Date: May 2015
Posts: 61
I would recommend some kind of dosing system for ferts. It keeps the water chemistry stable over time.

Is it possible to design a water topoff/changer system that is completely mechanical. Some way where you have a constant flow in/out adding to a 50% water change every week?? Maybe some kind out of outflow spout with inflow controlled by a needle valve.
Waterski is offline  
post #6 of 70 (permalink) Old 08-08-2016, 01:44 PM
Planted Tank Guru
 
Nordic's Avatar
 
PTrader: (0/0%)
Join Date: Nov 2003
Location: Cape Town
Posts: 4,032
Well, I already have a fishroom scenario,it is just a mess, I run more tanks than both LFS in town, so I might as well make it look pretty and run a little shop part too.
Arduinos are cool, I'm just too old to learn new languages, I still do everything in assembly language.
sfshrimp and sfshrimp like this.

Cape Town, South Africa.

Hi. I'm back.
Nordic is offline  
post #7 of 70 (permalink) Old 08-08-2016, 01:51 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Waterski, the auto-fill/drain system is SUPER ripe for disaster. That's why I built in so much redundancy/checks/balances.

In an ideal world you'd have a simple mechanical system, yes. i.e. the system physically cannot hold more than X water level because you have an overflow on the sump that dumps straight into a floor drain. The input side is IS mechanically restricted - but actually seeing it work in real life will be a different thing. How will the RO system deal with the back pressure?

The reason why I didn't take this route is that very few people will have the ability to dump into a floor drain (myself included).

===================
A lot of how I designed my setup is based on what I figured to be 'best practices' for aquarium design. e.g. it's hard to argue there is a reason to NOT do the beananimal drain system from the perspective of 'which system is the most reliable/effective'.

Similarly, it's hard to argue against a sump from the same perspective. ALL aquariums benefit from a sump, period.

Now, you can argue cost/difficulty/complexity/etc...but this is a DIY thread. If you wanted a simple display tank w. canister filter, you wouldn't be here.
===================

That all being said, I will certainly draw up the mechanical drains design and have it as an alternative - it is a great suggestion! My only caveat to the mechanical system is that you would still want flow meters on the input and output pipes. The entire system will work at its best with the most input data to work with.

Further, noted on the fert system - that's 'already a thing' that I will pirate from others. Many are hesitant/simply don't post the source code though. It will add a whole other level of complexity that may or may not be worth it. For example, that $80 unit off ebay does a lot! Except notify you of low levels, tell you how much it's injected over X period, tell you if it's stuck on or off, etc etc....

I'd like this project to simplify the understanding of what systems there are in an aquarium, plus make it easy for folk to pick and choose what automation components they want, plus provide a library/compendium of X device plus Y sensors = do this.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #8 of 70 (permalink) Old 08-08-2016, 09:14 PM
Planted Member
 
ScubaSteve's Avatar
 
PTrader: (4/100%)
Join Date: Jun 2012
Location: Buford, GA
Posts: 263
Wow...my head's spinning after looking at that! Well done crazymittens...I might have to look into this when I start up my 75 gallon show tank (it's still a long way off).


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Retired
ScubaSteve is offline  
post #9 of 70 (permalink) Old 08-09-2016, 12:12 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Quote:
Originally Posted by ScubaSteve View Post
I might have to look into this when I start up my 75 gallon show tank (it's still a long way off).
I made the jump from a 50 gallon display to 125 gallon - definitely worth the extra effort to get the 6' long tank if you have the space!


Did some reading on the pH probe stuff, found some absolutely fascinating articles, and discovered that this is a solved problem - so yay! I believe the fastest way to get into pH automation is with the probe adapter offered by Atlas Scientific, and then just making sure to use a (quality?) calibration on the probe once a year. Apparently the design of a pH probe means that it WILL age and start providing bad readings, so that's even more impetus to use cheap probes. (something that data will bear out)

Here are the remaining big question marks for me before I order equipment:
  1. Since pH probes aren't the simplest to add here - do the other sensors require the same treatment?
  2. Will an Arduino Mega run the code required? (i.e. will all these sensors/outputs max the system capabilities)
  3. Is the Arduino 'sketch' IDE up to the task - can we use Visual Studio or the like? (the most cursory google results, lol - super yes)
  4. Is an Arduino 'project' capable of the organization we'll need?
  5. Should we be breaking this up into many smaller systems? e.g. IoT - although I want to say no, because you still need a central point to control it...and I don't want to have that central point in the cloud or off on the network somewhere (or maybe that's ok?)...
  6. re: smaller systems, what's the consensus on having many Arduino Unos talking to a central brain Arduino? I think that's unnecessary complexity...


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #10 of 70 (permalink) Old 08-09-2016, 04:08 PM
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Apr 2009
Location: Alberta, Canada
Posts: 588
A system like this should be modular. I/O should be separate from logic.

I would personally group related I/O on individual boards (kind of like the Apex modules) and have them just send/receive sensor values over SPI/I2C.

The main controller could be a raspberry PI running python. Coding is enormously easier and you have the option of a full GUI or even internet if desired.

I don't really think you want to do the whole thing on a microcontroller. Nobody wants to dive into config files and recompile/flash for every tiny adjustment.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
691175002 is offline  
post #11 of 70 (permalink) Old 08-09-2016, 05:03 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Excellent feedback, thanks - that confirms how the UI piece will be handled. Looks like I have more research to do. So would you do something like Arduino Uno for each module? (or is there something even smaller/still sufficient) Your thoughts...give them to us...this project is supposed to be community-built, after all.

===================
Brief searching indicates that pH is the most complicated sensor to deal with in our context (mostly because of noise). TDS seems somewhere in the middle (Interfacing a cheap TDS meter with microcontroller).

Temp sensor and flow meters seem pretty straightforward. Optical water level sensor also an unknown, but shouldn't be too complicated...it's just an on-off kinda thing.

Another avenue here is to just bite the bullet and go with Atlas Scientific for everything...but that amplifies the cost quite a bit. I think the proof of concept will use cheapie sensors. For me, pH/TDS is a round 2 kinda thing, so we really just care about flow meters and temperature to start.


With the above post from 691175002, I'll revise the diagram/plan and post the update later today.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #12 of 70 (permalink) Old 08-09-2016, 05:12 PM
Children Boogie
 
mistergreen's Avatar
 
PTrader: (13/100%)
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
I'd use an arduino. A PI is useful for processing intensive usage like with video or a database.
It's not practical to use I2C or SPI for sensors. Not all sensors have those interfaces, some are one wire digital, some are analog, and so on.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
mistergreen is offline  
post #13 of 70 (permalink) Old 08-09-2016, 05:21 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Right, so where my initial concern lies is how complex this project will actually be once you have all the systems in place. So, is a single Arduino config the right place to put lots of complex logic? Based on what I've seen, most Arduino code is a single page (I have not seen a lot).

Also, the project must have some sort of GUI for data visualization, and probably a basic setup app (i.e. define what modules you have present).

So how do we deal with those issues?


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #14 of 70 (permalink) Old 08-09-2016, 06:58 PM Thread Starter
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Jun 2012
Location: Oshawa
Posts: 806
Random thought for later - diagram out the data-in/control-out flow... I think the idea of a controller for each piece of data in/out makes sense, but it would have to be very simple to work properly i.e. IoT kind of thinking - but instead of sending to the cloud, you send to the brain - the more inputs the brain has, the smarter it gets.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

SumpPimp#26
crazymittens is offline  
post #15 of 70 (permalink) Old 08-09-2016, 07:27 PM
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Apr 2009
Location: Alberta, Canada
Posts: 588
Quote:
Originally Posted by mistergreen View Post
I'd use an arduino. A PI is useful for processing intensive usage like with video or a database.
It's not practical to use I2C or SPI for sensors. Not all sensors have those interfaces, some are one wire digital, some are analog, and so on.
I was thinking more of daughterboards with a small microcontroller for each sensor or group of sensors.

Upon further consideration I think it would be convenient to have a USB/Serial IO board that does all the sensor/output interfaces and presents a very basic text/json interface.

Make an arduino/teensy shield with 10-20 pins broken out and define a basic set of commands like:
Code:
Set Output0 100
Set Output1 50

Get Input0
> Input0 60
A more complex interface could identify inputs/outputs by use (Temperature, Lighting, pH, etc...) or implement more complex commands such as fades or scheduling.

This way any device with USB or serial can be used to implement logic. (including a computer/raspi or just a second arduino).

If someone needs more inputs/outputs they can plug any number of boards into the same controller (its just USB). A cheaper auxiliary IO board could also be produced.

This way a single piece of hardware can scale to systems of varying complexity. Using it could be as simple as typing a few lines into the terminal, or as complex as a 5kloc python script which logs to a web app.

Bump:
Quote:
Originally Posted by crazymittens View Post
I think the idea of a controller for each piece of data in/out makes sense, but it would have to be very simple to work properly i.e. IoT kind of thinking - but instead of sending to the cloud, you send to the brain - the more inputs the brain has, the smarter it gets.
I was thinking the same thing, but later realized that 90% of the users will probably want the same features: Temperature, pH, ~4 lighting channels, ~2 relays (CO2/Pump) so you might as well put them all on the same board.

As long as IO presents a simple and consistent interface you can use almost anything as the brain, and even use multiple IO boards for systems that are more complex.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
691175002 is offline  
Reply

Tags
None

Quick Reply
Message:
Options

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:
OR

Log-in










Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome