Advice needed for open source farm controller.

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
MyIndoorFarm
Posts: 4
Joined: Tue Jul 03, 2018 10:08 pm

Advice needed for open source farm controller.

Post by MyIndoorFarm »

First let me start with, I wish I had found DietPi a few weeks ago when I started this project! (In one clean install, I got everything that I have painfully installed, wasting countless hours!!!!)

I am currently developing a controller for the hydroponic farming system that we produce. Our system is designed to grow leafy greens and herbs completely indoors. Just to make it clear from the start, it doesn't grow the other type of 'hydroponic herb' that people smoke. (Not judging anyone who uses it, but our system is designed for small plants with compact root systems. The other herb just doesn't grow well in our system)

The system is completely vertical and comes in two flavors. Our first system has the lights moving on a track that goes up and down the rows. The other system is like a drycleaner's rack where the plants move past the lights and harvesting station. The second system was the primary goal from the beginning, but the first system is easier to implement. The eventual goal is to have a robot harvest the crops and greatly reduce the risk of human introduced pathogens into the system. We have already done successful trials with a small robot from Universal Robots.

I had started building the system with Arduino Uno's and pro mini's but it is getting too big to handle that. Then I used OpenHab2 running on a openhabian distro. After a painful couple of weeks I eventually got the temperature and humidity data (DHT22 running on a ESP32) to show up in a grafana panel on the touchscreen interface on my Rpi3. It went via a Rpi Zero running a mqtt broker to an influxdb. (I have never programmed in Python before and my linux experience was limited and very rusty).

I like the idea of spreading the load out over multiple SBCs but can't really decide what should go where. I have the Rpi3 running the openhab2 instance, a pi Zero W running the mqtt broker and the arduino's running the low level control of the light motors and turning the pumps/lights/fans on and off. I have a Rpi 2 and 2 more Rpi Zero's available. I was going to mount a Zero on the end of the robot arm to take pictures of the individual plants for monitoring. The Arduino's are running on I2C which is basically set up like a very crude MQTT protocol. (If I had known about MQTT beforehand, I might have just set the whole thing up on that)

So my question is, how should I distribute the load? I would like to avoid buying more hardware but I will if I have to. I need to have a touchscreen interface on the front of the control panel. I am currently using a Sainsmart 7" touchscreen which has a resolution of 1124 x 624. Not great, but fine for a HABPanel interface. (I was trying to get my old CUBE GT30 10" tablet to work but it doesn't want to boot up and I can't find the original ROMs that I flashed to it years ago.)

I currently have a TP-link colored LED bulb outside the "barn" that is going to change color based on the temperature/humidity/co2 levels in the barn. The Co2 is monitored by a Awair glo which sends data to my android phone but isn't integrated into the system yet. I have it set up on IFTTT.com but haven't integrated it to OpenHab yet. The pumps and lights are actually being turned on and off via smart powerstrips running on the Jinvoo smart home app. I just purchased a 4 channel Sonoff pro, to take over that task via MQTT. I need to add water level sensors and more temp/humidity sensors.

I have recently discovered Wyze Cameras which are ridiculously cheap compared to other cameras on the market and the quality is amazing. They have IFTTT integration, but don't have a process for taking a single photo. You can do it via their app and you can record a video, but not a single photo. The Wyze cameras seem to handle the flicker from the LED lights the best of all the ones we have tried so far.
User avatar
WarHawk
Posts: 608
Joined: Thu Jul 20, 2017 8:55 am

Re: Advice needed for open source farm controller.

Post by WarHawk »

Pretty cool idea...suggestion though is to first and foremost conformal coat the board since it will be in a heated and very damp environment.

Best $13 bucks you will spend
https://www.amazon.com/MG-Chemicals-Sil ... B07BSK5S7B

From there...no idea how to go about it...since it's going to be vertical...cheap electrical conduit might be the best bet for tracks...using the runners from a 3D CNC machine called MPCNC from thingiverse you can design and build a gridwork so you can control it I suppose.
There was a guy that borrowed parts and made a full 100% electrical conduit scaleable printer called the Piper

As you can see the runners are designed to easily slide on the rails...controlling it would be the trick

Digging around and googling...also see other people are tinkering with this idea
http://www.gardenbot.org/
https://hackaday.io/project/2552-farmbo ... nc-farming

I truly believe vertical farming and hydroponics/auquaponics IS going to be a great thing...especially if needing to grow food in a small footprint in urban areas.

Most Orange Pi's with quad core H3's should be able to handle the load of mqtt broker to an influxdb
Might even be able to do wireless with ESP8266's and I2C

I wish I could help more..but I think the boards should handle the load rather nicely...getting all the data to the Pi is going to the be hard part.
I would bet stuff like this is what you are looking for...howto's and tweaks
https://blog.jokielowie.com/en/page/2/
MyIndoorFarm
Posts: 4
Joined: Tue Jul 03, 2018 10:08 pm

Re: Advice needed for open source farm controller.

Post by MyIndoorFarm »

@WarHawk Thanks for the reply and I will order some of that coating.

We do have a good chunk of this already working. I didn't include the url in my first post because I didn't want to look like I am just putting up a bogus post as an excuse to spam the board. MyIndoorFarm.com is our website. One of our goals is to build a system in a 20 foot shipping container and make it available to hard working low income families, to help break the poverty cycle. It is a perfect size to supply a farmer's market booth on a weekly basis. I am automating it as much as possible to lower the learning curve. We plan to centralize the data collection to help each grower make the best decisions based on the local climate and consumer demand.

I am doing my best to keep as much of the electronic on the outside of the unit in a controlled atmosphere housing. My question is really down to a decision of where to put the openHAB2 instance. Do I keep it headless on a PiZero, or run it concurrently on a Pi 3? Should I keep the touchscreen/ui separate or run it on the same unit as the central controller? Can the RPi 3 handle joystick input in a timely manner to control the manual override moving of the lights? I have the joystick on an UNO with a usb shield currently. It is tied to the I2c bus that has the motor controller on it. Having seen too many cnc machines take off in completely unintended directions, I want to keep the motor control as direct as possible. I am not even happy about it being on an I2C bus.

I have seen the farmbot before and think it is pretty cool. I was well into the development of the shape of the pockets when I saw the farmbot. Our system is a cross between a farmbot and drink vending machine. (The kind that grabs the bottle and brings it to a dispenser, rather than the ones that just drop it to the bottom.)
User avatar
WarHawk
Posts: 608
Joined: Thu Jul 20, 2017 8:55 am

Re: Advice needed for open source farm controller.

Post by WarHawk »

Well...if you could somehow incorporate all of it a webpage...

I know you can view/control alot of 3D printers with a thing called octoprint...even has webcam/camera support so you can see what your movements do when you click the move button

I saw your MyIndoorFarm.com site...poked around a bit

It's definitely going to take some coding because you have to correlate all the data input points from the sensors, convert them to human readable "graphs" and then have a human capable interface to be able to control the motors and whatnot...I can't write code...I can barely poke thru it and sometimes see glaring errors and correct them...

Might be a good idea to do a load/performance test to see if those services you are running on your small SBC's are taxing them or not...they might be yawning...or they might be struggling to keep up with all the processing. If they are yawning...you might then be able to consolidate them, if not...you might have to build a server farm, or go with a much more powerful system such as a laptop or more beefy processor platform

Have you looked at openHAB, open source home automation software...you can have it collect all the data from all the sensors (says it supports over 1000 different types of "things", then have it build a custom display

https://opensource.com/tools/home-automation <- more open source HAB stuff

Wish I could do more...sure seems like a GREAT project and innovative idea...I really do wish you luck in your endeavor

Oh sweet! You are in H-Town...I literally live 30 miles east of H-town :) I work off of Bellaire and 610
Post Reply