Detection of alpha or eye movement with ADS1299EEGFE-PDK

ugrcnknbrugrcnknbr Turkey
edited June 20 in Other Platforms

I send the data I measured with ADS1299EEGFE-PDK to Arduino UNO. My electrode placement is 1N:O2 , reference:ear. I want to see alpha waves and for that I need to enable filtering. I don't know how to do this in the Arduino library. Can anyone help?

«1

Comments

  • See for example https://github.com/mozanunal/SimpleDSP
    You need to check, first, that the data as received by your Arduino is in a format that something such as the DSP library above can use.

  • ugrcnknbrugrcnknbr Turkey

    Either I misunderstood you or I misrepresented myself. Sorry, I don't know much about this stuff yet. But from what I've read I can get alpha waves with LOFF registers. I looked at the datasheet but couldn't understand it.

  • wjcroftwjcroft Mount Shasta, CA

    Bill, thanks.

    Ugurcan, hi.

    Here is an example of how eyes closed alpha looks in the FFT,

    https://docs.openbci.com/docs/01GettingStarted/02-Biosensing-Setups/EEGSetup#4-alpha-brain-waves-eeg

    William

  • ugrcnknbrugrcnknbr Turkey

    I want to design a system in which I want to light the led while my eyes are closed. It also has to be continuous. Would it be useful to apply fft to the signal for this?

  • wjcroftwjcroft Mount Shasta, CA

    You could either use FFT, or just a simple bandpass filter from 8 to 12 Hz, which covers the 10 Hz, average peak for individuals.

    https://www.google.com/search?q=arduino+dsp+library

    The Arduino uno, is generally considered a rather underpowered microcontroller these days. Compared to ESP32, Raspberry, etc.

    https://hmbd.wordpress.com/2016/08/24/speed-comparisons-for-arduino-unonano-and-due/

  • ugrcnknbr,

    Are you using a computer to program the Arduino? If so, I would compile and test a C program using a C DSP library on the computer that does what you want, then port the program to the Arduino using an Arduino C DSP library, hopefully one with similar DSP related filter functions. That way you can make sure you are handling the data from the ADS1299EEGFE properly before adding another device layer of complexity.

    I suggested C because I am sure that compiler exists for the Arduino, but anything you can compile for the Arduino would also be fine.

  • ugrcnknbrugrcnknbr Turkey

    Hi Bill,
    I would be very happy if you could help.

  • To help I would need to know where you are with your setup.

    The ADS1299EEGFE-PDK comes with Windows software that can show an oscilloscope and lets you do FFT. Do you have that installed and getting signals from your hardware?

  • ugrcnknbrugrcnknbr Turkey

    Hi Bill,
    Yes I can receive the signal. I can observe the signal on the serial plotter screen of Arduino.

  • wjcroftwjcroft Mount Shasta, CA

    Curious how the ADS1299EEGFE-PDK is connected to the Arduino. Since this dev kit is normally used with TI's supplied Windows software through a USB interface. I'm not even clear that they provide the protocol / interface library to allow writing your own programs on Windows. The kit is mostly intended as a demo of the ADS1299 hardware, not as a complete EEG solution for end users. It's targeted at EEG system hardware engineers, building new products incorporating the ADS1299.

    https://www.ti.com/tool/ADS1299EEGFE-PDK

    William

  • @ugrcnknbr said:
    Hi Bill,
    Yes I can receive the signal. I can observe the signal on the serial plotter screen of Arduino.

    Okay, now can you grab a small segment, say 2 seconds of the signal and save it to a C array, then find the minimum, maximum, and mean of that array and display those numbers?

  • William ,that link is interesting. Page 30 of the PDF manual shows an FFT screen where the user range can be set! This means that if the user sets a range of between 8 Hz and 12 Hz the PDK will display in its FFT app what OP wants.

    @wjcroft said:
    Curious how the ADS1299EEGFE-PDK is connected to the Arduino. Since this dev kit is normally used with TI's supplied Windows software through a USB interface. I'm not even clear that they provide the protocol / interface library to allow writing your own programs on Windows. The kit is mostly intended as a demo of the ADS1299 hardware, not as a complete EEG solution for end users. It's targeted at EEG system hardware engineers, building new products incorporating the ADS1299.

    https://www.ti.com/tool/ADS1299EEGFE-PDK

    William

  • wjcroftwjcroft Mount Shasta, CA

    Bill, thanks.

    Yes the dev kit is really intended for use by TI's supplied Windows app. I have noted in the past that the kit consists of TWO boards, a main board with the usb interface, and a smaller daughter board that plugs into the main board. This daughter board has just the ADS1299 and some passive components (front end RC filters and such).

    It's possible that Ugurcan has just removed the daughter board from the kit, and connected that alone to his Arduino. Thus he essentially loses access to the usb and Windows app. But does gain complete flexibility in how he programs his Arduino DSP.

    Regards, William

  • edited June 9

    If he is trying to do all the interface and DSP within the Arduino I have not done this doubt I could be of much help. It looks as if it has been tried before though: see https://github.com/starcat-io/hackeeg-driver-arduino

  • ugrcnknbrugrcnknbr Turkey

    Hi wjcroft,
    I did not uninstall ADS1299 from MMB0. When power is applied to the MMB0 board, power is also generated in the ADS1299. I looked at the datasheet for serial communication. Then I connected all the pins correctly. There is no problem with serial communication. I put on the electrodes and got the signal from the ADS1299 and I see this signal on the Arduino Serial Plotter screen. My problem is this signal is complex. I need a filter that outputs an 8-13 Hz signal.

  • I couldn't figure out the issue so I had to change it. I placed electrodes just above and below my eye. One is 1N and the other is reference. This time, as soon as I blinked, I observed the signal. But I've only seen it once. Even though I tried thousands of times, I couldn't see the same signal. I think I'm going to go crazy. I removed anything that would make noise. All my links and codes are the same. Do you have any suggestions about what I should do?

  • wjcroftwjcroft Mount Shasta, CA

    Ugurcan, hi.

    Your original post, mentioning electrode at O2, with ear reference, should be fine for alpha generation. As @Billh pointed out, you can use the TI Windows app, to view the FFT of the incoming EEG. When eyes are closed, you should see an increase in 8 to 12 Hz band. But note, not all individuals generate the same amount of alpha. So if you are not seeing it using yourself as subject, try some friends.

    It's also possible that your electrodes or cabling or gel/paste are suspect. But the fact that you are seeing the eye blink, seems to contradict that hypothesis. But then you state "I've only seen it once". This then implies that your cables or electrodes or paste / gel, is intermittent. The eye blinks should always show up easily.

    I suggest you ditch the Arduino idea temporarily, and just concentrate on using the TI app, until you have verified that you can get alpha with eyes closed. Here again is the alpha tutorial from docs folder:

    https://docs.openbci.com/docs/01GettingStarted/02-Biosensing-Setups/EEGSetup#4-alpha-brain-waves-eeg

    William

  • ugrcnknbrugrcnknbr Turkey
    edited June 20

    I want to compare data coming to Arduino UNO with ADS1299EEGFE-PDK. But I cannot do this with the ADS.channelData[0] command in the library. What I want to do is:

    if(n-(n-1)>x) { //n:last read data
    ...........
    } 
    

    I need such a command. I would be glad if you help.

  • wjcroftwjcroft Mount Shasta, CA

    @ugrcnknbr, hi.

    I merged your new thread into your existing thread on ADS1299EEGFE-PDK issues. It makes more sense to keep related questions together in one thread.

    Were you successful in seeing the alpha band (8-12 Hz) increase, watching the FFT tool in the TI application? As you closed your eyes?

    Examples I've found of Arduino code accessing the ADS library, are assuming that the ADS1299 chip is directly connected to the Arduino SPI bus (MISO, MOSI, etc.) I thought in your case that your ADS1299 is part of the TI dev kit, and not directly connected. (Connected instead via serial port?) Here is a code snippet that came up on a search:

    https://openbci.com/forum/uploads/editor/ks/8ebae6vp4htv.txt

    Regards, William

  • Hi wjcroft,
    I guess you didn't read my previous post. I said I changed the subject. I don't need alpha waves anymore. I placed electrodes above and below my eye. When I blink my eyes, I observe it on the serial plotter screen. But when I close my eyes, I want the led to turn on. But I can't get a reference for it.The data appears with the command ADS.channelData[0]. But I can't do anything with this code. For example, I want to take the difference between the last value read and the data read 2 before the last value and if it is greater than x, I want the led to light up.

  • wjcroftwjcroft Mount Shasta, CA

    You commented previously:

    I placed electrodes just above and below my eye. One is 1N and the other is reference. This time, as soon as I blinked, I observed the signal. But I've only seen it once. Even though I tried thousands of times, I couldn't see the same signal. I think I'm going to go crazy. I removed anything that would make noise. All my links and codes are the same. Do you have any suggestions about what I should do?

    "But I've only seen it once." As mentioned previously, this could point to issues with your cables, electrodes, paste, connectors. Have you resolved this intermittent issue?

    What the eye electrodes are seeing is called EOG, a form of EMG.

    https://www.google.com/search?q=eog+electrooculography+tutorial

  • I opened a new topic so that these conversations would not happen.

  • @ugrcnknbr said:
    Hi wjcroft,
    I guess you didn't read my previous post. I said I changed the subject. I don't need alpha waves anymore. I placed electrodes above and below my eye. When I blink my eyes, I observe it on the serial plotter screen. But when I close my eyes, I want the led to turn on. But I can't get a reference for it.The data appears with the command ADS.channelData[0]. But I can't do anything with this code. For example, I want to take the difference between the last value read and the data read 2 before the last value and if it is greater than x, I want the led to light up.

    So this is my problem

  • wjcroftwjcroft Mount Shasta, CA

    I opened a new topic so that these conversations would not happen.

    I edited the title of this thread to include eye movement. You did not answer my questions, asked two times. You stated that "But I've only seen it once." Has this been resolved? Did you read the EOG search link?

  • I thought I answered. I may have misunderstood, sorry. Can you ask the question again?

  • wjcroftwjcroft Mount Shasta, CA

    You commented previously:

    I placed electrodes just above and below my eye. One is 1N and the other is reference. This time, as soon as I blinked, I observed the signal. But I've only seen it once. Even though I tried thousands of times, I couldn't see the same signal. I think I'm going to go crazy. I removed anything that would make noise. All my links and codes are the same. Do you have any suggestions about what I should do?

    "But I've only seen it once." As mentioned previously, this could point to issues with your cables, electrodes, paste, connectors. Have you resolved this intermittent issue?

  • Yes, it's resolved.

  • edited June 20

    EEG data is times series data. That usually means that either ADS.channelData[0] is itself a vector of measurements over time, or that ADS.channelData[0] is different after time has passed because it is updated over time.

    Do you know what ADS.channelData[0] is? Is it a number or an array of numbers?

    If ADS.channelData[0] is a number, have you tried setting a variable like n1 to the value of ADS.channelData[0], pausing a while, and then seeing if ADS.channelData[0] is not the same as n1 still is, after a pause?

    @ugrcnknbr said: ... The data appears with the command ADS.channelData[0]. But I can't do anything with this code. For example, I want to take the difference between the last value read and the data read 2 before the last value

  • wjcroftwjcroft Mount Shasta, CA

    Bill, thanks.

    Ugurcan, consider reading up on EOG, which is what you are trying to measure. Some of these tutorials show how to detect the movement direction.

    https://www.google.com/search?q=eog+electrooculography+tutorial

  • I assigned it to a variable but it returned 0. So it didn't.

Sign In or Register to comment.