Go Down

Topic: Hydroponic Controller 4 channell  (Read 2205 times) previous topic - next topic

Jcover

Greeting All

I am here to share my experience in building a controller for a hydroponic system at my home.

On like "Billie's Hydroponic Controller I will be controlling Ph, ORP, EC and DO with probes from atlas scientific on the 4 channel Tentacle Shield from white box. All on a UNO.

I will also be using an I2C serial 4X20 display along with a 2 axis analog joy stick for the user interface.

Control out will be done through a relay shield

Once I have mastered the coding for the control I will then add an Ethernet shield for data logging and network monitoring. The logged data will be time/date stamped with data from a I2C real time clock module.


I do have concerns about ruining out of memory in the UNO but time.....coding will tell


Jcover

Here is an update on my progress.
I can tell you I pulled out a few hear in getting the I2C communication working on atlas probes.
Can you say "learning curve" Fortunately  atlas give you a pretty good sample code, and modifying the  code so the it doesn't use the delay() script was a bit tricky because the probes can only be read ever 1300 millisecond. Finally there was the usual modification for getting there function to interact with my original code

Currently the entire program dose not have any delay() in the loop which keeps the navigation via the joystick very responsive.

I have also ensured that the LCD text doesn't flicker.

here is a video of what I have so far
Hydroponic Controller


Jcover

Its been a while but I had to wait for more parts to arrive.

As expected I ran out of memory on the UNO and had to upgrade to a MEGA

With the new level of memory I slapped on an Ethernet shield 5100 "borrowed" a web data logger from
Web data Logger and as expected watched the unit fail......some more debugging necessary.

What I suspect is, there is just too much happening in the main loop and the processor just cannot reply fast enough to web browser .


I didn't like the level of electrical isolation on the PCB board  on the original relay shield, especially since I am planing to be controlling 110V AC, so i changed it out to a external unit and added a second set of 4. Now I have a total of 8 control relays. Each sensor now has its own relay and I have assigned one relay to an Alarm output. Not sure what I am going to do with the remaining 3.


5v DC power is supplied from gutted circuit from an old Tablet charger


 have started to stuff all the components in to small plastic box.

Jcover

If I keep waiting for the mountain to come to me I shall be waiting for ever....

That being  said I have decided to post my coding in its current state even those there are section still unfinished.

I had stopped working on the code so that I could focus more effort on building the green house, pond system and water treatment system, but this is going much slower than expected.

I do plan/have to finish it but during this lull time there maybe some else out there how in interested in the work that i have do so far and would like to contribute to the effort of finishing it.


some of the areas i want to implore/develop is a better web interface with display gauges.
I also want to add a calibration menu for the atlas scientific probes.

here a quick video of where things are https://www.youtube.com/watch?v=T_jjg3Yl47s

pedroivo000

Hey man, great work there, really! I am working on a similar project that will have pretty much the same features as the one you're building, so it is very nice to see yours in action and working!

Did you manage to get the Ethernet shield working with the Tentacle shield? I see that you're staking it on top of the Tentacle shield, but doing it that way you block the ICSP headers that are needed for the ethernet connection. I am using it between the arduino and the Tentacle, but the "shield tower" is very awkward and flimsy, so I am looking for alternatives.

Again, great work :)

Jcover

Hi pedroivo000,
  You can still control the Ethernet Shield through Pins 10-13 and if you want to use the SD card Pin 4 is needed. The real problem is with the MEGA the Ethernet shield dose not boot up properly with the first power up and based on how the coding is written now, it locks up. A simple press of the reset button gets every moving again. I want to try an add a system reboot, I know there a code for it but right now I can't remember"

myggle

#6
Oct 20, 2016, 12:20 am Last Edit: Oct 20, 2016, 12:23 am by myggle
Hi Johann, as promised here's my project and sketch in its current form.  I use Freetronics Ethermega which is a combo of Mega and W5100 on the same board, it works great and would likely help streamline your project a bit.  I don't use an LCD as I interface via the web using Blynk and my smartphone acts as my LCD.  Also on my Ethermega, I soldered on an RTC onto the proto area as gardening requires a schedule, and if the network fails, I can't have things turning off until the network is back up.  Also in my project, I use a DHT22 sensor to measure Temp and RH in the room.  My sketch either can toggle any of my 8 relays in accordance with time, Hi/Lo temp thresholds or Hi/Lo RH thresholds.  

When I added Blynk, I went through hell debugging, but have since made it through and my previous "scheduled sketch" now works within the confines of Blynk's library well and I can even override my sketch if I set up my smartphone interface to do so, which IMO adds to the overall flexibility.  The Blynk app is relatively simple to use, and because it's all digital, they have created every imaginable form of sensor display, i.e. gauges, graphs, bar graphs, tickers etc.  Just choose your poison, drag and drop it to your app interface.  You will need an "Auth Token" added into your sketch, but the Blynk library sniffs the web for the device with the matching Auth Token (your phone) and proceeds as programmed.

I also want to add in the use of the various probes, but I'm most concerned with PH, EC, and Temp.  The way I grow involves multiple reservoirs (res), but it wouldn't be economical to have a set of probes per every res, so I also plan to have a good plumbing network that can pump the contents of each res past the probes for testing and returned to the res of origin.  I also aim to use peristaltic pumps (basic DC motors) to accurately pump into the system any of various different nutrient solutions I use precisely to the tenth of a milliliter if needed.  With a series of solenoid valves, fresh water and/or nutrient solutions can be pumped from their respective point of origin into any desired end res tank, mixed, and sent out for testing before being return.  This to me, is my ideal end project, and even though I'm almost 2 years into it, I still have another 2/3 of my desired project to go.

Hope my progress aids in your project as I plan to glean from your progress as well.  Note - I have both of my sketches uncombined, but have tested the merger in the past with success.  I do need to remerge them though, just have not gotten around to it thus far.

Jcover

 thanks Myggle for the contribution
and based on what you have described it is almost identical to what I am doing myself and had I found the Blynk app earlier as you did I can definitely say I would have done a simular web interface instead of spending hours writing a menu code. That been said I think I will continue with the LCD because the menus code is pretty robust in handling added functions and items pretty easily. Plus, pride want let me dump the work i have done with the LCD and menu.

I have to say I do love that  Freetronics Ethermega and I think it's worth the investment for me to upgrade to. It combine the proto sheld, the w5100 and mega in one nice board. This mean I can use a smaller enclosure which works great for me right now as I am looking to change the existing enclosure.

But first,

Hopefully I can finish building and setting up the water chiller for my raft pond and have enough time to look at your coder this weekend.

myggle

#8
Oct 22, 2016, 04:52 am Last Edit: Oct 22, 2016, 04:53 am by myggle
I can't recall how many times others on a similar path have tried to get me to go another way that made more sense to them, and in doing so, I would need to discontinue a device I bought or erase a block of code that cost me some real estate in my hairline learning to write.  So I completely understand your decision!

Jcover

Well this week has been a pretty productive.
I was able to complete a water chiller that was built out of an old 9000 BTU AC condensing unit and a scavenge heat exchanger.
I would have done a lot more on the controller earlier but I got a bit disheartened when I realize I had to change the enclosure because the layout was just wrong. So after a couple weeks of moping around I finally got the motivation to tackle this project and I'm pretty proud with the results.
The problem with the old enclosure was that some of the connections were mounted on thie side and as principal I  wanted all connections to be mounted at the bottom also I had realized I needed more connections and it was getting very difficult to add them with the old layout.

The new enclosure now has cWell this week has been a pretty productive.
I was able to complete a water chiller that was built out of an old 9000 BTU AC condensing unit and the scavenge heat exchanger.
I would have done a lot more onthe controller earlier but I got a bit disheartened when I realize I had to change the enclosure because the layout was just wrong. So after a couple weeks of moping around and finally got there motivation to tackle this project I'm pretty proud with the results.
The problem with the old enclosure was that some of the connections were mounted on this side and as principal I  wanted all connections to be mounted at the bottom also I had realized I needed more connections and it was getting very difficult to add them with the old layout.

The new enclosure now has control connections for
 pH up & Down,
 conductivity,
 blowdown d
issolved oxygen
orp control
Vent fan
Chiller
3 optical isolated digital Inpurts
 4 humidity and air temperature sensor
 3 temperature sensor and
 i2c communication with power

All power to the convertor are fused for protection


myggle

Nice work on the box!  Very clean and plenty of room for expansion as your project grows.

Jcover

I have been looking around for the Freetronics Ethermega but I can't find a supplier in the USA and the suppliers in the UK seems to be out of stock. I'm just going to have to continue with what I have.

To improve the system reliability i will be incorporation an external
Watch Dog Timer

I also plan on scraping the code for the web server and replacing with a Tcp/Ip terminal window, Telnet.
The reason for this is the LCD menu architecture is not that much different from one made for a terminal window and wouldn't take much to develop. This is an improvement over the web severer because it only gave me access to the log files. Having the full lcd menu in a terminal connections gives full control of the unit. I could even add a Bluetooth UART for connecting to the same terminal menu.

Jcover

Just upload a new video of mt progress, please enjoy
Update 2

emaundu

you could also try using the v2 controller from kijani grows which is a combined linux ar9331, atmega2560 and numerous shields on the same board. it has wifi and even 3 hardware watchdogs. here is a water quality project using the tentacle sheild ahd atlas scientific kits for ec,ph,do & orp. you can see some live demo's of the data visualization api.

tekno62

tagged - I was wondering if PPM is equal to EC

thanks

Go Up