IBM Bluemix and IoT: Real-Time Heart Rate and Geolocation

MIO Alpha I Strapless Continuous Heart Rate Monitor

Some of my peers in IBM’s Emerging Technology group have been creating some really cool Internet of Things (IoT) demos using IBM Bluemix. Two of them, HR Tracker and Race Tracker, are geared toward fitness and activity tracking. They are both capable of displaying the heart rate and geolocation of exercisers as the values change in real-time. In this post, I’ll describe both sample apps and give an overview of the technology used to build them.

HR Tracker

Last month, I got to be part of an HR Tracker demo at That Conference 2014. For my part, it was a pretty simple process. First, I installed the demo app on my iPhone. Then, I strapped on a brand new, wrist-worn MIO Alpha I Strapless Continuous Heart Rate Monitor, turned it on, and paired it with the phone via Bluetooth. Finally, I hit the Start button in the app. And, before I knew it, a new icon popped up in colleague Mark VanderWiele’s browser showing my heart rate and position. Pretty cool!

HR Tracker Screenshot

And, even cooler, as my heart rate changed on the MIO Alpha, I could see it update almost immediately in the web app.

HR Tracker Screenshot

At this point, I went out for a short walk. While I was gone, Mark could see exactly where I was and how “hard” I was working (via heart rate) in the parking lot and side streets around the Kalahari Resort.

Race Tracker

Race Tracker is similar to HR Tracker, but is geared more toward monitoring data for lots of participants in an event. This morning Bryan Boyd took part in the Medtronic Twin Cities Marathon up here in Minnesota. Of course, running a marathon is way on the other side of the intensity spectrum from my little walk. :)

Via the Race Tracker app (written mostly by Bryan), I was able to “watch” his progress during the race. The animated GIF below (sped up to reduce size) shows Bryan’s data updating at he crossed the 20-mile point (on the St. Paul side of the Mississippi River):

Race Tracker w/ Bryan Boyd in Marathon

I then switched to the satellite view and caught him still going strong at Mile 21:

Race Tracker w/ Bryan Boyd in Marathon (Satellite)

Race Tracker can also send notifications at pre-determined intervals. For example, the tweet below came through the feed as Bryan reached 24 miles:

So, did Bryan finish? I wish I knew! Around Mile 25, data updates stopped being shown in the web UI. I’m assuming his heart kept beating. So, did the battery on his phone or heart rate monitor run out? Once I find out, I’ll try to post an update. :)

Update: I heard from Bryan, and his heart is indeed still beating. He blamed the glitch on “developer error.” But, as a fellow developer, I know those things happen with prototypes. :) Oh, and by the way, Bryan also finished the race in a very respectable 3:57.

Technology

On the day I tried HR Tracker, Mark conducted a session called From Concept to Operation in 30 minutes Using Services and a PaaS. During his talk, he went through the steps needed to build a Bluemix-based backend for these apps. It was a great demonstration of how quickly the “next big idea” can be prototyped and delivered to run on Bluemix.

Architecturally, MQTT ties all of the components together. Every piece either publishes or subscribes to an MQTT Broker (in this case powered by IBM MessageSight). So, for example, when the iPhone app detects a change in heart rate or GPS position, it publishes a message with that information to the MQTT Broker. The MQTT Broker in turn sends the messages to all subscribers.

As you might have guessed, the Bluemix-based backend is a subscriber. Mark started by creating a new app in the Bluemix UI from the Internet of Things Starter boilerplate. The resulting app runs a Node-RED server and is automatically bound to a new instance of the Cloudant NoSQL DB service. With NODE-Red, you can graphically create a flow that subscribes to an MQTT Broker and takes appropriate action. In this case, it acts by writing the information to the Cloudant DB and by sending a tweet if the runner has crossed a mile marker. So, in just a few minutes you can have a Bluemix app processing IoT data from a large number of devices and putting that data right into a database for later retrieval and analysis.

And, in case you’re wondering, the map UI also subscribes to the messages and updates the display as new information arrives.

What’s Next?

Since data is stored as it comes in, all sorts of additional features are possible. The Emerging Tech team already has code in HR Tracker to allow people to “replay” past activities or to compete against themselves (or others) on previous routes.

They’ve also begun exploring interesting things that could be done by applying analytics to all of this data. For example, did someone cheat? Does data indicate someone was grabbing the side of a car for half of their so-called bike ride?

With that, I’ll close with a question to anyone who has made it this far in the post. And, I’d love to see some responses in the comments section. :)

Question: If you had access to all of the data generated by this IoT scenario, what would you be interested to find out?

Bluemix UI Architecture Presented at Cloud Foundry Summit 2017

In June, I had the honor of attending the Cloud Foundry Summit Silicon Valley 2017 conference. My two submissions related to Bluemix UI architecture were selected, and I got the chance to present them. One talk centered around migration of the Bluemix UI from a monolith to a microservices architecture, and the other talk focused on best practices around monitoring microservice systems. In this post, I'll briefly describe my talks as well as share some general takeaways from the conference. Continue reading

The New Bluemix Look

Published on March 01, 2016