DIY ECG + Arduino + LabView

17,701

38

31

Introduction: DIY ECG + Arduino + LabView

Hello everyone! this is my very first project that i wish to share with you... (it's not the best one, but the results were really amazing!) before we begin, i recommend you to have some basic skills in analog circuits and LabView, or join someone who already know both things.

The analog stage consists only of Opamp substages like filters or amplifiers, and the Digital one consists in a simple analog read operation in LabView using an Arduino UNO board with a basic GUI showing the heart frequency and the signal coming out from the electrodes.

If you're ready to go, let's get started!

Step 1: Making the Electrode Wires

We need 3m of RCA cable, i recommend this cable because it's hehaviour is similar to a coaxial cable due to the outer conductors, they give more stability to the signal coming out from the electrodes. We're going to use only the inner conductors.

Weld 3 size 3 snap buttons to each inner conductor. Then weld the other ends to a 3 channel audio jack.

Remember to isolate every bare wires.

The electrodes that i used are shown in the picture. The're exclusively for ECG/EMG

Step 2: First Analog Stage (Instrumental Amplifier)

1.- in the schematic, E1 and E2 are the electrodes (both are connected to the chest, the third one is connected to GND and it is usually placed onto the heel). The opamps that i used are TL081, which i noticed, were more stable than 741.

You can see the resulting signal in the scope

Step 3: Second Analog Stage (60 Hz Notch Filter)

The notch filter is very important in the circuit, because it cleans up the frequency coming out from the AC voltage source.

Step 4: 3rd Analog Stage (low Pass Filter)

Add another filter in case of lower frequencies are detected like the movement of the electrodes

Step 5: 4th Analog Stage (inverting Summing Amplifier)

This stage is very usefull because i detected that small dc components (but greater than the electrode signals) are altering the output signal of the instrumental amplifier, so we need an offset stage to compensate it.

Step 6: 5th Analog Stage (Inverting Amplifier)

Finally, the last stage of the ECG, the inverting amplifier will magnify enormously the small signal of the last stage, making it easier to see.

Step 7: Breadboard/pcb Design

Sadly i didn't have enough time to make a fancy pcb design. i took out the components of the breadboard and placed it just like that onto a perforated breadboard-like plate. The circuit works with a separated dc voltage source (+-9V)

Connect the output signal of the ECG to the A0 Arduino pin. Connect the adruino GND to the circuit's GND.

Try to drill holes in the box for the opamp voltage sources, the audio jack, the pot and the usb cable.

Step 8: LabView Stage

Try to copy the following LV block diagram (for Arduino UNO i used LYNX to communicate the board with my laptop)

The final result is surprisingly great!

You can download the VI here =)

Attachments

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    31 Discussions

    0
    PaulG367
    PaulG367

    1 year ago

    You use a bootstrapped notch filter. How did you make this thing work? It seems you used ordinary ceramics capacitors for the ntoch filter. I tried it myself and was never able to get a working filter. I just read the caps in a bootstapped notch filter needs to be at least film type ones with VERY tight tolerances. Have you ever measured your notch filter?

    0
    the_3d6
    the_3d6

    Reply 1 year ago

    We are working on ECG device ( https://igg.me/at/uecg ), and we were unable to filter out 50/60 Hz using hardware filters - it just takes too many components to make it sharp enough. Instead, we developed a software filter that produces amazing results with quite simple math. You can read a bit (and see results) here: https://hackaday.io/project/164486-uecg-a-very-small-wearable-ecg/log/160808-project-timeline . Source code is not available yet (it is an open source device but we want to clean and comment code before making it publicly available), but if you want it now - I can clean and share the code of that filter :)

    1
    BrunoV18
    BrunoV18

    Reply 1 year ago

    Hi and thank you for your observation. Ceramic capacitors worked good for me when i was making this project. For the notch filter, i couldn't find any 100 nF film capacitors in stores, for this measure, most of them that i found were ceramics.

    When i was working in the notch filter phase, the circuit (that i found googling around) gave me the most minimal output voltage (compared to other stop-band circuits found) when giving it a 60 hz signal from the function generator.

    In an Improved version of the circuit, i put another notch filter at the output of the EKG and i replaced the offset stage by a PID stage that heped me to always get the heart signal.


    0
    carloszoom3000
    carloszoom3000

    1 year ago

    Muy buen trabajo.
    La fuente para todos los LM741 es de +-12 para +Vcc y -Vcc.
    Debe ser una fuente simétrica o puedo tener una sola fuente de 12 e invertir la polaridad?
    Te agradecería el pdf del proyecto.
    carlos.villalobosh@aol.com

    Saludos,

    0
    PaulG367
    PaulG367

    2 years ago

    Do I see this correctly that you in the first stage built an discrete instrumentational amplifier?
    Wouldnt it be much easier to use a single Instr. Amplifier?

    0
    Dogukan Kaygusuz
    Dogukan Kaygusuz

    2 years ago

    Thank you very much for this project. I'm a student and i am working related to this project. Can you send PDF via email me? (dogukank@sabanciuniv.edu)

    Thank you :)

    0
    NataliaJ13
    NataliaJ13

    2 years ago

    hola, tengo una pregunta, cuando corro tu programa ecg.vi en labviem, me sale esto NI Labview myrio Module support for labviem 2016 is missing. si puedo conectar el arduino y funciona???. agradezco me soluciones esta inquietud mi correo nataliajimenezordonez@gmail.com, si me podrias enviar el archivo PDF, te lo agradeceria

    0
    ImenB4
    ImenB4

    2 years ago

    hello !

    please help me i am using a usb/serial in order to communicate with my laptob and i want to know if it requires a code on the arduino board and how did u connect the two dc voltage source to the circuit ?

    0
    jamesnroses
    jamesnroses

    2 years ago

    Genial tu proyecto, me gustaría saber si me puedes enviar el diagrama del circuito completo... Te lo agradecería. jamesnroses@gmail.com

    0
    PacoC22
    PacoC22

    3 years ago

    Hola disculpa, tengo los electrodos y unos cables para conectar a cada uno, cómo es que se conectan a la primera etapa que corresponde al amplificador de instrumentación? Agradezco tu respuesta

    0
    PacoC22
    PacoC22

    Reply 3 years ago

    Además, en qué parte se tienen que conectar los electrodos para obtener una señal óptima?

    0
    BeatrízV8
    BeatrízV8

    3 years ago

    Tenía una consulta, en la parte del filtro notch, los capacitores son de 10 micro o 10 nano? Es que no logro diferenciar muy bien, muchas gracias de nuevo:)!

    0
    BrunoV18
    BrunoV18

    Reply 3 years ago

    10n

    0
    BeatrízV8
    BeatrízV8

    4 years ago

    Realmente me ha gustado tu proyecto, cómo podría hacer la simulación en algún programa como proteus? Te agradecería mucho tu colaboración, por cualquier cosa mi correo es trillalta@gmail.com

    0
    BrunoV18
    BrunoV18

    Reply 4 years ago

    Hola Beatriz

    Muchas gracias por tu comentario =D.

    Durante el desarrollo del proyecto, en un principio pensaba hacer una simulación del circuito con el programa que uso habitualmente (Multisim). Pero recuerda que la señal del corazón es muy particular y no es posible obtener una "fuente de ecg" en el programa.

    Estuve revisando foros... y por ahí encontré una simulación de un ecg (para Multisim) simbolizado como una fuente de voltaje, la cual puedes procesarla como fuera, ya sea amplificarla, filtrarla o atenuarla.

    Pero te recuerdo que una señal analógica viene con ruido, así que probablemente los resultados que te de la simulación podrían ser diferentes a los reales en cuanto al procesado de la señal.

    Te recomiendo que implementes el circuito paso a paso, por eso los puse por etapas. Una vez tengas el amplificador instrumental, pasas al filtrado, etc...

    0
    BeatrízV8
    BeatrízV8

    Reply 4 years ago

    Te agradezco muchísimo! Ahora por la tarde iré a comprar los elementos para montarlos y hacer pruebas, espero poder contar con tu asesoramiento más adelante y de nuevo te agradezco:), seguí así.

    Saludos!

    0
    eyican
    eyican

    4 years ago

    hi, can I use this labview interface for EMG? Sorry,I am asking like this question because I am not good at labview:(

    0
    BrunoV18
    BrunoV18

    Reply 4 years ago

    Sure! this LV interface is just a common signal visualizer supporting voltages coming out from the Arduino UNO (0- 5V), you can visualize whatever you wish with the LabView file =)

    0
    MatheusB11
    MatheusB11

    4 years ago

    Hello sir, please help! i cant find those cables here in Brazil. Maybe the name that is called here is different, could you send me the site where you buy it? (sorry my bad english)

    0
    BrunoV18
    BrunoV18

    Reply 4 years ago

    here in Mexico we call it "cable de bocina" (speaker cable), but try to get any cable with metallic shield. =)