So you want to make a cool dashboard?

Emery Silberman
4 min readMar 23, 2018
Not too shabby eh?

While working on a farm, you recognize that there are a lot of things happening that you don’t know about. This is why ag-tech is such a huge sector currently. The problem with all of these different companies offering cool sensors that do this and that is they all have their own dashboard. At Bowles Farming, we currently have over 30 different dashboards that all provide their own information and data. Do you know what happens when you have a million different dashboards? That’s right; you don’t look at any of them.

Now this is why you need to build your own dashboard that has the information you need about the things you care about. Of course you will probably run into services that provide dashboards and plugins for services but… AG doesn’t plug into anything because farmers usually settle for the dashboard that comes with the service.

What kind of dashboard do you want to build?

In this post I will be talking about specifically time series data, but if you have other needs, you might want to look into tools such as the ELK stack or mapbox.

It helps when the dashboard is not only pretty, but useful too.

Since your still reading, I’m going to assume you too want to build a time series dashboard. Great! Here’s the steps:

  1. Check out https://www.influxdata.com/
  2. If you like what you see, the easiest way to get started is with their TICK stack docker image
  3. Install the TICK stack on a server (AWS, G-Cloud, Azure, a server in your closet, etc…)
  4. Now you just have to get data into the database!

Getting data into the database

InfluxDB is a modern time series database and as such, you connect to it via the API. Docs on the api can be read on Influx’s website, but I found the easiest way to start communicating is with the python library for Influx. This was the most helpful piece of documentation for me to just start pushing data.

What data are you putting into the database?

You must find out how to collect the data that you want to put in the database, and since this is time series, I figured weather would be most appropriate. To start, I just registered for the weather underground(WU) API and they even give you example calls in the documentation.

Python script to move data

Python stuff

I’m familiar with python so thats why I’ll be using python but feel free to use what you’re familiar with. The basic mechanics of the script are to make the WU API call using urllib2 then parse with json. Once the data you want to log is parsed and pulled into variables, just pass those variables into the influx call. The Influx python example shows exactly how to push data, so just replace their data with your variable.

Scheduling

An important part of this is the ability to push data on an interval. With my current setup, I log the weather data on a 15 min interval. To do so, I use something called crontab in linux. Crontab allows some command to be called on a schedule. So I just set my interval as 15 minutes and have it run the python script on that interval. This then pulls the data from the Weather Underground API and pushes it to the influxDB API to be placed in the database.

Adding graph from data

Adding a Graph

This is obviously the most exciting part because you get to make pretty graphs. The best part is that it is super easy!

All you do is go to the dashboards and press add cell. From there, you just set up the query and browse the database for the values you are trying to display. Under the options tab, you can customize the graph to be a line graph, bar graph, number, etc…

Additional cool stuff

The best part about using the TICK stack is that it includes many more features along with your basic time-series database. One of the features I found to be incredibly useful is something called continuous queries. These queries allow you to take some function and preform the operation on an interval and place the data in another database. This function allows me to take a day’s worth of data on a 5 min interval and convert it to the days high, low, and mean to do the growing degree day calculation.

I haven’t used this function yet, but the TICK stack also contains a streaming filter for alerts. This function is accessible through the cronograf interface. It allows for you to create functions of alerting if over/under/outside range queries that send alerts when triggered. This tool could be incredibly useful for system monitoring.

Hopefully that clarifies how to make a cool dashboard. If you have any questions that aren’t influx specific, feel free to drop me a line at:

emery@bfarm.com

--

--

Emery Silberman

Working to solve to worlds problems starting with technology in agriculture.