Example Code

2. Acquiring a real world EEG using the Biomedical Toolkit for LabVIEW 2012

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Biomedical Toolkit

Code and Documents

Attachment

Description

Introduction

 

This community example briefly looks at how to acquire real world EEG data in LabVIEW using the Biomedical Toolkit add-on.  The VI is included at the end of this document and makes use of both the Biosignal DAQ express VI and the EEG FFT Spectrum VI of the Biomedical Toolkit.  This example is the second in a series of example programs that make use of the toolkit to acquire biosignals in the real world.

 

Uses of simulating EEG data

 

Simulating signals is a good way to check the behavior of your program before acquiring real world data.  It is also a good measure of what sort of amplitudes and frequencies to expect when performing the acquisition with your own hardware.  Take a look at the example code provided in my other community example post: 1. Simulating an EEG using the Biomedical Toolkit for LabVIEW.

 

The NI LabVIEW Biomedical Toolkit

 

The NI LabVIEW Biomedical Toolkit can be used for both educational and research related purposes and includes functions for Biosignal Acquisition, Biosignal Measurements, File I/O and Medical Image Processing.  With the Biomedical Toolkit, you can take EEG, ECG and EMG measurements easily and effectively and display their waveforms in LabVIEW.

 

Biomedical Toolkit LV.png

(Figure 1. Biosignal Measurements palette of the Biomedical Toolkit)

 

Coding in LabVIEW

 

The following image shows the coding used to acquire a real world EEG waveform and perform an FFT on the data so that we can view it in the frequency domain.  Typical EEG frequencies range from 0-30 Hz, with expected amplitudes of 10 uV - 100 uV when measured from the scalp.

 

Real World EEG Example 2012 Snippet.png

 

(Figure 2. LabVIEW snippet of Block Diagram coding for the Real World EEG Example VI)

 

The Biosignal DAQ Express VI

 

Configuring the Biosignal DAQ express VI involves setting the the expected input range to the DAQ device and sample rate.  You can also set the sensor scaling prior to taking your measurements in order to vary the expected input range of the device. For example, I have used the Vernier EKG sensor scale to limit the input range to a millivolt scale. 

 

The express VI is very similar to the DAQ Assistant express VI as it includes options for setting which hardware channels to use and selecting the acquisition mode of the device.  Take a look at the following Configure Biosignal DAQ dialogue box to familiarize yourselves with the express VI set-up.

 

Configure Biosignal DAQ Dialogue Box.png

(Figure 4. Configuration Dialogue Box for the Biosignal DAQ express VI)

 

EEG signal notes

 

  • EEG data is actually a superposition of many biosignals, each with varying frequencies. 
  • The expected observed frequencies when taking EEG measurements is determined by the electrode placement on the scalp. 
  • 60 Hz mains hum is a major design consideration when working with EEG data.
  • Gain stages in your circuit design are of equal importance as the expected voltage amplitudes are within the micro volt range.

 

Acquiring your own EEG data

 

Provided you have the necessary hardware, all that is left for you to acquire your own EEG data is to ensure you download the Biomedical Toolkit from the National Instruments website:

 

LabVIEW Biomedical Toolkit Download Web Page

 

Try creating this simple program from scratch.  If you have any problems you can download the attached VI or use the Block Diagram snippet in Figure 2 of the document - Enjoy!

 

Uses of EEG

 

There are many reasons for taking a person's EEG.  EEGs are useful in diagnosing brain tumors, encephalopathies and epilepsy.  However, brain waves can also be used to control real world devices.  Take a look at the following link to get an idea of how EEG can be used to control robots:

 

The Mastermind Project

 

Further development of this page

 

If you have any suggestions to improve this page or if there is anything not included on here that you would like to see, let me know and I will do my best to accommodate these changes.

Marshall B
Applications Engineer
National Instruments UK & Ireland

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Eden_S
NI Employee (retired)
on

Amazing! Really great work Ben, well done

Eden S
Applications Engineer
National Instruments UK & Ireland
LocoEfren
Member
Member
on

Hello I wanted to know what types of devices could be connected to the analog inputs of the myDAQ

Marshall_B
NI Employee (retired)
on

Any analog output sensor can be connected to the inputs of the device.  For example, you could use temperature sensors, accelerometers or even microphones.

Marshall B
Applications Engineer
National Instruments UK & Ireland
LocoEfren
Member
Member
on

okay, but I only asked for an ECG, I wanted to know if I need to create the EEG detection circuit or if there is already a sensor that allows direct connection to the myDAQ.

  thanks

Techlabs14
Member
Member
on

I am using NI ELVIS II+, NI LabVIEW, NI Bimedical Toolkit.

I want to do the EEG application based on LabVIEW.

What are the Sensor item are required to complete real time EEG signal aquisition and record the data.

Please suggest, if anybody doing this priviously.

Thanks