Edge Impulse logo
Blog Post

Activity Trackers Unleashed: A tinyML Wearable Device for Pets

Embedded Devices, TinyML, Machine LearningMithun Das built an ML-powered tracker to monitor his dog's activities throughout the day using a Seeed Studio XIAO BLE nRF52840 Sense and Edge Impulse.

Nick Bild

March 30, 2022

    Fitness trackers are hugely popular devices, with the global market size reaching over 36 billion USD as of 2020. This should come as no surprise, because fitness trackers can help us to be more conscious of our daily choices that can lead to better health. This is fantastic news for us humans, but what about our four-footed friends? A fitness tracker for dogs may sound like a humorous idea at first blush, but the fact of the matter is that 50.2 million dogs in the US are overweight. This leads to health problems and a reduced quality of life for our beloved companions, and as if that were not enough, it may also cause behavioral problems, like tearing up your couch cushions. Making sure Rover gets in enough activity is sounding like a better and better idea all the time, right?

    Activity tracker and companion app

    The one and only Mithun Das is a big fan of fitness trackers but was disappointed to find that no dog activity monitors on the market checked all of the boxes for what he wanted in a device. He wanted a low-cost tracker that could tell him what specific activities his dog engaged in during the day, with a nice, clean user interface where he could view reports on the aggregated data. So, naturally (for Das), he decided to build his own. The prototype he came up with uses a widely available development board and the Edge Impulse platform.

    Built for AI applications, the Seeed XIAO BLE nRF52840 Sense, with a powerful Nordic nRF52840 CPU operating at 64 MHz and Bluetooth connectivity was selected. The board comes standard with a six-axis inertial measurement unit (IMU), which is perfect for sensing motion. The XIAO is powered by a tiny 400 mAh rechargeable LiPo battery, and fitted into a custom 3D-printed case, which is attached to a standard dog collar.

    A Seeed XIAO BLE nRF52840 Sense at its core

    To prove the concept, Das initially set out to detect when his dog was resting, walking, running, or climbing up stairs. Planning to design a machine learning classifier to handle this task, Das first needed to collect a dataset to train that model. He attached the activity tracker to his dog, and flashed it with custom firmware that was designed to collect IMU data and transfer it directly to Edge Impulse where it can be further analyzed. Data was collected as the dog performed the aforementioned activities of interest, after which the samples were labeled with the data acquisition tool.

    Machine learning classification pipeline 

    An impulse was created in which the IMU data first undergoes a spectral analysis to extract the most pertinent features, and reduce downstream computational complexity. A neural network classifier was then designed and tuned for the task, before being trained on the previously acquired IMU data. Validation of the model showed that classification accuracy had reached over 90%, which is quite good considering that less than six minutes of IMU data was used to train the model. This accuracy would be expected to increase with a larger set of training data. Das notes that in the future he would like to collect data from more dogs, including a variety of breeds, which would help the model to better generalize to a wide range of scenarios and different types of dogs.

    Achieved 90% accuracy during testing 

    The predictions generated by the classifier are sent to a companion iOS app once per minute. Here, the data is aggregated and presented as a series of graphs and charts that give insight into a dog’s typical activity habits over time. These insights give you the information you need to turn your lazy dog into a fit pooch.

    Have you got an idea for a device, but nothing quite like it exists commercially? Quit chasing your tail trying to get it to work, and check out Das’ project write-up for the tips you need to get up and running quickly.


    Want to see Edge Impulse in action? Schedule a demo today. 

    Subscribe

    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter