Skip to content

RPi Airquality Station: Logging Airquality-Data to Grafana

Authors: field_5dd42fd9200b2

Goal:

Log data to an online grafana database, and then view the resulting graphs and maps.

What you will learn:
Configuring easybotics air-quality sensors,
setting up the grafana logging node
viewing the logged data.

 

What you need to know:

Parts List:

  • Full easybotics air-quality station kit
  • Raspberry pi
  • Internet Connection

 

 

Setting up node-red:

Start Node-Red and navigate to 127.0.0.1:1880  using the web browser. Drag in all the air-quality nodes, and the BME node from the palette.
Select the C02 node, from the drop down menu select ‘Add new sensor manager’; the only configuration here is to switch the ‘Automatic C02 calibration’ to ‘Manual’.

By default the C02 Sensor will zero itself to the lowest C02 level it detects in a 24 hour period, pinning that value to 400ppm which is the atmospheric baseline. If your air-quality station is indoors, or in a crowded place this might lead to inaccurate data so you can change it here to manual.

Next select the PM concentration node, and Particulate node and select the Sensor Manager you made from the dropdown.

With this the config is far enough too start printing data to the led-matrix (if you have one); with the setup looking like this.

 

For the next steps you’ll need the influxdb username and password that should have been provided to you.
Select the ‘Publish to Influxdb’ node and enter your username and password here.
For the GeoHash field you’ll need to use a tool like this one: http://geohash.gofreerange.com Drag the map around, and click to generate different scale geohashes. Remember that the more digits you use the more specific of a location you’ll be providing to the T3 database.

Now you can link all the sensor nodes into the publish node like so:
The URL status below the node is where you can find your logged data, sadly you can’t copy and paste out of the status bar thing.  The node pushes the url out as a message, so using a debug node you can retrieve the URL and view your graphs.

 

What’s Next?

Simply graphing and storing your data is the simplest and most obvious setup, but node-red offers almost unlimited potential.

As an example project, think about how you could setup email alerts based on air quality. Node-red comes with an email node, so obviously there has to be chain of nodes that goes from an airquality node and eventually reaches an email node, based on your requirements you can work out how these nodes will go together.

Here are some hints:

  • If you don’t want hundreds of emails being sent a day, the delay node can act as a ‘rate limit’ and limit the amount of messages that pass through it
  • The switch node can be used to only send messages when its input reaches a certain value
  • The email node wants the email to be contained in a payload, how do you change the contents of a message into the email you want?
Back To Top