Professional Documents
Culture Documents
Andrea Pignata
1
System Flow
2
Used boards
ST SensorTile.box ST BlueTile MetaMotionS
• MATLAB post-processing
5
Bluetooth Low Energy (BLE)
• Low-power, low-throughput
connection protocol
(2.4 GHz band) client server
6
BLE: GATT Database
• Data stored in arrays
• 8-bit unsigned int
• Variable size Char 00e0 Acc, Gyr, Mag
(IMU) 🔔
• Arrays are called characteristics Service 0001 Char 001c Temp, Hum,
and are identified by UUIDs (sensors) (ENV) 🔔 Press
Char 0004 Dominant
• Characteristics are grouped into
(AUD) 🔔 Frequency
services
Service 000f Char 0002 Timestamp
• Characteristics have properties (time_sync) (TS) ✏️🔔
defining what can be done on
its array (write, read, notify…)
7
BLE: Read
• Read operation is the simplest one.
8
BLE: Notify
• Notifications system removes the need
for continuous read requests.
client server
• The client sends a notification
subscription,
along with the characteristic UUID. Notification subscription
9
BLE: Write
• The client can send data to the server.
Interrupt execution
Write request
• The server will launch an interrupt
procedure to deal with the write
request.
10
How to deal with BLE
• nRF Connect • BluePy
• A nice GUI to show BLE devices, • Python library
connect to them, • Includes functions for
have access to read, write, • Connection
notifications… • Notification subscription
• Read/Write operations
• Bluetoothctl • Complete documentation on
• Command line tool for total https://ianharvey.github.io/bluepy-
Bluetooth control on Linux doc/
• Full support of GATT
characteristics in the GATT menu.
11
Outline
• Introduction
• MATLAB post-processing
12
Firmware description
• A main procedure composed of:
• Configuration block: configures the microcontroller and the sensors (only one time)
• Endless loop:
• Check the status of different flags (if the sensor data ready)
• If flag == 1, launch the procedure that updates the corresponding BLE characteristic.
• Interrupt Service Routines, that can modify the values of those flags:
• Timers: set up at specific values, to send IMU and ENV sensor data at specific rates:
• 75Hz for IMU
• 1Hz for ENV (…humidity and temperature won’t vary at high rates…)
• DMA: responsible of microphone data conversion.
• BLE data received: the client can send data for time synchronization purposes, and the
interrupt takes care of this situation.
13
SensorTile.box flowchart
14
BlueTile flowchart
15
Time Synchronization
Time synchronization
• Re-synchronization moments
• Packets exchange between client and
node
• Alignment of timestamps
Example: BLE configuration
18
Example: Interrupt
- This is the Interrupt Procedure for Write Requests on the Time Synchronization char.
- The current timestamp of the sensor board is split in 8 bit array.
- The number received from the client is incremented by 1
- Timestamp and incremented value are sent back with the aci_gatt function.
- Use the IDE tools (i.e. Search) to find this procedure quickly and easily, as it is hidden!
- TIP: you can find the configuration for the Timers Interrupt in the InitTimers() function.
19
Outline
• Introduction
• MATLAB post-processing
20
BlueVoice flowchart
21
Firmware description
• A main procedure composed of:
• Configuration block: configures the microcontroller and the sensors (only one time)
In this firmware, also the BlueVoice is initialized here.
• Endless loop:
• Make the BlueVoice FSM proceed.
• BlueVoice Interrupt Routines, that make the audio stream work correctly.
• MATLAB post-processing
23
Clients description
• A client for ST devices based on BluePy library and composed of:
• Configuration block: connects and subscribes to notifications
• Endless loop: waits for notifications.
• 1s timer: regularly sends time synchronization write requests
• Delegate objects: receive notifications and write data to file
• CtrlC signal: stops data acquisition as the user presses Ctrl+C
• MATLAB post-processing
25
Import scripts description
Available scripts:
• data_extract_st.m and data_extract_meta.m
• import data from csv files (generated respectively by ST client or META client)
• for gyro/acc/mag only!
• plot them independently
• transform them into timeseries structure (assign precise timestamp to each sample)
• reorganize timeseries (delete repeated entries, order them in time)
• Tip: data can now be seen in the Signal Analyzer Tool from the Digital Signal Processing
Toolbox.
26
Import scripts description
Available scripts:
• data_extract_frequency.m
• Generates timeseries variables starting from frequency csv files
• data_extract_voice.m
• Generates timeseries variables starting from BlueVoice files
• Works with the modified firmware only: it relies on the customized timesync mechanism
27
Calibration scripts description
28
Calibration script description
29
Calibration script description
Starting point of the script: untitled.m