Introduction: Portable ECG Machine

Picture of Portable ECG Machine

An electrocardiogram (ECG) is a test which measures the electrical activity of your heart to show whether or not it is working normally. An ECG can reveal a wealth of information about cardiac regulation, as well insights into pathological conditions. An electrocardiogram can be a useful way to find out whether your high blood pressure has caused any damage to your heart or blood vessels.

If you have any heart disease such as high blood pressure, or symptoms such as palpitations or chest pain you may require a routine ECGs.

Demo Video:

In this instructables I will show you how you can make your own 3 lead ECG machine very easily (no complex circuit!!!).

I tried to keep it very simple so that you can easily reproduce it. No complex circuit, no complex soldering!.

Step 1: Bill of Materials

Picture of Bill of Materials

1. Banana Pi BPI-M1 (shop)

Banana Pi is an open-source single-board computer that is affordable and powerful. It features high performance AllWinner dual-core SoC at 1GHz, 1GB of DDR3 SDRAM, Gigabit Ethernet, SATA, USB, and HDMI connections. It can run on a variety of operating systems including Android, Lubuntu, Ubuntu, Debian, and Raspbian.

2. 5" HDMI Display (waveshare.com)

This is 5 inch Resistive Touch Screen LCD, HDMI interface, supports various systems like Raspberry Pi, Banana Pi / Banana Pro and BB Black.

3. AD8232 Single Lead Heart Rate Monitor (sparkfun.com)

The AD8232 SparkFun Single Lead Heart Rate Monitor is a cost-effective board used to measure the electrical activity of the heart. This electrical activity can be charted as an ECG or Electrocardiogram and output as an analog reading. ECGs can be extremely noisy, the AD8232 Single Lead Heart Rate Monitor acts as an op amp to help obtain a clear signal from the PR and QT Intervals easily.

4. Sensor Cable - Electrode Pads (3 connector) (sparkfun.com)

This is your simple three conductor sensor cable with electrode pad leads. These cables are 24" long and feature a 3.5mm audio jack connector on one end with snap style receptacles for biomedical sensor pads. Each cable comes in a red/blue/black set.

5. Biomedical Sensor Pad (sparkfun.com)

This is a 10 pack of Biomedical Sensor Pads, disposable electrodes that can be used to measure EEG, ECG and EMG levels. these little pads are perfect for short-term monitoring of Neurofeedback and Biofeedback purposes. They are to be used once and are very handy because of integrated, latex-free gel. Each pad adheres very well to the skin and the snap connector can be pushed on or removed from the electrode lead with no issue.

6. Lithium Ion Battery - 6Ah (sparkfun.com)

I selected a 6Ah Battery from Sparkfun.com. You may use any Li-ion battery. You may also use a lower capacity battery if high backup time is not required.

7. LiPo Battery Manager (sparkfun.com)

This battery management circuit consists of battery charger circuit and a boost converter circuit. You can use separate li-po charger circuit and boost converter circuit. I will show how you can use separate circuits for the project.

Step 2: Hack Your Banana Pi

Picture of Hack Your Banana Pi

The Banana Pi M1 is a credit card-sized single-board computers like Raspberry Pi based on a low-cost concept for inner software and hardware development and school software learning such as Scratch. Its hardware design was influenced by Raspberry Pi in 2013. It is produced by the Chinese company Shenzhen SINOVOIP Co.,Ltd.

Banana Pi software is compatible with Raspberry Pi boards. Banana Pi also can run NetBSD, Android, Ubuntu, Debian, Arch Linux, Raspbian operating systems. Banana Pi comes with a dual-core, Cortex-A7-based Allwinner A20 system-on-chip running at 1GHz,. That's much faster than the Raspberry Pi’s 700MHz, ARM11-based Broadcom BCM2835 processor. It also includes a more powerful Mali-400 GPU.

For my project I used Banana Pi instead of Raspberry Pi because it has a built in microphone and much faster than Raspberry Pi. The built in microphone functionality is very important for the project because I am taking ECG signal using audio card and then processing the signal using Python. I tried it in Raspberry Pi using USB microphone but I failed to run the python program due to some audio related issues and then I tried with Banana Pi and it works fine.

Actually the microphone is not required for my ECG project, I only take advantage of built-in audio circuit of the Banana pi board. The signal will comes from ECG circuit and fed it directly to audio circuit. So, remove the microphone fro the Banana Pi board as shown in the photo. Then, connect two jumper wires with the +ve and -ve pad of the microphone. I used the wire from old HDD IDE cable because the wires are thin and insulated.

Step 3: Prepare AD8232

Picture of Prepare AD8232

The AD8232 SparkFun Single Lead Heart Rate Monitor is a cost-effective board used to measure the electrical activity of the heart. This electrical activity can be charted as an ECG or Electrocardiogram and output as an analog reading. ECGs can be extremely noisy, the AD8232 Single Lead Heart Rate Monitor acts as an op amp to help obtain a clear signal from the PR and QT Intervals easily.


The AD8232 is an integrated signal conditioning block for ECG and other biopotential measurement applications. It is designed to extract, amplify, and filter small biopotential signals in the presence of noisy conditions, such as those created by motion or remote electrode placement. The AD8232 Heart Rate Monitor breaks out nine connections from the IC that you can solder pins, wires, or other connectors to. SDN, LO+, LO-, OUTPUT, 3.3V, GND provide essential pins for operating this monitor with an Arduino or other development board. Also provided on this board are RA (Right Arm), LA (Left Arm), and RL (Right Leg) pins to attach and use your own custom sensors. Additionally, there is an LED indicator light that will pulsate to the rhythm of a heart beat.

The ECG signal comes from the ECG circuit AD8232 is microcontroller compatible and maximum amplitude is 3.3V which is not safe for the microphone input of the PC audio. Typically the maximum amplitude of a microphone can be 1V. So, I made a voltage divider circuit to reduce the amplitude of the ECG signal from 3.3V to 1 volt. I used a 10K and a 3.3K resistor to make the voltage divider circuit. The schematic is attached below. You can change the value of the resistors but ratio should be same.

Step 4: Connecting AD8232 to Banana Pi

Picture of Connecting AD8232 to Banana Pi

After making the voltage divider circuit, it is time to connect the ECG circuit (AD8232) with the Banana Pi PC.

Connect accordingly:

AD8232 Banana Pi Voltage Divider Circuit
VCC3.3V
GNDGNDGND
OUTPUTINPUT
MIC+OUTPUT
MIC-GND

Step 5: Uploading the Python Programs to Banana Pi

Picture of Uploading the Python Programs to Banana Pi

This a really cool use of Python! In my project the ECG signal is processed and plotted using python. I lean on some of my favorite packages numpy, scipy, matplotlib, pyqtgraph, and PyQt4. To the the ecg program you first need to install all the packages into your Banana Pi. Follow the instructions below:

Run the following command one by one to install all the packages (I am using python3)

sudo apt-get install python3-numpy
sudo apt-get install python3-scipy
sudo apt-get install python3-matplotlib
sudo apt-get install python3-pyqtgraph
sudo apt-get install python3-pyqt4
sudo apt-get install python3-pyaudio

After successfully installing all the packages, download the zip file named as ecg-program.zip contains all the necessary python files. (The original program is written by Scott Harden. Thanks Mr. Scott for his excellent work in the filed).

Unzip the archive in a directory and transfer the directory into the Banana Pi using any any FTP client like WinSCP. Go to the directory using any serial client like PuTTY and type the following command

python3 go.py

If everything goes OK then a graph will open plotting the data in real time. This time you will get only noise as you don't connect the ecg lead to you body.

Step 6: Making of the Power Circuit

Picture of Making of the Power Circuit

For providing the power to Banana Pi and HDMI display I used Li-ion battery with 2A 5V boost converter. I used a battery from my old HTC phone and it's working well though I didn't test backup time. For more backup time use a higher capacity battery. I connected two micro USB cable about 10cm long to the output of boost converter to power up Banana Pi and HDMI display separately. It is also possible to power up the display using Banana Pi GPIO. I also added a li-ion battery charging circuit with a switch. All the connection are shown in the image.

Step 7: Connecting HDMI Display to Banana Pi

Picture of Connecting HDMI Display to Banana Pi

Connect the HDMI display to the Banana Pi using an external HDMI cable before powering Banana Pi.

Step 8: Connecting All the Stuffs

Picture of Connecting All the Stuffs

Connect all the components according to the connection diagram. Then connect the sensor cable with the 3.5mm audio jack of AD8232. Use Biomedical Sensor Pad to connect the Electrode Pads to your body. Sensor pad has three lead with different color. Connect the color leads according to the image marked in the photo taken from sparkfun.com. After connecting all the components I enclosed all in a box.

Step 9: The Complete Machine

Picture of The Complete Machine

I added here some photo of my complete ECG Machine. I thing you will like it.

Comments

arduino-raspi (author)2017-04-28

This is cool

AlbertoC7 (author)2017-04-27

Impresive! have you done any calibration test against a professional ECG? (to see if the built can be used as an emergency field ECG with a good degree of confidence)

About This Instructable

3,021views

56favorites

License:

Bio: I like to learn, like to make, like to share.
More by taifur:Arduino & Android Based Bluetooth Control Password Protected Door Lock (Version 2) Solar Powered Bluetooth Headphone (Version 2)Fixing Mouse Click Problems (Left, Right and Double Click)
Add instructable to: