Show your heartrate in Keynote

My colleague Jan Wessel Hovingh had an interesting question: How would it feel for a presenter and what would it do to the audience to show the heartrate of the presenter while presenting?

I decided to make a proof of concept to make it possible for him to research this question. In this blogpost I will explain how to get the heartrate of an Apple Watch and how to show it on a Keynote presentation. Beware: It is a hacky solution!

Demo:

1. Get the heartrate

To get the heartrate I decided to use Apple Shortcuts App. Apple Shortcuts allows you to look up the most recent Heartrate recorded in Healthkit. The heartrate is stored in a variable, and used as parameter to a websservice. Because the Apple watch syncs the heartrate to Healtkit every several seconds its not completely “live”. But it improves when the workout mode is active on the Apple Watch.

shortcut

2. Receive the heartrate

On a heroku server I deployed a simple Ruby Sinatra script. It exposes a url that can receive one parameter: the heartrate. The heartrate is than send to a “pusher” channel. Pusher creates channels that can be listened to from loads of techniques.

3. Listen to pusher from JavaScript

To display the heartrate on a simple webpage, I made a simple piece of JavaScript that listens to the pusher channel. And displays the value.

Gist for step 2 and 3

4. Attach it to Keynote

To attach the heartrate to keynote I had the following problem: how to add the data to a fullscreen presentation? I could not come up with a simple approach for this problem, until I thought it would be possible in the web version of Keynote. So I made a script that can be injected in the iCloud version of Keynote. When it is fullscreen you add the script via the JavaScript console. It adds an ugly div that shows your heartrate!

Gist for step 4

Disclaimer

The programs I usually create are written with maintenance in my mind. I strive to make my code clear, simple and structured. For this hack project I gave myself permission to break all the rules, to not follow any code conventions, to not work like a professional. Nice and fun!