Ruuvi Tag - Ready To Go

The Ruuvi Tag is distributed ready to transmit environment data packets periodically in either URL or highres (raw) mode.
The (very) faint blinking of the green LED indicates URL mode while the red LED indicates raw mode.
The mode is changed by pressing the B button on the tag.

Be sure to enable Bluetooth in settings on the Phone.

Blue tooth Low Energy Header for advertising packets

Reference:TI.com , Bluetooth.com
byte
offset
 range of
  values
0 04 packetType
1 3E LE Meta Event Code plen 43
03 packetLength (?)
ADV_NONCONN_IND - Non connectable undirected advertising(31 bytes) (not ADV_IND(31 bytes) , ADV_DIRECT_IND, 6x ADV_SCAN_IND(31 bytes)) 23 ??
2 02 subEvent
3 01 numberOfReports
4 00 event type
6 01 peerAddressType
7..12 zz:yy:xx:ww:vv:uu 6 byte MAC LSB first
13 17
19  FEAA Complete service classes
21  
23  FEAA Complete service classes
25  10 Frame type
Max length for BLE 4.0 is 31, BLE 5.0 254.

Packet as seen by hcidump

04 3E 2B 02 01 03 01 C2 24 68 3C 10 C7 1F 02 01 06 03 03 AA 
FE 17 16 AA FE 10 F9 03 72 75 75 2E 76 69 2F 23 42 48 67 59 
41 4D 4C 73 47 B8 

High Res formats 3 and 5

For users who want to custom process the data.

This format does not contain a URL and is not used by the ruu.vi web page.
It is used by:
See Tomi Tuhkanen's ruuvitag_sensor or Henrik Heikkil's ruuvi Collector .
or custom reader/interpreter and additional hardware for receiving .

The tag will indicate highres (raw) mode by faintly blinking the red LED

The data is decoded from "Manufacturer Specific Data" field, undirected, non-connectable bluetooth advertisement. More details are at Argenox .

Current sensor readings transmitted at 1 second intervals.
ruuvi's manufacturer ID is 0x0499.

Note that there are Bluetooth Generic Attributes (GATT) services specifications for services including ESP Environmental Sensing Profile, which include Humidity but those are NOT followed here.

The payload is:

Offset
intrepreted values Description
0 05 Format type code
1 – 2 -40.000 — 84.995 Temperature (16bit signed in .005 centigrade. ) -32768 aka 0x8000 Invalid / not available
Full accuracy range ±1°C: 0°C(32°F)..60°C(140°F) operating range -40°C(-40°F)..85°C(185°F)
3 – 4 0 — 100 Humidity ( 16bit unsigned; one lsb is 0.0025% ) (accuracy tolerance ±3% in the range for 20%-80%, operating range -40°C(-40°F)..85°C(185°F)
download BME280 datasheet( local copy) description.
5 – 6 300 — 11,000 atmospheric pressure ( 16bit unsigned, value max 50kPa) 65535 (0xFFFF) indicates invalid or unavailable
7 – 8 -16,000 — 16,000 Acceleration-X ( 16bit signed Most Significant Byte first)
9 – 10 -16,000 — 16,000 Acceleration-Y STMicroelectronics LIS2DH12
11 – 12 -16,000 — 16,000 Acceleration-Z ( values over 16000 indicates error (implementation pending 10/04/17)
13 – 14.2
(13.14.)>>5
(13.14.)/32
1.6 — 3.646 Battery voltage above 1.6V, in millivolts, 11 bits unsigned (0-2046 )
2047 (FFEx or FFFx) indicates an invalid reading.
Examples:D4B6=3.3v(new); AC9x=2.98v; 9C4x=2.85v; 960x=2.800v ; 8FCx=2.750
Since: 1600 aka 0x640 and >>5 aka /0x20
Use    echo 'ibase=16; print 640+(   9xxx   /20),"\n"' | /usr/bin/bc
14.3 – 14.7
byte 14 & 1F
-40 — +20 TX power above -40dBm, in 2dBm steps. 5 bits unsigned. Value of 31 (0x1F) indicates invalid value.(?)
15 0 — 254 Movement counter (8bit unsigned), incremented by motion detection interrupts from LIS2DH12 Accelerometer
highest valid value is 254, with 255 is reserved for the "not available".
16 – 17 0 — 65,534 Measurement sequence number (16bit unsigned). 65,535 indicates not available. Each time a measurement is taken, this is incremented by one.
Used for measurement de-duplication (depending on the transmit interval, multiple packets with the same measurements can be sent, and there may be measurements that never were sent)
18 – 23 00:00:00:… –
FF:FF:FF:…
MAC aka NRF_FICR->DEVICEADDR | C0 00 00 00 00 00 always leading Cx, Dx, Ex or Fx
 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
05 12 D4 9C 40 C3 40 00 38 00 E4 03 E4 90 76 41 AD EE F7 FA 74 4A 1E 1A            B8 
f  temp  humid atmp  xxxxx yyyyy zzzzz b   t m  -seq- ---- MAC -------- 
m                                      a   X o
t                                      t   p v
                                           r # 

Offset
intrepreted
values
Description
0 03 Format type code
1 0..100 Humidity (one lsb is 0.5%, example: 128 is 64%) (accuracy tolerance ±3% in the range for 20%-80%)
2 -40..85 Temperature (MSB is sign, next 7 bits are value (akward?) centigrade.
3 0..99 Temperature (fraction, 1/100.)
Values over 99 indicates error (implementation pending 10/04/17)
cannot initalize, unreadable, excessive variation from previous reading, exceeds reasonable value (see Bosch selfTest
4-5 300..11000 atmospheric pressure (Most Significant Byte first, value max 50hPa)
Values over 11000 indicates error (implementation pending 10/04/17)
cannot initalize, unreadable, excessive variation from previous reading, exceeds reasonable value
6-7 -16000..16000 Acceleration-X (Most Significant Byte first)
8-9 -16000..16000 Acceleration-Y STMicroelectronics
10-11 -16000..16000 Acceleration-Z ( values over 16000 indicates error (implementation pending 10/04/17)
12-13 1700 .. 3300 Battery voltage (millivolts)
Sample:
99 04  03 C8     15 61      C4 4C        01 1D   FF 3D   03 9D    0B A1 00 00 00
mfgr  fmt hum    temp       atmo press     X       Y       Z      battery
          200    21                                                 2.977
          100%     .97


04 3E 25 02 01 03 01 D5 37 52 68 33 F2 19 02 01 04 15 FF 99 04 03 2C 1A 08 C9 79 00 0B FF F5 03 EB 0A ED 00 00 00 00 CD
                     |------MAC------|                   |CIC|fmt|hum|temp|press |  x | y   |  z  |batt              ||RSSI

See discussion.

Data field descriptions

Humidity : 0% to 100% in .5% increments.
Value:Measurement; x0000:0% ; 128:64% ; 200:100% ; 255 error to be implemented
Temperature: -127.99°C to +127.9 °C (well over boiling!) in .01°C increments.
Value:Measurement; x0000:0°C ; x8145:-1.°C; x0145:1 °C
Atmospheric Pressure
50,000 Pa to 115,536Value Measurement: Pa in 1 Pa increments. (1003-1026 range found by scrin https://graphs.2kgwf.fi/dashboard/db/ruuvi-demo)

Value:Measurement; 0-50000 Pa; 41325:101325 Pa (average sea-level pressure) ; 65534:115534 Pa ; 65535 error to be implemented

Acceleration -32000 to 32000 (mG), 16 G max (2 G in default configuration).
Values are 2-complement int16_t, 3 channels X,Y,X
Value:Measurement; 0xFC18:-1000 mG ; 0x03E8:1000 mG ; 65535 error to be implemented
Battery voltage 1800 mV to 3300 mV in 1 mV increments, accuracy? ; 1000 error to be implemented
ToDo: "special" values to indicate error.


Format #4

The Ruuvi packets are embedded within an Eddystone URL frame.
Which begin at offset 25 within the packet.

ruuvi Beacon URL Data Formats for sample Application: Environment Station

(doesn't really tell [let alone predict] weather [rain,sunlight…)

The purpose for this (and other URL formats is to provide a means for users familiar with web programming, who are not familiar with C programming and the toolchain, the abliity to process the data from the tag.

Frame Specification (summary):

byte
offset
 range of
  values
0   x10   Frame Type
1  -100..+20   TX Power Calibrated Tx power at 0 meters. This allows for estimating the distance to the tag.
 Max for nordic nRF52832 is 4
200..03
¤
Encoded Scheme Prefix
¤ codes:
00 http://www. , 01 https://www., 02 http://, 03 https://
URL (17 bytes)
3..ia-z and - Domain Name (case insensitive, ie translated to lower) (Choose the shortest possible since the total length is restriceted)
i+1..j
or
.c…
Top Level Domain
codes:
00 .com  01.org   02.edu   03 .net  04 .info  05 .biz  06 .gov 
07 .com/ 08 .org/ 09 .edu/ 0a .net/ 0b .info/ 0c .biz/ 0d .gov/

     or
a..zz text characters to specify other (case insensitive) TLD, for example .fi,.us,.edu,.vi,.io,.tv,.news …  
j+1..20c…Beacon Data Characters (Application dependent)

The web server address is nearly minimal ¤ruu.vi/ Where the ¤ is the protocol code x'03' for https://

This allows only 10 characters for the beacon data which must be printable and cannot contain most special characters. (an address of the form XYZ.com/ or XYZ.info/ would allow 12 characters since a code could be used for the TLD and slash).

The beacon data is encoded using a base 64 scheme* This causes 3 bytes to expand to 4 characters; 6 bytes expands to 8 characters. When viewing the packet with a diagnostic tool or the URL in the address bar of a browser it is this string of characters which is visible.

Some URL formats are prefixed with the fragment identifier introducer (#) allowing only 9 actual beacon data characters. The # appears to immediately follow the / from the web page viewpoint. For example: ruu.vi/#BnALAMNQr
This allows the default web page, index.html, to provide the decoding algorithim and page formatting.
The data from the beacon is specified as the fragment identifier. Since the fragment is NOT transmitted, the web site cannot process any information other than the time and IP address. Fomat 8 addresses that.