Collecting RuuviTag measurements and displaying them with Grafana

Thank you for the detailed post, awesome work!

Right back at you! :slight_smile: I actually started writing a node-red-contrib-ruuviweather last week the same way you have, but I got distracted by having to relocate all my code from a failing Pi. I suggest you publish your code to npm, as it’d make it all practically plug-and-play for Node-RED.

I figured node-red-contrib-ruuviweather was more suitable than node-red-contrib-ruuvitag, just because RuuviTags could be used for more than just the default weather firmware.

I’ll look into publishing the code into NPM as soon as the dependencies of package are in good shape. I agree with you that “ruuviweather” would be a more descriptive name to current node, and since the message current node sends out does not contain format information from node any update to current node would break user applications.

Maybe we’ll publish the current node as RuuviWeather ASAP and support the current weather station firmware with it and make another development version node which would support upcoming features such as connecting to tags over GATT. Thank you for the suggestion :smile:

1 Like

Hi,
I spent some time with this node, trying it out with my intended use case - flowing sensor data into InfluxDB for monitoring lab environments. After looking at the InfluxDB node-red node I decided to try a little change and it’s worked out well. It leads to a quite simple node-red flow: scanBLE -> ruuvinode -> influxdb, with nothing else needed to get the sensor data logged the way I was looking to do it.

The InfluxDB node will take an array of objects - the first is a list of field values, the second is a list of tags. It made sense to me that the uuid of the Ruuvitag would be a good tag and all the other data would be good fields.

My goal is to have several groups of sensors monitoring discrete entities within one larger lab. So say three sensors in dome 1, two sensors in dome 2, a sensor in computer rack 1 for example.

The idea is to catch the data from all sensors into one measurement with a relatively short retention policy and have continuous queries run to sort the data by uuid into time-averaged measurements for dome1, dome2, and rack1. It looks like it’s going to work great.

The code change I made from the excellent node @otso supplied is simple:

  ruuviData.rssi = msg.rssi;
  // msg.payload = JSON.stringify(ruuviData);
  let ruuviUuid = {};
  ruuviUuid.uuid = msg.peripheralUuid;
  msg.payload = [ruuviData, ruuviUuid];
  node.send(msg);

That’s it. If it’s of any use feel free to pick it up. Thanks again for the node!
Mike

2 Likes

hi otso, what files do I enter my ruuvi mac addresses into? And thanks for the image.iso

Hello Mikael,

  1. Start grafana: sudo systemctl enable grafana
  2. Point your browser to your grafana installation, e.g. http://ruuvi.local or http://IP_ADDRESS:3000
  3. Edit the mac values in grafana dashboards

EDIT: New image runs on http://raspberrypi.local or http://IP_ADDRESS, i.e. on port 80. Therefore there is no need to add :3000 anymore to URL

Hi otso,

  1. I tried: sudo systemctl enable grafana I get an error: Failed to execute operation: No such file or directory. I didn’t think I needed to be in a specific directory.
  2. so I did: sudo systemctl enable grafana-server.service
  3. systemctl list-unit-files now shows grafana-server.service is enabled

However, ruuvi.local in bonjour enabled computer returns Service Unavailable. Do I need to enable apache somewhere?
and through http://192.168.0.106:3000/ I get This site can’t be reached.

Any thoughts for next steps? Thanks.

Hello, Apache is enabled by default, so it should be ok from the start.

Sorry for incorrect command for enabling Grafana, happy to see that you got it fixed.

I’m assuming your error is “ERR_CONNECTION_REFUSED”, which would mean that the Grafana is not accepting connections. Could you please run “systemctl status grafana-server.service” to check that Grafana is actually running? It might be that enabling the service will only start it after the next reboot. If so, you can manually start the service by “sudo systemctl start grafana-server.service”

Hi otso, I ran status check: --> active (running)

in browser on pi3 just did ruuvi.local and it worked! Not sure what went on there. I rebooted system awhile ago and gave it time in case anything was slow to boot or start. I’m in grafana now and working to setup the mac addresses.
Thanks.

Hello otso, I’m new to Grafana. How do I update the mac addresses? I’m not sure how to update the mac addresses. Can you point me to any resources on this? Or do you have instructions on how to do that?
I tried updating the mac addresses via the drop-downs, I think, of my 4 ruuvitags (running latest weather firmware; tried both in normal mode and high precision) in Temperature dashboard but I think it broke it. Not sure what I did wrong of if that is how to do it.

hcitool lescan shows my tags are broadcasting and the pi3 can see the tags. Thanks

It looks my rvitag mac addresses show up under the drop down menus, along with the 4 previous build mac addresses, do I simply change those to mine? When I do change those mac address to mine there isn’t any data posting.

Hi, you need to sign in (admin/admin, please change)


Click on frame of the panel and then “edit”

Open a measurement window and change mac address. You’ll have “known” mac addresses in dropdown menu.

Wow, perfect, thanks. I forgot to change admin in Grafana thanks. I also thought it was updating the dashboards automatically, but it wasn’t, so I had to change it to a new range (last 15 minutes) that proved the updates were working. Thanks.

Do you know if Ruuvi is going to allow remote query timing? Right now in high precision it updates fast but grafana is only pulling in every 10 seconds. It’d be good to be able to tell the rtags how often you want to get a sensor read. Do you know if that is in the works and/or possible?

Thanks for all your help!

The throttling you are seeing is intentional on the RuuviCollector, by default it will save at most one measurement per tag per 9.9 seconds. You can change this setting from the configuration file: ruuvi-collector.properties which is located in the same directory as the ruuvicollector .jar file. If the configuration file does not exist, you can create it and enter the values manually. The setting controlling the update limit is influxUpdateLimit which has a default value of 9900 (it’s in milliseconds). You can find more up-to-date information about the config in the example configuration. Don’t forget to restart the RuuviCollector after creating/changing the configuration

The reason for this kind of limiting is to avoid too many values getting persisted, especially if running slow hardware like the raspberry pi, or if you are collecting measurements from a lot of tags, so you should experiment with different limits like 1 second or 100 milliseconds to see what fits your needs and work with your setup.

Great thanks.
Two questions.

  1. Is there a way to set the tag read rate so to reduce power consumption? I’m wondering only to calculate the life of the tag in high-precision mode.
  2. Do you know the power usage level of the tag in high precision mode? I did see the Trello post regarding power usage: "Applications generally use ~2-10 µA while idle, ~1.3 µA on shutdown. Peak currents can reach ~13 µA when radio is operated."
    Thanks, and the ruuvitags are awesome.

Transmitting the values is what consumes the most power, if I recall correctly, at 10s transmission interval the average power consumption is <8µA, which means about 8.5 years with the battery that’s shipped with the tag. The reality less though, especially since the shelf life of lithium batteries is 5-8 years, closer to 8 years with the size used by the tags. The transmission interval can be changed in bluetooth_config.h

Awesome. Thanks. I’ll look into that. Even if at 13µA it could last for 6 years!

Hi everybody.
Sorry for my poor english, but i’m French :slight_smile:

I have 2 tags in raw mode (I verify it with the android application). I change the mac adress to chose these 2 tags ( mac adress appear autmatically in the dropdown menu, so I think the raspberry has seen the 2 tags).

But no data appears on the temperature graph in Grafana even If I force the update.

Any idea or other procedures to complete ?
Cyril

First, you should verify that you have the right time and date on the raspberry, as the metrics are stored using the time on the raspberry pi.

Second thing to try is to set a lower limit in the “Group by time interval:” near the bottom of the page, this value should be roughly the same or little higher as the measurement collection interval, for example “>10s”.

Setting too low value may create unwanted gaps in the graph or make the entire graph invisible, and too high value will make the graph resolution low.

1 Like

Clock was OK. The problem was with the period of time displayed. It was stay on the period of may 2017.
In changing to displqy thisday, all the value of my tag appear :):grin:
I’m happy. I 'm going to continue to deal with this tag.

How to access to the other parameters, acceleration for example ?

Create another Graph panel (or any other panel type you want) and choose another metric type in the “FROM” section:

With acceleration, remember to either choose a specific axis (or total) in the “WHERE” section or use the “GROUP BY” functionality, otherwise Grafana don’t know how to interpret the values for different axes properly and you will end up with incorrect values on the graph.

1 Like