Sampling data from Arduino Nano 33 BLE Sense using Bluetooth

Hi,

I’ve just completed a very good course Introduction to Embedded Machine Learning on Coursera and looking forward to use my new skills.

I’d like to build an activity tracker using Arduino Nano 33 BLE Sense or Arduino Nano 33 IoT similar to Sheep Activity Tracker. I need to collect data samples of different activity types. But these activities require some freedom of movements. Arduino Nano 33 BLE Sense doesn’t have WiFi, but has BLE. Arduino Nano 33 IoT has WiFi, but is not supported by Edge Impulse. I’m wondering if there is an option to perform sampling of data from MCU over Bluetooth?

I’m thinking about the following options:

  • MCU->RPi (BlueZ)->Data Forwarder
  • MCU->Android app->Ingestion API
    Could you please let me know if I can reuse existing solutions or if there are any projects I can use as starting point?

Regards,

Sergey

FYI, we’re working on something like this at the moment together with Nordic (although targeting their development kits first, not the Nano) - but this will take some time before release.

Easy way around this would be:

  1. Use the Nordic UART Service (I guess there’s an implementation of this in) to write data over BLE in the same format as the data forwarder.
  2. Use any BLE client on the Pi to capture that data, wrap it up in the Data Acquisition Format and send it with the uploader.

However, I’m not sure how fast this will be.

1 Like

Thank you Jan!
If your code for Nordic is open sourced I can test/fork it for Arduino Nano 33 BLE which is nRF52840 .

Otherwise I’ll follow UART example https://www.instructables.com/Arduino-NANO-33-Made-Easy-BLE-Sense-and-IoT/ as per your first point
And than follow your second point.

I hope the speed of data transfer will be acceptable for the activity tracker use case.

Yeah the best way would be 1) send signal to device to collect data, 2) sample all data on device, and put together in a file, 3) offload file back over BLE to ingestion (this is what we’ll do with Nordic). But that requires a lot more engineering.

Thank you for the details of the design! Yes, it seems much more complicated. But it provides a better control on the sampling process and eliminates limits on transfer rate.

I’m not sure if it will be possible to get more than 115200 bps using UART service over BLE. I need to calculate if it will provide enough throughput for sampling for the activity tracker use case. It will take approximately 18 bytes (without bit-packing) to capture x, y, z. 115200/80=14400bytes, 14400/18=800 samples. So transfer rate of 800 samples per second should be OK.

If you get 115200 out of it, then that should be enough, it’s what we use for the data forwarder on desktop as well by default.

Thank you Jan! I’ll use the Data Forwarder.

I’m wondering if someone already implemented the Data Forwarder as Android app?

Another idea is to extend Edge Impulse WebAssembly to forward data from GATT Bluetooth Accelerometer service using WebBluetooth. ArduinoBLE support Arduino Nano 33 BLE/IOT. https://www.arduino.cc/en/Reference/ArduinoBLE . And it seems WebBluetooth has a lot of potentials https://www.smashingmagazine.com/2019/02/introduction-to-webbluetooth/ and it is supported on Chrome and Opera on Android phones. There are a lot of examples at https://github.com/WebBluetoothCG/demos . There is even an example for Nordic Thingy:52 https://github.com/NordicPlayground/webapp-nordic-thingy .

It can be useful to take samples of outdoor activities like running, cross-country skiing, cycling.

By the way, you can use your phone as a sensor in that case too. It translates surprisingly well to on-device inference.

1 Like

Yes, it translates really well. I’ve collected data samples using phone and then deployed it on MCU. It requires a small adjustments to take into account difference in the orientation of IMU sensor between phone and MCU,

1 Like