Logging Raw Grafana Data for Ruuvi sensors


#1

Hello,
I have RuuviBerry installed on my Raspberry Pi 3 and it works well.

I am wondering how to create a log or database that keeps track of ALL the measurements over time…Anyone here can help me?

Thanx,
Mike


#2

What kind of database do you need? RuuviBerry image uses InfluxDB (a time-series database) to store the measurements and you can access this database on the Raspberry Pi


#3

Ok…How do I access this database?? Where is it located?? Does it record ALL measurements and if not, how do I configure it to do this???


#4

I don’t have the RuuviBerry myself as I’m using my own setup which is nearly identical to the one on RuuviBerry, but it should be installed on the RuuviBerry with pretty much the defaults as far as I know, that means you can use for example the influx CLI client (which should be installed already) to explore the data. See Schema exploration for exploring the database structure, and Data exploration for exploring the actual measurements, for example:

$ influx
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
> show databases
name: databases
name
----
_internal
ruuvi
ruuvi_test
> use ruuvi
Using database ruuvi
> show measurements
name: measurements
name
----
ruuvi_measurements
> show field keys from ruuvi_measurements
name: ruuvi_measurements
fieldKey                  fieldType
--------                  ---------
absoluteHumidity          float
accelerationAngleFromX    float
accelerationAngleFromY    float
accelerationAngleFromZ    float
accelerationTotal         float
accelerationX             float
accelerationY             float
accelerationZ             float
airDensity                float
batteryVoltage            float
dewPoint                  float
equilibriumVaporPressure  float
humidity                  float
measurementSequenceNumber integer
movementCounter           integer
pressure                  float
rssi                      integer
temperature               float
txPower                   integer
> select time, temperature, humidity, mac from ruuvi_measurements order by time desc limit 5
name: ruuvi_measurements
time                temperature humidity mac
----                ----------- -------- ---
1546764937759000000 -5.66       91.76    D4DB9B4E01CE
1546764936105000000 23.96       23.7075  D043EC59988B
1546764935435000000 21.9        23.605   C70FBF2F4C8E
1546764934913000000 36.11       13.9175  F23C618207D5
1546764934326000000 -5.14       91.6925  D94492890B70

or if you want to get the data from a query with a single command (in a script for example), you can select the database and supply the query as a parameter. You can also change the output format to json for example:

$ influx -database ruuvi -format json -pretty -execute 'select time, temperature, humidity, mac from ruuvi_measurements order by time desc limit 5'
{
    "results": [
        {
            "series": [
                {
                    "name": "ruuvi_measurements",
                    "columns": [
                        "time",
                        "temperature",
                        "humidity",
                        "mac"
                    ],
                    "values": [
                        [
                            1546765499862000000,
                            -5.07,
                            91.725,
                            "D94492890B70"
                        ],
                        [
                            1546765499359000000,
                            -3.73,
                            78.57,
                            "F0CD34B3A94E"
                        ],
                        [
                            1546765498328000000,
                            -5.59,
                            91.7975,
                            "D4DB9B4E01CE"
                        ],
                        [
                            1546765498061000000,
                            5.82,
                            60.925,
                            "F97C6AB5E88F"
                        ],
                        [
                            1546765497061000000,
                            -19.07,
                            45.3675,
                            "F48A9E7D8181"
                        ]
                    ]
                }
            ]
        }
    ]
}

#5

What is the functional relationship between the battery voltage and the total charge of the device.Or, how do you look at the rest of the life of ruuvi tag,thank you for your help.


#6

This is somewhat complex, as the voltage depends on temperature and load.
The tag will continue operating down to 1.8 V, but radio transmissions will cause voltage to droop under measured voltage. Generally when the measured voltage starts dropping quickly in stable temperature the tag is nearing end of life.


#7

More details con be found at