/Heartonograph

Your heart on a graph. Arduino-powered pintograph that traces out Lissajous curves depending on the user's heart rate.

Primary LanguageObjective-C

Heartonograph

A project by Sam Bishamber, Manuel Castro, Lucia Liu, Ben Reynolds, and Justin Xiao.

How to Use

Step 1 - Microsoft Band

Wear a Microsoft Band, download the Microsoft Health app on your iPhone, and bluetooth pair the band with your phone.

Step 2 - iOS App

Open the Band Samples workspace in the iOS App directory, and build the BandHeartRate target on your phone. Determine the IP address of your desktop computer (e.g. 18.189.11.222, can be located in the Network page in Mac OSX System Preferences), and enter that value into the text field within the app.

Tap Start Heart Rate Sensor to begin collecting data and broadcasting it to the Host IP on port 3001. Broadcasts are made with an http protocol called Open Sound Control (OSC), using MetatoneOSC (https://github.com/cpmpercussion/MetatoneOSC)

The phone and app should remain open to ensure the values continue to be sent.

Step 3 - Mac OSX App

Run the Heartonograph Desktop Receiver Mac App in the Mac OSX App directory. The Path to heart rate data field may be changed if you want to save the data received from the iPhone in a different location.

Your computer is now listening for heart rate data from the phone via OSC, and is writing the data in the designated .txt file. The file stores a single value which is overwritten each time a new value arrives (in the future it may store many values which can be post-processed for different effects).

Step 4 - Arduino

Open the Heartonograph.ino file with the Arduino editor. Plug in the Arduino for the Heartonograph via USB, and select its serial port in the Tools -> Port menu. The Arduino program reads in data from a serial connection when available (see next section), and uses those values to drive the stepper motors.

Upload the program to your Arduino.

Step 5 - Processing

Open the harmonograph_singlevalue file in the Processing directory. This is a Java file written within the Processing environment. Update the filepath variable's value to match the .txt file designated in the Heartonograph Desktop Receiver app.

Change the portAddress variable's value to match the port you selected in the Tools -> Port menu for the Arduino.

When you are ready, press Run to execute the Processing program. This will read the heart rate data collected by the Mac app and relay it to the Arduino via its serial port. The Arduino reads in this data sets the frequencies of each stepper motor independently to be separate functions of the incoming heart rate. The ratio of the frequencies causes the Heartonograph arm to move in different Lissajous curves, which are traced out by the attached marker.