Introduction: ECG Using Intel Edison and Plotly

About: Researcher. Learner. Technologist. Plays with IoT. 1 Patent. Electronics Hacker. M.S (Intelligent Systems and Robotics), University of Essex UK. https://in.linkedin.com/in/shreyasupasane

Electrocardiography is used to help diagnose various heart conditions. Heart rate monitor measures the electrical activity of the heart. This electrical activity can be charted as an ECG or Electrocardiogram.

NOTE: This device is not intended to diagnose or treat any conditions.

With the use of Intel Edison as our IoT device, we will connect a heart rate monitor sensor on Arduino shield of Edison and will measure the electrical activity of the heart in real time! We will then use Plotly (https://plot.ly) to chart our ECG on graphs.

This autonomous combination of hardware, software and networking is now being referred to as IoT (Inter-Operability of Things).

This article assumes you have experience uploading code using Arduino IDE and login to the Edison board using putty.

Step 1: Hardware Components We Will Use in Our Demo

  • Intel Edison
  • AD8232 Heart Rate Monitor (Link)
  • ECG Electrodes
  • USB cables
  • Jumper wires

Step 2: Software We Will Write

  • A sketch program running on Edison Arduino shield

You can download the code samples here.

Step 3: Build the System

Connect the AD8232 Sensor to Edison as shown above.

Board Label Pin Function Arduino Connection

GND Ground GND

3.3v 3.3v Power Supply 3.3v

OUTPUT Output Signal A0

LO- Leads-off Detect - 11

LO+ Leads-off Detect + 10

SDN Shutdown Not used

Connect the ECG Pads to the audio jack of AD8232 Sensor and attach the pads on body as shown.

Step 4: Connect the Intel® Edison Board to Your Computer for Development

Follow this guide to install Arduino IDE for Edison.

https://software.intel.com/en-us/get-started-arduino-install

1. Connect the micro usb cable to edison OTG connector.

2. Connect the micro usb cable to edison serial port connector.

3. SW1 position towards micro usb connector.

Step 5: Upload the Sketch on Arduino Edison and Using Plotly

After installing Arduino for Edison and making proper connections with the computer, upload the sketch provided.

1. Sign up to plotly: https://plot.ly.

2. Load up the plotlytry.ino file in Arduino IDE. Fill in your plotly username, API key, stream tokens, and filename. You can find your API key and stream tokens here: https://plot.ly/settings. It'll look something like:

char *tokens[] = {"ab4kf5nfdn","kdf5bn4dbn"};

plotly graph("anna.lyst","ab4kftunvd", tokens, "arduino graph");

3. Upload the program.

4. Open up your Serial Monitor. You'll see an output like:

... Attempting to connect to WPA network...

... Connected to network

... Attempting to connect to plotly's REST servers

... Connected to plotly's REST servers

... Sending HTTP Post to plotly

... Sent message, plotly's response:

... A-ok from plotly, All Streams Go!

... View your streaming plot here: https://plot.ly/~streaming-demos/6

... Connecting to plotly's streaming servers...

... Connected to plotly's streaming servers

... Initializing stream

... Done initializing, ready to stream!

5. Grab the URL that was printed out, view your graph in your browser, and celebrate! The graph and data is saved in your plotly account, so you can view it in your plotly file list here: https://plot.ly/plot. You can view, edit, and share your graphs while data is streaming to them in real-time. Everybody that views the graph will see the exact same data at the same time (try it out yourself: open your graph in two different browser windows).

Step 6: Summary

You can then embed your application directly within an end product and create an E-health device. The real-world application of these principles is just as easy as what you saw. The task complexity is limited only by how much arduino code you are willing to write. Edison seamlessly manage all of the processing handling intricacy in the middle.