Blog Feed Post

Building a hamster fitness tracker using Dynatrace API

Hamsters are nocturnal rodents and, therefore, are mostly active during the night. My boyfriend and I do have a hamster, and curiosity led us to start thinking about how we could track some of his activities, specifically how far he is able to run within a night. So we decided to turn the hamster wheel into a fitness tracker using the Dynatrace API. Basically, we wanted to capture all the rotations of it. And, there was not much additional “hardware” needed for this goal to be achieved.

We already had the hamster…

…and the hamster wheel.

Required hardware:

  • Hamster
  • Hamster wheel – with a large enough diameter eg “Silent Runner” ~30cm
  • Microcontroller with an integrated wifi chip (ESP8266) – eg a NodeMCU
  • Infrared obstacle avoidance sensor – eg KY-032
  • Small reflector stripe (eg aluminum foil)

Software setup:

  • MQTT broker – eg Mosquitto
  • Node-Red
  • Dynatrace SaaS

Modifying the hamster wheel

It was mandatory that we do not install any wires inside the terrarium. All wires had to be installed on the outside only, out of the hamster’s reach. We decided to use an infrared obstacle avoidance sensor — sensitive to light reflections — which could be placed on top of the terrarium. Next we applied an aluminum foil reflector stripe to the wheel.


Implementing the fitness tracker

The simplest way for us to process the sensor’s data was using a micro controller with an integrated wifi-chip. As a start we wanted to capture some metrics per rotation and some lap and night summary statistics like speed and distance. For all of these metrics we registered a custom time series identifier via the Dynatrace API and, additionally, the hamster wheel was registered as a custom device.

The microcontroller was programmed to calculate and send all the needed metrics to an MQTT broker used as a sort of relay station. MQTT is an extremely lightweight messaging protocol for devices with limited processing power and/or network bandwidth – thus, a perfect fit for us. As the Dynatrace API expects the metrics in JSON format we needed to add some conversion of the sensor’s raw data. This could easily be achieved by implementing a Node-RED flow.

Our flow subscribes to the MQTT broker filtering the incoming wheel’s sensor data. The data is then enriched with the current time stamp and converted to a JSON payload which is sent via HTTP to the Dynatrace REST API.

Fitness Results

I created a custom dashboard showing all the different hamster wheel’s metrics.

It turned out that our hamster is very busy every night. Usually he runs about 5 to 7 kilometers with an average speed of 3 kilometers per hour. So far his personal record was a total distance of roughly 8.5 kilometers per night which equal to approximately 8,900 rotations. He always runs several laps — mostly about 50 to 150 — whereby a lap’s distance adds up to 0.1 to 0.9 kilometers.

Here are the charts showing our hamster’s current “high scores”:

The night run’s total distance…

The total distance of a night’s run — constantly increasing to a total of ~8.5 km within a time of roughly 4 hours.

…and total number of rotations.

The total number of rotations for a night’s run — constantly increasing to a total of ~9,000 rotations within a time of roughly 4 hours

As well as the average distances per lap…

A night’s run always consists of several laps, whereby a single one usually adds up to 0.1 to 0.9 kilometers.

And, of course, speed!

Typically, the average speed is around 3 kilometers per hour — sometimes also a bit higher.


We learned that the reason our hamster sleeps so much during the day is because he is exhausted from his nighttime workouts! 8.5 kilometers — or a little more than 5 miles — is a significant run for a human! But for such a tiny creature which such short legs, 5 miles is a major accomplishment. We can’t wait to see if he takes a recovery day (or night) like most runners do! In the meantime his terrarium will continue to be located in another room far from the bedroom!

He also gets an incredible amount of mileage for the relatively small amount of fuel he consumes. He’s a very efficient little creature!

However, the primary reason I embarked on this project is to demonstrate, in a humorous way, the versatility of our APM solution for nearly any application you can imagine — large, small, or somewhere in between.

Also, I wanted to show you, the reader, a little bit of the Dynatrace culture and how our commitment to providing the best possible APM solution extends well beyond our workday. I hope you found this posting to be entertaining and informative.

The post Building a hamster fitness tracker using Dynatrace API appeared first on Dynatrace blog – monitoring redefined.

Read the original blog entry...

More Stories By Dynatrace Blog

Building a revolutionary approach to software performance monitoring takes an extraordinary team. With decades of combined experience and an impressive history of disruptive innovation, that’s exactly what we ruxit has.

Get to know ruxit, and get to know the future of data analytics.

Latest Stories
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
Mobile device usage has increased exponentially during the past several years, as consumers rely on handhelds for everything from news and weather to banking and purchases. What can we expect in the next few years? The way in which we interact with our devices will fundamentally change, as businesses leverage Artificial Intelligence. We already see this taking shape as businesses leverage AI for cost savings and customer responsiveness. This trend will continue, as AI is used for more sophistica...
Today most companies are adopting or evaluating container technology - Docker in particular - to speed up application deployment, drive down cost, ease management and make application delivery more flexible overall. As with most new architectures, this dream takes significant work to become a reality. Even when you do get your application componentized enough and packaged properly, there are still challenges for DevOps teams to making the shift to continuous delivery and achieving that reducti...
Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
What is the best strategy for selecting the right offshore company for your business? In his session at 21st Cloud Expo, Alan Winters, U.S. Head of Business Development at MobiDev, will discuss the things to look for - positive and negative - in evaluating your options. He will also discuss how to maximize productivity with your offshore developers. Before you start your search, clearly understand your business needs and how that impacts software choices.
Enterprises are moving to the cloud faster than most of us in security expected. CIOs are going from 0 to 100 in cloud adoption and leaving security teams in the dust. Once cloud is part of an enterprise stack, it’s unclear who has responsibility for the protection of applications, services, and data. When cloud breaches occur, whether active compromise or a publicly accessible database, the blame must fall on both service providers and users. In his session at 21st Cloud Expo, Ben Johnson, C...
Most of the time there is a lot of work involved to move to the cloud, and most of that isn't really related to AWS or Azure or Google Cloud. Before we talk about public cloud vendors and DevOps tools, there are usually several technical and non-technical challenges that are connected to it and that every company needs to solve to move to the cloud. In his session at 21st Cloud Expo, Stefano Bellasio, CEO and founder of Cloud Academy Inc., will discuss what the tools, disciplines, and cultural...
SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
With the rise of DevOps, containers are at the brink of becoming a pervasive technology in Enterprise IT to accelerate application delivery for the business. When it comes to adopting containers in the enterprise, security is the highest adoption barrier. Is your organization ready to address the security risks with containers for your DevOps environment? In his session at @DevOpsSummit at 21st Cloud Expo, Chris Van Tuin, Chief Technologist, NA West at Red Hat, will discuss: The top security r...
IBM helps FinTechs and financial services companies build and monetize cognitive-enabled financial services apps quickly and at scale. Hosted on IBM Bluemix, IBM’s platform builds in customer insights, regulatory compliance analytics and security to help reduce development time and testing. In his session at 21st Cloud Expo, Lennart Frantzell, a Developer Advocate with IBM, will discuss how these tools simplify the time-consuming tasks of selection, mapping and data integration, allowing devel...
SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...