Filter results by

Pump Up Your Mind With Mental Fitness, Simband and SAMI

Imagine building “mental muscles” like you build muscles on your body. We at GRIT Research Institute are happy to introduce our Android application Mental Fitness, which trains “mental muscles” to improve your motivation and performance.


How do we build “mental muscles”? Mental Fitness utilizes the Simband and SAMI platforms to measure variation in heartbeats, giving us new insight into the mind and emotional states. Simband first checks a person’s physiological data, which we call “bio-data”. Mental Fitness primarily uses the beats detected by Simband as bio-data.

Each user’s bio-data is periodically and continually uploaded to SAMI. Once Mental Fitness retrieves the normalized bio-data from SAMI, the application uses this data and our carefully designed “GRIT Test” to recommend and provide a mental training program tailored to that person. (Training data, such as results and schedules, are stored and managed on our application server.)

Mental Fitness personalized training

Retrieving the data

Mental Fitness makes both non-real-time and real-time retrievals of bio-data stored in SAMI. Our application can retrieve historical data for a specific period, analyze a person’s bio-signal, and record the result. This gives users insight on emotional states and mental levels for specific periods of activity:

Mental Fitness non-real-time bio-data

We also provide real-time feedback during training, retrieving data as it is available. For example, our meditation training program (below) helps improve users’ motivation and performance. When users do meditation with Mental Fitness, the application periodically retrieves real-time bio-data to give users feedback on how they are doing.

Mental Fitness real-time bio-data

Mental Fitness detects the unique heart-rate patterns of each user. This means it can identify the factors that make individuals stressed, help them with personalized mental training, and give ongoing feedback as they progress.

Mental Fitness heart-rate training

How the data flows

Our current data flow is as follows:

  1. Simband uploads user bio-data to SAMI using WiFi®.
  2. SAMI checks the integrity of the bio-data and stores it.
  3. Our application requests data via REST API.
  4. SAMI delivers the requested data to our application.

Mental Fitness data flow

We use the following SAMI REST APIs in our current implementation:

Get a user’s devices: This API is used to retrieve a user’s device list. Since users may have multiple Simbands, after SAMI authentication, Mental Fitness asks users to select the Simband they are wearing.

Get normalized messages: When our application wants to retrieve bio-data from SAMI, this API is relevant because it allows us to specify the duration (startDate and endDate), and also to filter messages (e.g., to only retrieve heart rates). We use this message API with the source device ID (sdid) retrieved from the above API.

Implementation details

Mental Fitness uses the SAMI Android SDK, which is available at this SAMI GitHub repository.

We registered the application using the SAMI Developer Portal and specified “Simband” as a supported device type with the necessary permissions. We also used the Device Simulator (below) to check our authentication flows on SAMI.

SAMI Device Simulator

The following sample code retrieves HeartBeat bio-data from SAMI. Note that mMessagesAPI is an instance variable from the io.samsungsami.api.MessagesApi class in the SAMI Android SDK; SDID is a variable that stores the user’s Simband device ID, and FIELD_HEART_BEAT denotes one of the unique Simband streams.

 1 /**
 2   * Retrieves heart beat data from SAMI using getNormalizedMessages API
 3   * @param startDate
 4   * @param endDate
 5   * @return
 6   * @throws ApiException
 7   */
 8   public NormalizedMessagesEnvelope getHeartBeats(long startDate, long endDate) throws ApiException {
10     return  mMessagesApi.getNormalizedMessages(
11       null, 
12       SDID, 
13       null, 
15       null, null, 
16       (int) ((endDate - startDate)/Config.SECOND_MILLIS * HR_Fs), // calculating the required data counts
17       startDate, endDate, 
18       null);
19   }

What is next?

For future work, we are considering using WebSockets instead of REST, which will ensure that Simband bio-data is delivered to Mental Fitness right after being uploaded to SAMI.

We are now optimizing our mental training programs to give relevant and accurate feedback. Thanks to SAMI’s excellent management of users, user devices and user privacy, we know many users will be inspired flex their mental muscles together with Mental Fitness, SAMI and Simband.

This is a guest post from GRIT Research Institute.

Get the ARTIK Newsletter

You like your news fresh! Sign up now and you will be the first to know about our latest software releases, coding tips, upcoming events, blog posts, datasheet updates, and more.

* By checking either box, you may receive notifications by phone, email, text, and/or other electronic means from Samsung Semiconductor, Inc. and its affiliates. If you choose to receive partner notifications, we may forward your contact information to our partners. You may unsubscribe from these services at any time by clicking on the unsubscribe link in our communications or by submitting a request here. Please see our Privacy Policy and Terms of Use for more information about how your data is stored and used.