Help with a hydroponics project

Hey all!

I’m just getting into working up a similar project but i am VERY green and hoping for some help and guidance.

I have a small vertical farming system set up and and I’m running everything manually - my results have been pretty great so far. Just producing basil but after tons of split testing I’ve found some varietals that work and I have a planting and harvest cycle down pat. More than happy to share any resources or ideas on that side if anyone is interested.

On the automation side heres what i am HOPING to do.

Slave out the analog tasks of monitoring (ph, ec) to a couple arduino boards and have them send data over to a Pi which can then make logic based decisions to dose with nutrient or ph up / down, plus notify me on events and log results. I don’t think this is too crazy but I’m really new to this so I don’t know if I’m barking up the wrong device tree.

I have a gravity ph meter and I managed to get it connected to my arduino and program it to switch on an LED when the PH dropped past a certain level. My original plan was to have that turn on a peristaltic pump with PH up attached for 3 seconds, then build a long delay into the loop so that it would give the solution time to cycle through my reservoir and system (zipgrow) thus avoiding over dosing the system and creating a hysteresis loop of sorts with ph up and down. My plan was to have two “thresholds,” one low and one high and keep the triggers out of range.

On the EC front, it would be a single threshold (low) and would need to dose from two reservoirs as I’m currently on a two part solution, so a single threshold breach would trigger on 2 relays to peristaltic pumps.

I’ve been debating porting this all over to cayenne, which has me both excited and concerned.

Again - I’ve literally never worked on an IOT project, done anything other than very basic coding or anything like that. I have a background in audio engineering and understand signal flow and architecture that way, and am handy with a soldering iron and have a pretty mechanical mind so im part way covered but the programming side is a little intimidating.

I’m hoping for some help with basics, and with cayenne.

One worry I have - I’ve just started getting into pi but i managed to set up an LED which I can trigger on and off from my phone throughvcayenne. That said, when I power PI down, the GPIO seems to work as a power “through.” As in with the PI off but power connected, the LED remains on. This is a worry for me - I feel like if i was using that to drive a relay on a pump and there was a reboot of the system there would be a chunk of time where the pump would just be “on,” which would be a disaster if it was dosing ph up or down.

The other thing that worries me is scheduling things in cayenne. it seems really buggy. sometimes clicking on the schedule (chrome, OSX) brings up a calendar and the ability to edit the schedule, some times it doesn’t and the buttons in the browser just do nothing.

I also can’t figure out how to add single incidence to events or a time duration, without having to add a second event to reverse the first - ie I cant figure out how to have a schedule turn on an LED for 1 min, i have to add an event on and then an event off.

Also, it seems like these events have to be scheduled 5 mins apart, you cant schedule a faster cycle. I also cant find a single way of seeing the scheduled events to re-edit them. I feel like this should be obvious and I might be missing something, but considering that left clicking on any of the calendar icons does nothing and the only way i can add an event is by clicking the gear icon menu on the device I assume I’m encountering some kind of error in on the cayenne side? Id’ love to be corrected or clarified on all this though.

Welcome to cayenne community @andrewjmavor. your project sounds interesting and would love to help you automate using cayenne.

it would be great if you can PM me some of your knowledge on farming (especially microgreen) :wink: and also automate together to get the best yield from the crop.

as you are able to get the PH and EC reading on Arduino you can send the data to cayenne by using just a single line Cayenne.virtualWrite(channel_1, PH_value, "soil_ph", "null"); and Cayenne.virtualWrite(channel_1, PH_value, "analog_sensor", "null"); here is example code Cayenne-MQTT-Arduino/GenericAnalogInput.ino at master · myDevicesIoT/Cayenne-MQTT-Arduino · GitHub

to send this data to PI you will have to get node-red running on the pi and subscribe to the arduino values and then make the decision. here is a tutorial to get started with node-red and cayenne Using Node-RED as a Local Fallback Server