Introduction: ECG Shield for Arduino

Picture of ECG Shield for Arduino

Recently i made shield for arduino which can measure ECG, respiration, eventually after some changes in PCB and code, EEG and EMG. Big advantage of this shield is possibility to make it easily at home. The shield is equipped by display to show you measured signal real-time. Shield is based on AFE integrated circuit ADS1292R. You can use this shield for many application - acquiring your vital signs (or further operations with those signals - filtering, analysing etc.), modify shield for your own application, or just do it for fun with home PCB design and soldering:)

Important note:Don´t have your computer connected to the mains, when you acquire signal from anybody! This can´t be used as a diagnostic device, if you´ll see any abnormalities on your ECG its probably because me or you did some mistake during design this shield:)

Components needed:

Step 1: PCB Design - ECG Shield

Picture of PCB Design - ECG Shield

For design of PCB I used great freeware SW CircuitMaker. Advantage of CircuitMaker is that all released PCB design are freely available, so you can use scheme and PCB. I designed and modify it exaclty for your purposes or ideas. My PCB desing is available here http://circuitmaker.com/User/0FAA9686-2FCB-4D39-8F... . During PCB design i came out mostly from datasheet and user guide. PCB has prepared button and one programmable diode waiting for your ideas:)

What wasn´t best idea is connector for display. I draw some paths on top layer, so its really hard to solder those paths to connector, when you have 2 layers PCB made at home. I would recommend to change PCB design or to use some extension between top layer and connector. Other thing suitable for improving would be connector for ECG cables:) I solder ecg cable, but maybe somebody would prefer removable connector.

I tried to do PCB as simple as possible to allow make it at home. I did that one on picture on CNC but I am sure you can use some other way mentioned here on instructables. Of course, it would be much better for signal noise if it would have more layers but that wouldn´t be that much fun:)

If you decide to change PCB desing, really important thing is to preserve analog part of circuit as clean as possible, try to keep bottom part without any paths needed.

I attached gerber data I used for making PCB on CNC machine.

Step 2: Soldering

Picture of Soldering

Soldering ADS1292R by hand could be quite tricky. If you solder ICs with that kind of package, its really important to prepare PCB properly. You should clean pads and put little solder on them. If you use lot of a solder wire you wont be able to solder all pins of ADS1292R. Most important part is placing IC exactly on pads. You can also use hot air to solder IC, but as you can see it can be done using soldering iron:) My recomendation is to start soldering with ADS1292R.

After soldering you should check that you have all pins soldered properly by magnifiying glass or USB microscope (I was almost sure that all pins are soldered properly but after seeing it in USB microscope there were 2 pins which weren´t attached to pads.)

Step 3: Programming ADS1292R With Arduino

Picture of Programming ADS1292R With Arduino

During writing code i came out mostly from datasheet, also as an inspiration I used some things I found on GitHub and so on. I wrote code without using any libraries, because I know you can easily understood meaning of code when everything is written step by step. If you prefer well-arranged code, you can move lot of things to libraries. Some parts of code are referenced to datasheet page to better understood why there has to be that part. To better understanding of the code I strongly recommend you to read up all important part in datasheet ADS1292R (http://www.ti.com/lit/ds/symlink/ads1292.pdf).

The benefit of using ADS1292R is presence of testing circuits which can be programmably set up. I guess this should be your next step. If you can acquire square test circuit, you can be sure that your circuitry work well and you can communicate with ADS1292R. I would recommend you not to rely on showing test signal, and ECG signal on display and use e.g. Serial port (simply copy those data and display them in some SW). For setting up test signal you have to write to registers CONFIG2 value 0xA3 and to register CH2SET value 0x05. You can see video of test signal on display in attached files.

After you succesfully see test signal, you are ready for acquiring ECG signal.

I attached all code - with this code you can acquire, display, filter data (sorry for using that stupid variables:D)

Step 4: Acquiring ECG Signal

For acquiring ecg signal it is important to place electrodes on right place. You can find many literature eg http://www.nursecom.com/ECGprimer.pdf. To suppress noise in the signal, you can activate Right-Leg circuitry - see datasheet.

For acquiring your ecg you have to change CONFIG2 and CH2SET again to original values. Important thing is that using channel 2 for acquiring ECG is not coincidence. As you can see in datasheet channel 1 can be used for acquiring respiratory signal (and for that you have to use different capacitor that means you cant acquire ECG with channel 1), so use always channel 2 for ECG or solder proper capacitor to channel 1:)

You don´t have to use medical ECG cable as I did, but when I compared cable I used with unshielded cable with crocodiles, using ECG medical cable resulted in less noisy signal. I attached video where you can see acquired ECG signal.

I repeat my recommendation - as you can see there are no optical isolators in PCB so always unplug your computer from mains when using this shield for acquiring your vital signs.

Step 5: Signal Processing

Picture of Signal Processing

As you can see on video the ECG signal is quite noisy. That is caused mainly because following reasons: I used only simple IIR filter with two coeficients. If you want get better results, you should use FIR filters and/or median or averaging filters. Other thing is that ADS1292R has stunning resolution (24bit) but if you want to display acquired signal to 176x220 pixels display, you are loosing like 99% of resolution - Also I used the simplest method to get into proper range of display (Subtraction and division). Other recommendation would be not to show every point of data as I did, but do an average of like 5 points and display it.

When you are into signal processing (filtering, QRS detector, heart rate monitoring) you won´t use display at all. Thing is that arduino is not exactly DSP so when you would like to do some processing, you should use more suitable SW like Matlab, or use DSP instead of Arduino. Combination of well-chosen filters in Matlab, acquiring signal with ADS1292R can result in that kind of ECG you are used to (as you can see on picture). I think this should be the main usage of this shield - further analysis of acquired signal. You can apply filters, algorithms you create on real data.

Step 6: Further Use of Shield

When you look to the datasheet you´ll find that acquiring ECG is not the only thing ADS1292R or its multi-channel version ADS1298R are suitable for. I am sure that when you modify PCB from circuitMaker just a little you will be able to acquire EEG and EMG signal as well. ADS1292R can acquire respiratory signal as well. When you change the code to activate channel 1, you should be able to read respiratory data. To be honest I wasn´t so fascinated by data I get. I am not sure whether it was caused by "home-made" PCB or some SW issue. Hopefully, you´ll get better results:)

On PCB you can also find button (pin A0) and programmable LED (pin D7). I did not find use for those but maybe you get more lucky:)

I really hope you will have fun with ECG arduino shield, and you´ll get me some feedback. Also if you would have any problem with realization of ECG arduino shield, don´t hesitate to contact me:)

Comments

TheThinker (author)2017-04-09

Clean and elegant design! Thanks for sharing!

jjes144 (author)2016-07-16

cermakmara, I have tried to generate output files in circuitmaker using this excellent design, and although getting pretty far into the release for manufacturing files, circuitmaker is currently giving a whole bunch of validation errors, want to give this a try yourself, and provide some commentary, thanks?!

cermakmara (author)jjes1442016-07-19

Hi John,

firstly, again, i would like to apologize for not responding for such a long time. I already wrote you private message about this issue, and again - the zip file i attached is what i used as a data for CNC machine, and as you can see those data can be used for PCB as is shown on attached pictures, i didn´t made any changes. Probably you have problem, that your producer of PCB want from you layers I did not generate, because i didnt need them. If its this issue, you should ask for exact layers your producer need and generate them from circuitmaker. I would really like to help you so if you would still deal with troubles, let me know through PM or comment and we would figure out solution. Just write me exactly what you need to do in circuitmaker:) thanks Marek

jjes144 (author)2016-06-30

I agree, fabulous design, any change for photos of the ecg connector, and, by the way, is the spi designed in at 3.3V, and can this run on lipoly battery straight up?

juliasus92 (author)2016-04-15

If you used 3.3v for both AVDD and DVDDD then whats the point of using two different voltage regulators?

cermakmara (author)juliasus922016-04-15

Hi, if you look at datasheet page 60 http://www.ti.com/lit/ds/symlink/ads1292r.pdf you can find there some reasons why there should be two separate power supplies. Truth is, I at beggining wanted to use exact design from datasheet (3.3V, 1.8V) but i forgot that 1.8v is for communication with Arduino in invalid region. So than i Exchange 1.8V regulator for 3.3V regulator and everything went smoothly:) I will reply for your display issue later:)

juliasus92 (author)cermakmara2016-04-18

Thanks for the reply, Can you please help me with the data displaying on my LCD screen
I am not able to do the changes
HERE is the link of the LCD module i am using.

cermakmara (author)juliasus922016-04-19

Alright, I would like to help you, sending PM:)

DIY Hacks and How Tos (author)2016-04-10

That is a very cool shield design.

Thank you:)

juliasus92 (author)2016-04-14

This is really an amazing shield design, however there is a small change that i want to make and i need your help in this regard.

I am using a adafruit tft display shield for my arduino here is the link for that.
i am quiet new to programming so i am not able to it my self.
can you please send me the code that can display this ECG data on my tft shield

About This Instructable

9,707views

107favorites

License:

More by cermakmara:Biofeedback Measurement InstrumentECG shield for Arduino
Add instructable to: