Change ruuvitag accelerometer sample rate


I need to change Ruuvitag accelerometersample rate to at least 50hz, I downloaded the fw version 3.17.0, modified the APPLICATION_ACCELEROMETER_SAMPLERATE to 50 and
lowered the APPLICATION_ADVERTISING_INTERVAL to 110, then rebuilt the firmware

With those change I get faster data accelerometer but are far from 50hz, it seems more like 10 payloas every 1 second.
I suppose the APPLICATION_ADVERTISING_INTERVAL how often sending the payload.
So in order to reach 50hz but as the comment in the code suggest I need to avoid “even” values, so something like 55?
Is still feasible or is going out of sync?


Advertising isn’t suited for fast sample rates, minimum advertising interval is 100 ms + 0 - 10 ms random delay. You should use GATT connection instead for streaming acceleration data.
I’d also use 3.29.0 as a base for the firmware.

For more details about accelerometer streaming, please see

Hi Otso,
I’ve read your excellent articles on motor monitoring ( even if I’ve not full understanding of all the steps you did since I’m not a C dev)
I was just learning about gatt profiles and I see some config parameter in the application_config.h but is not clear what I need to change, how do you enable/use it?

On the gateway right now I’m fetching data using a node.js library node-ruuvitag which is based on Noble and leverage a lot of work with it…I did some search in the repo and there some mention about gatt so I guess I could still use the library.

Doing similar acceleration streaming requires digging into the C, I’m afraid, and you’re going to need to write the receiver for GATT data. too.

If 10 Hz is enough, you could use the broadcasts.

I supposed so, thanks for letting me know about it…switching Espruino could maybe be easier and still feasible with JS?
Otherwise I’ll try to find someone that can help with the C code or stick with 10hz.

Hi @otso I decided to give a look to the firmware code, I downloaded the v3.29.0 as you suggested but on the segger editor I see a lot of different project. Which is the correct one?

I tried to build and download “ruuvitag_b” but when I turn on the ruuvitag it just blink the red led and I can’t scan it.

I’ve also built your older release 3.16.1, it contain just 1 project and at least I can discover the ruuvi

ruuvitag_b/debug is the correct one for development. Maybe you’re having the bootloader in your tag which prevents the app from booting? Run a full erase. Also, please note that the selftest of debug firmware takes a minute or so to boot.

Thanks…yes you were right, I had to erase the ruuvitag from segger ide. I had some time to spend on the code and the nordic sdk.
Other than APP_SENSOR_LIS2DH12_SAMPLERATE I changed MIN_CONN_INTERVAL and MAX_CONN_INTERVAL ( in nrf5_sdk15_platform\communication\ruuvi_nrf5_sdk15_communication_ble_gatt.c ) both to 10ms and the data rate improved but is far from 100hz…made a short video, I retrieve data with the nodejs node-ruuvitag library. At glance Is seems no more than 10hz

The terminal is an ssh to a raspberry pi zero (the small black box behind the devkit), the nodejs script is running there

Anyway I noticed also that the BLE maximum connection interval is in theory 7.5ms so about 133hz…now I guess I understand the use of a ringbuffer in your motor vibration monitoring :slight_smile: