Fitness

by Nekhil_r in Circuits > Arduino

2123 Views, 88 Favorites, 0 Comments

Fitness

jonathan-borba-lrQPTQs7nQQ-unsplash.jpg
cover3.jpg

A wearable device that monitors and records a person's fitness activity by means of AI.

It’s no doubt that inactivity can lead to a number of health and personal issues. Constant activity can prevent many of these issues. We need to check the progress achieved by workout constantly to regulate the activities for making a healthier body. Fitness trackers are one popular way to keep track of your progress. It can count your activities such as push-up, pull-up, and sit-up, etc. This can also generate the calorie burned during the activities.

Here I am designing a wearable device using the SmartEdge Agile board that can count push-up, pull-up, and sit-up and can generate the calories consumed during the activities.

Anyone who doesn't have proper knowledge about this technology can also customize these devices for their particular exercises by following up the instructable. This wearable device is using the potential AI feature of the SmartEdge Agile for fitness tracking. The progress can be simply viewed through the mobile app.

I think it is an ultimate companion for the peoples who love fitness.

You can customize this wearable for the particular exercises that are you doing by training those activities.

Demo

Let's watch the demo video of Get-Fit wearable.

Things We Need

The hardware components required for the projects

The software components required for the projects

SmartEdge Agile Board

brainium 1.JPG
AGILE-modular-architecture.png

In this project we are using the SmartEdgeAgile device for detecting the movements. The SmartEdge Agile device is a certified hardware solution, embedded with a full software stack featuring Edge Intelligence.

This device has a wide variety of on-board sensors. In this project, we are utilizing its accelerometer and gyroscope sensors. By combining these sensor values with AI we can create an outbreak.
Unlike all the other functionalities, working with AI-based monitoring requires the use of the AI Studio tool, available on the portal. AI Studio offers an easy and intuitive way to create the models, which are needed for using AI.

One of its AI features is motion recognition. Actually this device transfers its data to the Brainium platform through the gateway. It communicates via Bluetooth with the gateway. The Brainium gateway can be downloaded from the ios or android store.

This device can be easily charged via the USB port and has a two-day running time.

Collecting Accessories

IMG_20200706_131846.jpg
white.jpg
IMG_20200709_115040.jpg
IMG_20200710_115912.jpg

As we all know the main constituent of this wearable is the SmartEdge Agile board. We need two white elastics for making the band. I have taken it from my old fabrics. Also, we need a strap for adjusting the band size. I just took it from an old laptop charger. For adjusting the strap we need a rectangle piece of plastic that is partially hollow. As a hack, I just cut it down from the upper side of a marker top.

Band Making

IMG_20200709_125700.jpg
IMG_20200709_153028.jpg
IMG_20200709_153041.jpg
IMG_20200710_115912 (1).jpg

First of all, we are enclosing the band with white elastic. We need to tighten as much as possible otherwise the Agile board will be swiped away. Then we can sew there, with the blue thread. Here I am using the blue thread which gives a fantastic outlook for the band. Then I sewed the rectangular piece for adjusting the band sizes as shown above. Then we attached the second elastic to the board by means of a hot glue gun. Finally, we sewed up the strap belt on the newly glued elastic. Just have a look at the picture given above for the reference.

Final Outlook

final.jpg
IMG_20200711_072622.jpg
final.jpg

Our wearable device is ready, just attach it to the arm. Then power on the device by a long press on the button. You can charge the device by the C-type mobile charger in your home. The device has an almost a one-day running time. Then we can go to the software section of this wearable.

Brainium Portal

brainum portal.jpg
uploads2ftmp2fa61b7f38-c3d8-4074-8027-48f8c714a4752fdevicetab_ydIp87npQE.jpg
uploads2ftmp2f0cb05c06-0c09-492c-aa58-701706f6b0042fapp_c4qAdGx46c.jpg
uploads2ftmp2f4d6baa93-bb0c-456c-91ae-143a1084145e2fproj_works_0bfgd9I3pR.jpg

Here comes the software part and it is pretty simple.

For using the SmartEdge Agile board you need to signup to the Brainium platform. Then, download the Brainium Gateway app on our phone(from play store) and use our newly created account to log into it. Actually the phone act as a gateway between the portal and the AI device over BLE. Then add our board from the devices tab in the portal. Then the device will appear on the Brainium app.

Click on “Create project” or “+” button at the bottom right of Project page to create a project.

AI Studio Workspace

uploads2ftmp2ff971cfb9-b331-48c6-a04d-db9ff07926262fworkspace_ZME5PVzidJ.jpg

Go to the left side menu and navigate to Motion in AI Studio tool by selecting ‘Motion Recognition’ item in the AI Studio Workspaces. AI Studio is the tool dedicated to Artificial Intelligence capabilities of the platform.

Open your workspace and start by defining the motion you want to train your Agile device with. You need to create at least one “motion” for a recognition model. Here my list of motions contains activities such as Pushup, Pullup, and Situp. These are the basic activities tracked by our device(Get-Fit). The Agile board's motion would be different for each activity, by applying the AI feature to it the device can count the activity.

Training

uploads2ftmp2fc89d8ba4-1f91-4b6d-ac61-4c245fc86d8f2fmotion_qA7lg3OOMD.jpg
training.jpg
uploads2ftmp2f6333ac93-3015-49ac-96d2-7a0087ec05b32frecordset_xP1LKMZvp1.jpg

We need to train these devices to make them capable of detecting exercises. You should wear the device when the training goes on.

In the list of motions, select each one we want to train, and click the “Record new training set". Create proper training sets for each motion.
You need at least 2 records of 20 motions each to be able to generate a model that can be used for the demo. Of course, the more motions you’re trying to detect, and/or the more the motion is complex, the more training sets you will need to get an acceptable accuracy level. The record set for the push up is given below, likewise, the training sets for all other activities are recorded properly.

You can customize this wearable for the particular exercises that are you doing by training that activity.

Generating Model

uploads2ftmp2f6d548bfc-9029-4873-9890-63e46908360d2fmodelgen_VZsghq6Lk1.jpg
uploads2ftmp2fcdad4a38-bff1-466e-b6e4-0c1b48c2b2852fappl_gjcIyt1G0e.jpg
uploads2ftmp2ff93faa0c-820c-44a7-8b96-58d421b5d9982fairule_fAJXnngslY.jpg

Then we want to generate a model containing all these records. Select all the records for the wearable and generate the model. It will take some time. Then apply your model to the desired device. We can also set AI alert to push notification when an activity is encountered.

MQTT

new-improved-pubnub-mqtt-support-and-iot-capabilities-pubnub-mqtt-png-1380_600.png

MQTT API provides access to the data which has been sent from user's devices in real time. MQTT API is available over WebSockets by the following URI: wss://ns01-wss.brainium.com and it's secured. The MQTT protocol provides username and password fields in the CONNECT message for authentication. The client has the option to send a username and a password when it connects to an MQTT broker. For connection to Branium Platform this options are must:

  • the username has the specified static value : oauth2-user
  • the password is different for each user and equals to external access token (it's available in the user's profile).
  • the user_id(can be found on users's profile)
  • device_id(can be found on devices tab in portal)

By running the python code I have attached in the GitHub repository can access the real-time data from the wearable(Get-Fit) using the MQTT protocol. The number of times an activity is completed will be drawn out.

Firebase

firebase-34159794e6d476755612ae07db4b4a07.jpg
uploads2ftmp2fa59b9ef8-1d4a-4a2c-8286-02d6126bf0412fscreenshot-23-08-20192c09_10_19pm_BAgt2v14XB.jpg
uploads2ftmp2f15ecf53d-be13-41b5-85ba-38c6f52050762frules_gIXlgYMaQI.jpg

Firebase is a mobile and web application development platform. Firebase frees developers to focus on crafting fantastic user experiences. You don’t need to manage servers. In our project, we use Firebase real-time database to instantly retrieve data so that there is no time delay.

.To find Firebase URL

  • Go to Firebase
  • Then go and open your project (If you have no projects create one)
  • Then move to Real-Time Database in Database
  • The URL in the screenshot is the Firebase URL

Then go to the rules, replace "false" by "true" to make read and write operations. I have taken the "status" tag as the parent tag of "push", "pull", and "sit".The value from the API is placed under these tag variable

Android Studio

Screen-Shot-2014-12-08-at-14.27.40.png

The application for the wearable is made in the Android studio.