The Planted Tank Forum banner

1 - 20 of 70 Posts

·
Registered
Joined
·
807 Posts
Discussion Starter #1 (Edited)
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/

 

·
Registered
Joined
·
4,032 Posts
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #4
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)
 

·
Registered
Joined
·
61 Posts
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.
 

·
Registered
Joined
·
4,032 Posts
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #7
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #9
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...
 

·
Registered
Joined
·
588 Posts
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #11
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.
 

·
Children Boogie
Joined
·
16,743 Posts
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #13
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?
 

·
Registered
Joined
·
807 Posts
Discussion Starter #14
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.
 

·
Registered
Joined
·
588 Posts
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:
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.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #16
Ok, so really what needs to be defined here is our major use case - the proof of concept will be based on that, and the system will have provision for multiples of any 'module'.

So the POC will be a single Arduino w. network that talks to a R-Pi which does data visualization. Expansions will just be additional Arduinos sending more data to the brain, and the brain can then just enable more functionality as more inputs are added...?

I guess the other argument is: 'where does the value lie?' i.e. I really wanted to lean toward full redundancy as a feature, because generally you don't ever get that in a home setup...but maybe that has a use case of one...me... :)
 

·
Children Boogie
Joined
·
16,743 Posts
I think coding and interfacing for one brain is easier than multiple brains for practical reasons although the other idea sounds good.

This reminds me of my arduino project. I create generic virtual 'devices' and the user configure what they need from it.

http://www.plantedtank.net/forums/2...-controller-arduino-green-web-controller.html

Also Check out this arduino project
http://www.plantedtank.net/forums/2...ch-interface-aquarium-controller-arduino.html

It's set in what and how you should configure devices.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #18 (Edited)
Ok, so here's what I'm reading the actual implementation to look like:
  • Break systems down into something modular/expandable, each mini-system's pieces will connect to a single mini-system controller via networking
  • The mini-system controller(s) would then talk to the central brain for logic
  • The central brain would have three pieces: logic, configuration, data visualization
  • Mini-system example: TemperatureControl: temp sensor(data out), heater relay(control in)
  • Mini-system example: FlowControl: flow meter(data out), solenoid valve(control in)
  • Mini-system example: LightControl: PWM signal(control in), lighting relay(control in)

The initial proof of concept would then simply have a single mini-system that reacts to control input, and sends a constant pulse of data out.

Part 2 would be adding another mini-system (good use case would be water in, water out for ATO/AWC) and the brain logic.

Part 3 would be adding visualization.

Part 4 would add the user input of configuration.

Seem reasonable? Is there a better approach?


Next steps will be to diagram out the rough architecture and start looking hard at a mini-system itself.

Bump:
Wow, a lot of this stuff is already a solved problem - love it!

Need to spend some time going through these projects...but it definitely seems like I can leave the GUI stuff to the pros and focus instead on the mini-systems, sensor library, and logic side. (all of which would, of course, be heavily pirated from stuff folk have already done)

The good news is that I have zero intention of commercializing this, so it's not like I'm all disappointed that others are already doing this kinda thing. In fact, makes my task easier! :D

Edit: Yup, definitely glad I had no plans to commercialize. And definitely certain that I no longer want to sacrifice the redundancy aspects just to broaden the audience.



The goal of this project: Provide an open-source codebase/schematics (folk will have easily accessible arduino/sensor/etc code to use in their projects), use common and cheap parts, have web-based data visualization (make decisions based on data), and be easily expanded. Ideally the logic side will be as bulletproof as possible, but will work best with the most sensors in the mix.
 

·
Registered
Joined
·
807 Posts
Discussion Starter #19
Ok, so here's my first draft of a mini-system. The drain system really requires two of these mini-systems, and you could even take it a step farther and have a 'pump system' that removed the pumps from the equation. Then your input system would have two 'flow control' systems rather than something copied from the drain system. Yeah...that'll be the next step.




So the intention with this design is that the brain simply needs to say 'RUN PUMP' with a simple digital signal. As long as the sensor is powered up, data is being shoveled out to the brain. The logic simply requires that the brain is supplied with data. If the mini-system stops providing data, it gets a kill signal and is considered dead until the user fixes it (acks the issue).

In theory you can have a single Arduino do all this - but with the gotchas I found with pH sensors, it really would get complicated fast. I like the suggestion to offload the logic from I/O, makin' a lot of sense to me.

Added the diagram to the github repo!
 

·
Children Boogie
Joined
·
16,743 Posts
pH sensor with arduino & pi code examples
https://www.sparkfun.com/products/10972

Seeedstudio.com
And adafruit.com are good sites too.

I don't know if you know but you can use external libraries in code where the logic of the sensors are. You just include to a main logic brain. So doing what you plan in software instead of hardware.

So you can have a flow library to do what you plan with only one main logic board.

Sent from my iPad using Tapatalk HD
 
1 - 20 of 70 Posts
Top