I grew up in countryside. My father has three polytunnels which are about 1000 m2. He has been growing cucumbers since 1992. I've been working with him since I was 8, mostly this was one of the activities I was doing after school and on the weekends. But as I finished high school, I moved from home to the capital and got my degree in Business Information Technology.

Now I work as a DevOps Engineer and as such we have an almost infinite collection of awesome devops tools and I realized, this could be reused not just to monitor the CPU usage of the servers but to visualize the temperature in our polytunnels. The decision has been made, I just had to find out which ingredients I should use to put together the whole project.

The ingredients

Hardware

What I needed here is a http://grafana.org/ to find out what the temperature and the humidity were, also it had to have the ability to send the values to a remote server.

Previously I had already purchased an Arduino and Raspberry Pi as well. Using Arduino seemed a bit more complicated and low level for this. I wanted something that works out of the box, easy to install, cheap to replace. Then I met Texas Instruments' Sensortag which works through Bluetooth so it can be connected to the Raspberry and the Raspberry can connect to our home Wi-Fi and send the data to the remote server. If you are not familiar with Sensortag, it is a development kit which includes multiple sensors (humidity, temperature, pressure, gyroscope, accelerometer, magnetometer) and uses Bluetooth4 for communication and costs 25 USD.

This is the current architecture:

Software

I am a huge fan of Riemann (Riemann aggregates events from multiple sources and makes it easy to react to them or forward them to multiple consumers) but I did not want to use JVM on the Raspberry so I have chosen the Node.js port of Riemann called godot. I created a few modules to make it work. So I am sending the metrics from the Raspberry PI using the godot client to a cheap OpenVZ server where the godot server puts this into InfluxDB and the data is visualized by Grafana:

Oh and of course the whole project is open source: https://github.com/oroce/sensortag-with-godot

Current status

SensorTag in the polytunnel

Now the system is pretty stable, it has been there for almost 4 months and now it is part of the decision making progress. My dad is pretty happy with it, he can easily find out the status of the polytunnels using his Nokia Lumia. I am also monitoring the Raspberry itself, because during summer the temperature can go up to 50-60 degrees (Celsius) and the humidity can be up to 100%.

Raspberry temperature

TODOs

The next step will be to broaden the monitored area:

I want to put two sensors in every polytunnel and also put an external sensor outside of them. Probably I should move from Wi-Fi to cable.

Also my biggest challenge currently is the battery - it lasts cc. 2 weeks. Unfortunately there is no official battery for the Sensortag but the support pointed out that it should work.

As a DevOps point of view the next big thing is to implement the TTL and expiry-based event flow event flow. And turn on the alerting for:

low battery levels for the sensors

internet connection problems

out of timewindow metrics

And then plug it into PagerDuty. My dad was amazed by PagerDuty when I have told him. Unfortunately - as I mentioned my father uses a Lumia - Windows Phone 8 is not supported by Pagerduty :( So probably I will start with a Push notification service like pushalot.

Final thoughts

Open source is an amazing thing. There are a lot of great open source projects which will blow people's mind who are not in the same industry as we are. And as you could see I am not doing anything special, just putting stuff together which were made by amazing people. THANK YOU PEOPLE OUT THERE, YOU ARE AWESOME.

PS: this is how the Raspberry looks like, because I broke the case the very first day :)