Introduction: Wireless Heartbeat Monitor, Part I

I'd like to walk you through the process of building a low-cost heartbeat monitor that wirelessly transfers data to an online server... in real time! Part I covers building the device, Part II the cloud server and heartbeat transmission.

This project was inspired by the work of Teoma Naccarato (choreographer, London), John MacCallum (music researcher, CNMT, Berkeley) and Laura Boudou (dancer, Paris). I had the great pleasure of working with them during The Scientific Delirium Madness artist residency in July, 2016. Their work uses ECG for performance with dancers and musicians, and John and Teoma have been generous enough to share with me much of the material presented here.

On to Step 1!

Step 1: Buy About $80 Worth of Stuff

First you need to get your hands on supplies. If you don't have the items below already, they're available from SparkFun.com:

SparkFun Single Lead Heart Rate Monitor - AD8232

Biomedical Sensor Pad (10 pack)

Sensor Cable - Electrode Pads (3 connector)

Breadboard - Self-Adhesive

Break Away Headers - Straight

Jumper Wire Kit

SparkFun FTDI Basic Breakout - 3.3V

SparkFun USB Mini-B Cable - 6 Foot

LED

You'll also need a NodeMCU ESP8266. This is an amazing little IOT prototyping device, essentially an Arduino with built-in WiFi. You can grab one on Amazon.

Last but not least, make sure you have a soldering iron!

Step 2: Connecting the Pins

Affix the AD8232, NodeMCU, and LED to your breadboard. You'll need to run connections between the following:

AD8232's output to NodeMCU's A0

AD8232's 3.3V to NodeMCU's 3.3

VAD8232's GND to NodeMCU's GND

NodeMCU's D2 to a LED. Note: D2 is actually pin 4 in the code.

Last, you'll plug the NodeMCU's USB into a power supply such as a USB battery or a 9 volt.

Step 3: Set Up the NodeMCU

This project uses the Arduino IDE with NodeMCU. Download the source code at: https://github.com/kinetecharts/heartNode

Now...

1. Install the serial driver for your system: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx

2. Add esp8266 to Arduino IDE

2.1 Open Arduino IDE

2.2 From menu: File=>Preference=>Additional Boards Manager URLs, add

http://arduino.esp8266.com/stable/package_esp8266c...

2.3 tools=>Board:xxx => Board Manager find esp8266 by ESP8266 Community version 2.3.0 and install it

2.4 tools=>Board:xxx => select NodeMCU 1.0 (ESP-12E module)

3. Plug in the board. Run "ls /dev/cu*" in a terminal, you should see:

/dev/cu.SLAB.USBtoUART

We found that it is somewhat difficult to find USB cable that works—if you run into trouble here, try cables from different manufacturers.

4. From Arduino IDE, menu tool=>Port, select /dev/cu.SLAB.USBtoUART

5. Open qrs_detector_udp, update: ID, ssid, password.

The code is currently setup to talk to node.js server on 192.168.0.100 on port 12351, while listening on port 12345. Should you use multiple set on multiple poeple, each should have a unique ID.

We use a dedicated TP-LINK N300 Wi-Fi Router for this project. The computer running nodejs code has a fixed ip, 192.168.0.100. This can be optimized so that the server broadcasts its IP.

NodeMCU picks up server's IP, and sends data over.

Step 4: Next Up: Part II

In Part II, we'll explore the cloud server and heartbeat transmission. Stay tuned!