Skip to content

Add Shimmer3 board support - #832

Open
VigneshRajan-AMRC wants to merge 7 commits into
brainflow-dev:masterfrom
VigneshRajan-AMRC:shimmer3
Open

Add Shimmer3 board support#832
VigneshRajan-AMRC wants to merge 7 commits into
brainflow-dev:masterfrom
VigneshRajan-AMRC:shimmer3

Conversation

@VigneshRajan-AMRC

@VigneshRajan-AMRC VigneshRajan-AMRC commented Apr 29, 2026

Copy link
Copy Markdown
Updated PR message to reflect the new commits

Add native C++ driver for Shimmer3 (Bluetooth SPP)

  • New board: BoardIds.SHIMMER3_BOARD (id 68)
  • Channels: 3-axis low-noise accelerometer, gyroscope, magnetometer, GSR, ExG, battery, and temperature
  • Data: raw ADC values streamed with host-side timestamps
  • Runtime config via config_board(): sampling_rate: and sensors:
  • Scope: Shimmer3 (hardware version 3) only; prepare_session() rejects Shimmer3R (hardware version 10)

Tested on Windows with a Shimmer3 over Bluetooth SPP via the Python binding

@Andrey1994

Copy link
Copy Markdown
Member

Hi, it looks good at the first sight. I will check more details in the next couple of days.

One concern I have - gpl license for these files, I am not 100% sure it doesnt conflict with MIT license in brainflow.

Also, I can update docs, website, etc, do you have images you want to use or any wishes what to highlight there?

@VigneshRajan-AMRC

VigneshRajan-AMRC commented Apr 30, 2026

Copy link
Copy Markdown
Author

Hi @Andrey1994 , thanks for looking into my PR.

I just looked into the GPL3 license terms and you were right to be concerned, it can't be merged into any other license. I assumed GPL3 was compatible with any open-source license, but I was wrong.

Anyways, I will spend the next few days reworking the Shimmer3 Cpp API from scratch using one of the ShimmerResearch published API repos. They all have 3-Clause BSD licenses and they can be merged into an MIT project as long as their llcense terms and owner are mentioned in the code header and probably in the readme too. So, that wouldn't affect the Brainflow MIT license.

Until then, could you please keep the 68 board ID blocked for the Shimmer3? You could possibly accept the changes to the boardids and boardshims in all the lang-packs, as they aren't affected by any licensing mismatch.

And thanks for offering to update the docs and website. I mainly created and tested this for the Shimmer3 GSR+ device but the API should be compatible with other Shimmer3/3R units as well. Here's the user-guide for the Shimmer3 GSR+ with relevant information for the docs. The pictures of the device are better from this site.

@VigneshRajan-AMRC
VigneshRajan-AMRC marked this pull request as draft April 30, 2026 09:04
@Andrey1994

Copy link
Copy Markdown
Member

hi! do you need any help with that?

@Andrey1994

Andrey1994 commented May 17, 2026

Copy link
Copy Markdown
Member

any updates?

@VigneshRajan-AMRC
VigneshRajan-AMRC marked this pull request as ready for review May 18, 2026 09:33
@VigneshRajan-AMRC
VigneshRajan-AMRC marked this pull request as draft May 18, 2026 09:33
@VigneshRajan-AMRC

Copy link
Copy Markdown
Author

Hi @Andrey1994, thanks for offering to help. I couldn't focus on this work past few days but have started working on this again and aiming to finish up sometime this week.

Shimmer3 Bluetooth SPP driver for BrainFlow, ported from the semoo-lab/pyshimmer Python library (GNU General Public License v3.0).

Includes protocol constants, channel definitions, calibration parsing, and the full Board interface implementation (prepare/start/stop/release/config).
Register Shimmer3 as a new board: board description JSON, board ID constant, CMakeLists integration and other necessary changes.
@VigneshRajan-AMRC VigneshRajan-AMRC changed the title Add Shimmer3 board support (board id 68) Add Shimmer3 board support May 29, 2026
@VigneshRajan-AMRC
VigneshRajan-AMRC marked this pull request as ready for review May 29, 2026 13:06
@VigneshRajan-AMRC

VigneshRajan-AMRC commented May 29, 2026

Copy link
Copy Markdown
Author

Hi @Andrey1994 , I have now reworked the Shimmer3 C++ API files from scratch. I have also made some refinements along the way. I updated the original PR message to reflect the current PR.

The latest changes adds support only for the Shimmer 3 variant and not the 3R. That board is a newer revision and requires separate API. I have updated the previous comment where I mentioned otherwise, just for clarity. I am considering adding support to the 3R later, once I have the board.

The images and information required for updating the docs are still valid from my previous comment.

Here's the user-guide for the Shimmer3 GSR+ with relevant information for the docs. The pictures of the device are better from this site.

@Andrey1994 Andrey1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrote some comments but overall looks good

Comment thread src/board_controller/shimmer/shimmer3.cpp Outdated
Comment thread src/board_controller/shimmer/shimmer3.cpp Outdated
Comment thread src/utils/inc/brainflow_constants.h Outdated
Comment thread src/board_controller/shimmer/shimmer3.cpp Outdated
Comment thread src/board_controller/shimmer/inc/shimmer3.h

@Andrey1994 Andrey1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more comments

Comment thread src/board_controller/shimmer/shimmer3.cpp
Comment thread src/board_controller/shimmer/shimmer3.cpp Outdated
Comment thread src/board_controller/shimmer/shimmer3.cpp Outdated
@VigneshRajan-AMRC

Copy link
Copy Markdown
Author

Hi @Andrey1994, I just saw the changes you've requested as I've been busy and away last month. I will look into these in the next couple of weeks.

Make Shimmer3 runtime configuration exception-safe and validate sampling-rate and sensor-mask inputs before sending commands to the device. Check serial port configuration errors and expose the active device rate through get_board_sampling_rate().

Parse the complete inquiry response and consume every sample contained in a buffered Bluetooth packet. Route IMU axes by explicit signal ID, reject conflicting physical IMU sources, and fail safely on unsupported inquiry channels to preserve packet framing.

Convert GSR ADC samples to conductance in microSiemens using the configured fixed range or the per-sample range bits in automatic mode. Add cancellable streaming reads, atomic thread control, and first-packet synchronization for reliable startup and shutdown.

Correct Shimmer3 sensor masks, inquiry channel identifiers, wire formats, sampling-divider validation, and packet decoding helpers.
@VigneshRajan-AMRC

Copy link
Copy Markdown
Author

This update addresses the Shimmer3 review feedback and improves runtime configuration and Bluetooth packet handling.

Changes include:

  • Catch and translate invalid 'config_board()' inputs.
  • Validate sampling-rate dividers and 24-bit sensor masks.
  • Check serial-port configuration failures.
  • Report the active device sampling rate through 'get_board_sampling_rate()'.
  • Parse the inquiry buffer-size field and decode every buffered sample.
  • Convert GSR ADC values to conductance in microsiemens (μS) for fixed and automatic ranges.
  • Route accelerometer, gyroscope, and magnetometer axes by explicit signal ID.
  • Reject configurations whose physical IMU sources would overwrite the same BrainFlow rows.
  • Reject unsupported inquiry fields instead of risking packet de-synchronisation.
  • Add cancellable serial reads and atomic stream-thread control.
  • Synchronise 'start_stream()' with receipt of the first valid sample.
  • Correct Shimmer3 sensor masks, signal IDs, and packet field formats.

The buffering implementation follows the Shimmer BtStream inquiry and data packet format, where the inquiry buffer-size value determines how many samples are combined into one Bluetooth packet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants