Collecting RuuviTag measurements and displaying them with Grafana

Battery usage looks weird as wellā€¦

That does indeed look odd :thinking: from 6:00 to 8:30 it looks normal, except that voltage is increasing, which sounds like the load has been smaller at that time. Could be either bad contact with the battery or something really wrong with the tag. Have you tried to gently wiggle the battery clip against the battery surface as well as rotating the battery while the battery is inserted to tag to make sure thereā€™s no excess dust or grease?

Sieppaa

So is there working image for this project? Downloaded this two times today and both times i get corrupted zip file :confused:

It seems that some programs have trouble with the unzipping :thinking: The image was zipped on Mac OSX with Keka, maybe I should try zipping with 7-zip

The CRC is actually wrong, some programs just ignore it. Either the zip is actually corrupt, or this Keka does not create proper checksums :thinking:

I tried using Keka to unzip it. Does not ignore the wrong checksum.

Worse yet, I had a previously unzipped copy of the image and tried it on a brand new Pi 3B (not the B+ that I spoke of in this thread) and the Pi fails to start up.
First error:

dbus.socket: Unit lacks Listen setting. Refusing.

Didnā€™t have ANY issues with the last fresh load of ruuviberry onto a new Pi 3B.

Any ideas? Iā€™ll also research the error logs elsewhere, but thought someone might have already had this experience.

I wonder what has corrupted the image :thinking:
The image was scheduled to be updated anyway, so I suppose that task got bumped up in priority

Updated image is now available at
http://storage.ruuvi.com/ruuviberry_2018_04_18.img.zip
MD5 of the zip is f37960e8733d99f7a6c2687452c40f24
and MD5 of the image is 570d489116f91883260900f3e2b64d39

User: pi, password: raspberry.
The Raspberry acts as a WiFi hotspot, SSID ā€œRuuviGWā€ and password ā€œruuvi-gatewayā€.
Grafana user/password is admin/admin .
Port 80 is redirected to port 3000 (Grafana) and everything should start on boot.

Blog post draft detailing on how the tag was set up is at
https://blog.ruuvi.com/setting-up-raspberry-pi-3-as-a-ruuvi-gateway-6e4a5b676510 .

I havenā€™t yet had a chance to download, unpack and flash the image to verify the integrity, maybe tomorrow.

2 Likes

The prepared image works fine. For some use cases it may be good to downsample the data.
E.g. after one year with 5 ruuvitags I got problems with the amount of data in the database.

Because I have to search a little bit to get it working, here is an example how to set up downsampling.

In this example the original data will be stored for 7 days, and deleted after this time.
For long term storage 30 minutes mean values of some measurements will be stored.

Step by Step:
Connect to raspberry shell and type influx to start the influx db command line interface.

Switch to ruuvi database
> use ruuvi

Change the duration of the default retention policy to e.g. 7 days. So that after 7 days the detailed data will be deleted.
> ALTER RETENTION POLICY autogen ON ruuvi DURATION 7d

Create a new retention policy for the long term data
> CREATE RETENTION POLICY "forever" ON "ruuvi" DURATION INF REPLICATION 1

Check the results
> SHOW RETENTION POLICIES
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 168h0m0s 168h0m0s 1 true
forever 0s 168h0m0s 1 false

Create a continuous query for the data that you would like to store long term.
In this example the mean values of 30 minutes intervalls will be stored for temperature, humidity, pressure and battery voltage
> CREATE CONTINUOUS QUERY cq_30m ON ruuvi BEGIN
SELECT mean(temperature) as ā€œmean_temperatureā€, mean(humidity) as ā€œmean_humidityā€,
mean(pressure) as ā€œmean_pressureā€, mean(batteryVoltage) as "mean_batteryVoltage"
INTO ruuvi.forever.downsampled_measurements
FROM ruuvi.autogen.ruuvi_measurements GROUP BY time(30m), mac FILL(null) END

2 Likes

Nice tip and well explained example :+1:

Though I would recommend doing everything else first and then alter the default retention policy as the last step, to avoid accidentally losing data while fiddling with those :slight_smile:

1 Like

Isnā€™t it port 3001? Or did that change in this image?

The grafana default port is 3000, Weā€™re using 3001 in some other applications

Never mind. I must have changed it to 3001 on my very first install and propagated that through my own image when the online image got corrupted. My bad.

However, a note of relevance from the grafana docs if you are deploying sensors in a multi-user environment: ā€œThe default Grafana port is 3000, this port requires extra permissions on windows. Edit custom.ini and uncomment the http_port configuration option (; is the comment character in ini files) and change it to something like 8080 or similar. That port should not require extra Windows privileges.ā€

http://docs.grafana.org/installation/windows/

Thanks for updated image, it works fine now!. Just few observations:

  1. If you have latest Raspberry 3B+ , it is not able to boot with that (http://storage.ruuvi.com/ruuviberry_2018_04_18.img.zip) image. Most straightforward way to get it working is to boot older raspberry with the image installed on Micro-SD card and run
    $ sudo apt update
    $ sudo apt upgrade
    After update, you may boot 3B+ with the card.

  2. Tags work reliably with 3B+, but just as a side note, there seems to be temperature compensation problem with tags. I have one tag monitoring Green House where temperature changes during the night. That seems to affect readings that should be otherwise stable, like battery voltage and acceleration. See graphs (Brown line is Green house, others are inside the house).

Temperature:
temp

(as a new user I have to upload other images in separate posts below)

As you can see Acceleration changes only with GreenHouse sensor but no others (so itā€™s not moon affecting Earths G).

Is/should Ruuvi use voltage regulator instead of relying on battery voltage, which is known (because of Lithium) to be affected on Temp. In Bosh chip data sheet there is instructions on compensation of readings, are they applied? I havenā€™t check accelerometer chip data sheets what it says about compensation.
Our tomatoes can live with this error, but if more certainty on readings is needed, one way is to (Temp) calibrate sensors and apply corrections to DB.

Nice work with Ruuviberry image and Ruuvi Collector!
PS: In case someone has Bluetooth problems with PI after using BT keyboard or mouse, you must ā€˜unpairā€™ them first, to allow BT adapter to go to HCI-mode. Wireless keyboards etc. are HID devices and cannot be used at the same time (not even configured).

Battery voltage:
batteryVoltage

Acceleration:

Hello,

The battery voltage really varies with the temperature, so there is nothing to compensate.

Both humidity and pressure calculation use temperature when converting from raw ADC value to physical value.

Accelerometer is not temperature compensated, as STM does not provide any kind of compensation curve.

Is there a change log or something for the ruuviberry image? I got 2018-05 image without e.g. apache and trouble setting date and getting network via ethernet.

I am also not able to get the ruuvi-names.properties to work, the tags show up as e.g. ruuvi_measurements.mean {mac: E6034A5BF58D}

Also, I am not able to run hcitool lescan without Input/Output error
I have to run sudo hciconfig hci0 reset first to get it to work.

Thereā€™s no changelog, but you can find the description of image at https://lab.ruuvi.com/ruuvitag-fw/ .
What version of Raspberry Pi youā€™re running?

Grafana shows all tags by mac on default, you can configure the aliases if you want to.