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, sit-up, etc. This can also generate the calorie burned during the activities.
Here we are designing a wearable device using the SmartEdge Agile board that can count push-ups, pull-ups, and sit-ups 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.
Hardware SetupThe hardware setup is pretty simple. The main constituent of this wearable is the 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 on our phone(from the 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 the “Create project” or “+” button at the bottom right of the Project page to create a project.
Go to the left side menu and navigate to the Motion in AI Studio tool by selecting the ‘Motion Recognition’ item in the AI Studio Workspaces. AI Studio is the tool dedicated to the 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 each activity, by applying the AI feature to it the device can count the activity.
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.
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 alerts to push notifications 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 users' 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 these options are a 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 the user's profile)
- device_id(can be found on devices tab in the 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.
It is successfully counting the activity, which is shown below.
Then these values are pushed to the Google FireBase.
- Firebase-Google
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" with "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 variables. If you want to know more about setting up Firebase read the detailed guide here.
These values are accessed by the mobile application made in kodular.io
- Kodular
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 repository.
screen2-code
The final look of the application.
- Working
When performing certain exercises,
Have a look at the video to see the live counting of the activity.
Comments