How to Grow Food with the Internet of Things

growing_green_onion.gifI have attempted to grow food in the past, but I quickly realized that I’m way too forgetful. Everything eventually died, and my dreams were crushed. Then, as any programmer would, I figured I could hack around my laziness. Here is the story of how I digitized my green thumb. 

Using the same materials and code from the Losant Moisture Sensor Kit, I can successfully grow green onions at home. But this time, I'll receive a text message if the moisture level drops too low. There is even have a live dashboard to see how my onions are doing when I'm away. 

Nature is no match for my technology.

Potting

To get started, I picked green onions. I cook with them a ton and they are super easy to grow. They can even grow directly in water. Here is what you would need:

  • Pot/Jar/Container - Since this is low-maintenance planting, any container should do. I reused an old ice cream container.
  • Green onion bulbs - Get some green onions from any store and save the bulbs after you use them.
  • Soil - I just used organic soil from Amazon.

Then, put the soil in the container and push the green onion bulbs into the soil. In the beginning, the final product looked like this: 

green_onion_start.png

I know what you’re thinking: “How did he kill his green onions even though it is so easy?” Yes, I know. It’s pretty sad. That’s why blog post even exists. But, now that we have onions in the works let's monitor them. 

Hardware

The Losant Moisture Kit has all the hardware you need for this project. Here is the complete list:

  • 1 NodeMcu with ESP8266 WiFi microcontroller
  • 1 moisture sensor
  • 3 male-to-female jumper wires
  • 1 solderless breadboard
  • 1 USB cable

Code

Because of the Losant Moisture Sensor Kit, the full instructions to setup wire, and flash the device are in the documentation. However, here is the most important piece:

 

 

The kit also comes with an LED that gives you the ability to turn the LED on and off based on the moisture. It's very helpful for an in-person visual representation of the moisture level. 

Every minute, the NodeMCU turns on the sensor, reads the moisture level, reports the moisture to Losant, and then turn off the sensor. The power cycling is to protect from corrosion. Water and Electricity are not the best of friends. Once in Losant, we can do something with this moisture data.

Workflow

Every time we get a moisture level, we need to check the moisture level. If it's below a certain level, I'll need a text to remind me to water my onions. In Losant we can build a workflow and use the Latch node for this purpose. 

green_onion_workflow.png

 

In this workflow, we capture the payload. If it's below the “badLevel,” let's shoot me an email and text. Determining what's "bad" depends on a bunch of factors. After looking at the data and seeing how dry the soil is, you'll get a good grasp on a good and bad level. 

The Latch node will only take the successful condition once until reset. So, in this case, we only want one text, not one text every minute. Using the Latch node, we will only get a text once, unless the moisture level goes above our "goodLevel" to reset the latch.

We have nothing on for the negative case of the Latch node because we do not have to do anything when all is well. 

Let It Grow

After about two weeks, your onions should look like this:

green_onion_growth.png

Also, because of the workflow, you should also get alerts when you need to water the plant. 

DASHBOARD

After data had started to populate in Losant, I thought it would be interesting to see a dashboard of a status and trends of my plant's moisture levels. It would also come in handy when I have more than one plant to manage. After I put together an indicator block and some time series graphs, Voilà: 

green_onion_dashboard.png

You can also see a live version of this dashboard.

What’s next?

Now that we’ve mastered nature, there is so much more to do. The next obvious thing to do is to add more plants. We could even set up a system to automagically water the plants. The sky...or the ground is the limit. 

Did I miss anything? Feedback? If so, let me know. I would love to hear your thoughts.

 

There are 0 Comments

What is Losant?

Losant is an Internet of Things developer platform that makes it easy to build secure, complex connected experiences.

Losant’s platform enables you to intelligently manage your devices, collect and visualize data, and ultimately take action on data through highly customizable workflows - all in real-time.

Get Started For Free

How to Grow Food with the Internet of Things