Software apps and online services
However you feel about GMOs, organics, etc. - it is a pretty universal desire to have fresh food that doesn't have anything harmful contained within. We had a strip of gravel/dirt that wasn't being used for anything except collecting weeds when it rained.
We decided to fix that and use some cool technology along the way to help us manage our new mini-farm while we were away!Our Goals
A few of our goals were:
- We wanted to run our garden with no grid power so that it could manage itself indefinitely (even when the power goes out).
- We wanted to be able to water the garden either using a timer or by pushing a button.
- We wanted a raised bed since this garden was going to be in a desert with terrible 'soil'.
We got started by clearing the existing rock in preparation of the raised bed.
We put in some pipe for two trees on either side of what was going to be the raised bed. You can see the pipe sticking up in the middle. This is the primary means of watering the raised bed.
We next ran both of those pipes to a junction box that is semi-buried.
Those pipes are fed from a single inlet pipe with the 12v valves controlling the flow to each. (The third, middle pipe just goes to an unrelated faucet.)
(Note: the blue shut-off valve had to be replaced a few months after... get a metal valve!)
Once the pipe was in, we covered everything up and took a little break to figure out how to lay out the cinder-blocks for the bed.
We tried a few different layouts. We wanted to maximize the available bed but also wanted to make it easy to plant and pick food from.
The layout below was the first try.
We ended up removing the back row of blocks and staggered the width so that we were able to reach all parts without having to step up.
Once we had the blocks in and level, we had some soil delivered. We made sure to get enough to fill the pockets of the blocks. They require more than you would initially think but also grow a lot more than you would imagine!
Next, we added a water valve to help us monitor the amount of water we put into the bed vs. plat growth.
We ran the wire back to the box holding the Raspberry Pi.
Now that we have the water and electron pipes installed, let's go to the 'smart' part.
Warning: The box is not meant to look pretty. We are constantly trying new things. One day we will settle!
From right to left:
- Voltage regulator stepping down the 12v power from solar charged battery to 5V for the Pi. Battery is in the shed and panels are on the roof.
- RPi camera. Used for capturing time lapses and making sure everything is green when we are away.
- Raspberry Pi A,B,B+,2 and 3 should all work just fine here.
- Thermometer that uses the OneWire bus. It is hanging outside of the enclosure in this picture to get a more accurate temp.
- Motion detection that uses a regular GPIO pin. As a side note: some plastic (such as this particular box) is opaque to IR. That is why the sensor is hanging out.
- Simple board that wires two GPIO pins to the relays, first going through a darlinton array which both amplifies the weak GPIO signal and also provides some induction backlash for free (super important if you value your Pis!).
After cramming as much as you can into your enclosure and have maxed out your GPIO pins, it is software time.Software
You can grab NodeCode at https://www.nodecode.io/Downloads and follow the instructions and some getting started docs if you choose to.
We installed the NodeCode Agent on the Raspberry Pi remotely from NodeCode Studio. Once it popped up under the Hub, we renamed it to Garden and started working on a View for the Garden.
We created a simple view that let's us control the two valves that we installed earlier as well as get a temp reading and live water flow.
We next need to grab some NodeCode Services.
These Services have components that you can drag and drop onto a program canvas. You can browse and download them at: https://www.nodecode.io/Services
We need the RPi GPIO Service so that we can hook up our View's switches to the pins on the Raspberry Pi. We also need to download the Transforms Service so that we can convert some data (it's always handy to have).
Note: Services are platform specific. You can have the same service running on Raspberry Pis (Arm/Linux), Linux (x86), Windows (x86). Make sure to grab the correct version that targets the Pi.
We add the services to the Hub (if you haven't already added them) by going to the Service Packs item under the Hub and clicking the Add button. You can then browse for the Service Pack that you've downloaded.
Once you've done this, you can add these Services to any of your Agents by dragging and dropping them in your program.
We've created a simple NC Program called Garden. We can see Garden under the Devices item. Drag and Drop each of the Services under 'Available Services' onto the Garden Device to install them on that device.
Once they are installed, they will show up with grey icons. Grey means that they are stopped. Right click on each of them and click 'Start'. It takes a while to start the initial start since it has to configure itself. When they are ready, they will turn blue and have down arrows.
We can now simply drag the Service's Nodes (think of them as chain-able super powers) onto the canvas.
We need to drag on two Digital Pin Writers. We will then click each, renamed them and set the Pin number for each that were wired to the Relay (through the Darlington Array) in the property pane on the right.
Now we can drag on the View that we created earlier and drag the View view outputs to the Node inputs and the Node outputs back into the View inputs (so that we know the current state even after closing the view and losing the state.)
At this point we are able to turn on the raised bed and trees independently and from anywhere in the world.
We added a Frequency Pin Reader which polls the GPIO pin that the water flow meter is connected to whenever the Raised Bed switch is on. This is then written out to the View.
There is a pre-made node that can ready the OneWire bus and grabs the temp from the Temperature sensor called OneWireTemp Pin Reader. We've also wired this up to our view. You can specify how often this sensor is checked in the Node's property pane.
You can then open the View by right clicking on the Garden view control on the Program Canvas and click 'Show'.
The Temp is Celsius. We'll be adding more Services including Math services that will convert for you before sending to the View.
To control from anywhere in the world with an internet connection, your Hub will need to be accessible from outside of your network. You need a static IP address or a dynamic IP service that emulates a static IP address and then port forwarding at your router.Conclusion
There is a lot there but hopefully you get as much out of growing your own food and having fun with technology while doing it! We are releasing the Android App called NodifyMe soon on the Android store.
Check Nodecode.io for updates!
Here is a cheesy time lapse video if you are interested.