It’s no doubt that inactivity can lead to a number of health and person issues. The 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 the 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. 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.
The hardware setup is pretty simple. Main constituent of this wearable is SmartEdge Agile board. SmartEdge Agile is a certified hardware solution with a full software stack that helps you avoid the complexities of deep learning tools and development processes.
The board is attached to the spectacle by the wiring tie. The whole system constitutes the fitness tracker called as Get-Fit. How actually Get-fit looks like is
Here comes the software part...
- Brainium Portal
For using the SmartEdge Agile board you need to signup to the Brainium platform.
Next,download the Brainium Gateway app in our phone(from playstore) and use our newly created account to log into it. Actually the phone act as 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.
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. It can be a gesture control or a motion (door opening, fall detection, etc.). You need to create at least one “motion” for a recognition model Here my list of motions contains the 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 the each activities,by applying the AI feature to it the device can count the activity.
In the list of motions, select the each one we want to train, and click the “Record new training set". Create a proper training sets for the each motions.
You need at least 2 records of 20 motions each to be able to generate a model that can be used for 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.
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.
Here is the alert when the push up is done.
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 a activity is completed will be drawn out.
It is successfully counting the activity,is shown below.
Then this values are pushed to the Google Fire Base.
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 "status" tag as the parent tag of "push","pull", and "sit".The value from the API is placed under these tag variable.If you want to know more about setting up Firebase read the detailed guide here.
This values are accessed by the mobile application made in kodular.io
Kodular allows anyone to make perfect Android apps easily without writing any line of code. Kodular allows you to focus on the ideas, and not the code. A mobile application is made by the Kodular which shows the fitness progress in real time.The screenshots of the design and code blocks are attached. Design the application as shown and code block to give it life. If you want to modify the app download the .aia file from the github repositry.
The final look of the application.
When performing certain workouts..
Have a look on the video to see the live counting of the activity.