Technical writing and research done by Andre Genis


This is a little about how to use Grafana with a Raspberry Pi to visualize data that has been collected over time.

In Grafana there are a lot of interesting ways to show data that has been collected. Each of the different ways can be used to visualize the data in the most informative way.

Grafana requires a data source where data is saved with a corresponding time stamp. This can either be a local or cloud-based database. To display the data you will need to use a dashboard that you can set up or get from the published ones that are free on the Grafana website. The published dashboard is great for getting starting, getting new ideas and to see how layouts are generally done.

Advantages of Grafana

Grafana allows you to display data in different formats. For example, you can us a normal line graph to visualize data minimums and maximums over a period of time in a continuous flow of data. This would be for some thing like the room temperature and humidity. Another example would be if alerting is required. Alerting can be setup on a data and notifications can be sent out through various channels.

Dynamic visualization is also a great advantage which allows time spans to be changed for analysis of older data. Dynamic dashboards can also be used where a templated dashboard is created that can be re-used for various data points.

You can find more information of Grafana features here.

Disadvantages of using Grafana

One of the main drawbacks is that Grafana is a visualization tool only and doesn’t allow for controls. As an example of you would like to start or stop a fan, you won’t be able to add push buttons to Grafana to do this.

Another drawback is that the free version of Grafana doesn’t store data (Grafana Cloud however does).  If the system is local then the easiest to set up a database on the raspberry pie with either a SQL server or InfluxDB server. This works very well but you must monitor the size of the database on the raspberry pie since if it gets to big then you will run out of space on the SD card of the Raspberry Pie. The other way is to have the data saved to a cloud-based server like Microsoft Azure or Google Stackdriver. This is a lot more problematic. Since this requires constant internet connection. And the connection setup is a bit trickier. Usually cloud storage free version only has a limited data storage available (usually 30 days).

Installing Grafana

If you are going to run the system locally on the Raspberry Pie you are going to have to install both Grafana and the database server on to your Raspberry Pie. Links are provided with how to do this.

Information can be found here for intstalling Grafana server on a Raspberry Pi or Ubuntu system.

Information can be found here for installing Grafana server on MS Windows.

The previous links provides setup guides for Grafana on various platforms. Once done a database needs to be installed to store the data to be used by Grafana.

The example below is for using an Influx database, but you can use any other database such as SQL Lite.

Information for installing inFluxDB server can be found here

Information for installing SQL lite server can be found here

Once you have installed all the software you need write the data into the database. The easiest way to do this is with Node Red(Please see our previous blog on Node Red). This however can be done with any of the software that is compatible with Raspberry Pie. If your are getting started with program I would recommend Node Red since it is straight forward and can be learned rather easily.

Once you have data in the database you just need to set up the dashboard. This is first step is to run Grafana. With the server running on your Raspberry Pie you need to go to your preferred web browser and use IP Then the next step is to set up your data source which will be the database that you setup earlier. The address of the database will be the local host IP or you can use the loopback adapter IP The port number however will depend on the database you are using. For example, if you are using influxDB then the address can be After you have provided the IP address and port, you need to provide the database name and test the connection between Grafana and the database.

You are now ready to start creating your first dashboard. After visualizations has been added to the dashboard, the visualizations need to be linked to a tag (specific data point within the database) This is done under the queries section of the graphs settings. The first step is to select the data source that you will be using and add the variable name that you want to display on the graph.

The blog is a very basic introduction to Grafana and the Raspberry Pi. Grafana has a tutorial and documentation section that will provide more information and guidelines.

Leave a comment