instagram

Saturday, December 14, 2013

EEG Design - time for something totally different

So I've wanted to build an EEG since I was in college and have numerous times spec'd out parts etc but never really got going. I've followed the OpenEEG project for ages, but technology wise it has remained rather stagnant. However, I just recently came across the OpenBCI project which pointed me at the ADS1299 chip and that has reinvigorated my interest in building a simple EEG. It's a long shot, but my ultimate plan is to create a system like this:



One thing I wanted to change from the OpenBCI design was to use an STM32 processor, since that is what I'm more familiar with. My goal is to avoid a lot of the safety issues regarding powering from a computer by running the data via my phone. This also gives me free perks like wifi, screen, bluetooth, etc. I should be able to pretty easily use the Android GCS as a basis, especially since that already has a lot of the core code for handling data via USB (HID and Serial) as well as WiFi (great for running simulations).

It was pretty straightforward to base the design off Sparky which seemed like a pretty good starting point - both in terms of electrical and mechanical properties. I had to extend the board a bit to fit the ADS1299 on there without going to four layers (I'm cheap and would rather a bigger board for the prototype). This is the end result:




The final board is 50 x 35 mm. I can easily shave 5 mm off the right side, but figured I'd leave it this size in case the next revision has more channels and needs that space.  Currently it is single sided so lots of room for expansion. And it's nice because I can reuse a lot of the code from Sparky and just write a new PiOS driver that speaks to the ADS1299 chip. For laughs, I left the accel/gyro/mag chip in case I want to have some kind of head tracking. Either that or try and use it strapped to my arm like a Thalmic labs wrist band.

Here is the schematic. Sorry the layout is really ugly - I should redo the TPS60241 component so the power comes in on the left and goes out on the right.


Layout

The ground plane is split to keep the analog electronics and digital electronics as separate as possible. The top plane on the analog side is AVDD and the bottom is AVSS. This is where a four layer design would be a bit better but for now I'll save some money.

Top:
Bottom:


Features

  • 8 Channels of single ended input, 1 driven bias electrode and one common reference electrode
  • Small (36mm x 50mm)
  • Utilizes ADS1299 chip
  • Optional reference and bias electrodes
  • Powered by USB. Small step up inverter generates a clean 5V after the input diode (probably not necessary if I never plan to use battery input). This can supply up to 25mA of current and the analog supply only requires 10.
  • Single sided power supply design (so patient will be at 2.5V relative to the board)
  • Solder pad allows using any electrode (routed out via SRB2) to serve as the negative input for the others. Alternatively use an additional reference electrode such as an ear clip.

Notes and quirks of the ADS1299

There were a number of things that were not obvious to me from a first pass through the datasheet. This is mostly a reference for me when I forget them after I came to a conclusion.

biasin - At first I assumed this input was something to do with computing the actual bias value. However, it is actually for situations where you want to reduce the number of electrodes going to the patient. In this case, you actually connect the biasin signal to the positive pin of a channel (i.e. electrode) which creates the path for the driven bias current. This will (obviously) introduce a small bias into the signal recorded on that channel, but this should be small and slow compared to the signals of interest.

srb1/2 -  Again, like with biasin, at first I assumed that both of these were meant to be treated as inputs. Either to provide a reference for the positive or negative inputs. However, (and again like biasin) this is to allow reducing the electrodes to the patient. In this configuration, you select an electrode (positive input) that will serve as the reference for others and route it out of SRB2. Then there is an external bridge from SRB2 to SRB1 which passes this signal back in and allows it to be the negative channel for all the other electrodes.

Input configuration

The ADS1299 has a pretty powerful analog multiplexer - but what is a tad counterintuitive or non-obvious is that channels can be mapped to inputs or outputs implicitly. The input mixer also gives lots of options. I'm going with what I think is the standard configuration and what seems most referenced in the EVM notes. This means the CHxSET register will be 000 for the mux "main" with SRB1 high. The positive values will all be routed out to the electrodes and the negative values will all go to SRB1.

Anticipated bias and reference

The full cable set will generally be used, at least at first. This means a reference electrode (e.g. earlobe) will come in to SRB1 and be connected to the negative input of all the channels. All of those channels will be averaged internally to compute the biasinv signal. The internal bias generation (2.5V) will be used for the positive input. The output (biasout) will then go to an electrode (via a protection resistor).

Thoughts

Inputs - OpenBCI used the negative inputs at SRB2 for their channels. I can't really understand why they did this (although it looks like it should work) but it won't be in "normal electrode" mode. 

I'm pretty tempted to switch a bipolar power supply like that in the EVM. The advantage of this is the patient is driven to zero volts relative to the digital electronics. This shouldn't ever be an issue provided everything is running from batteries but still is a potential safety improvement. It adds another chip though.

Isolation - one thing OpenBCI did quite nicely was solid isolation. This is important, especially if you want to make something commercial. I'm just goofing around and will try and only use it via phone or worst case when laptop is not powered by mains. To be honest, I just don't feel like putting all the components down for it.

Ground - Related to the the isolation issue, I hope I routed the ground appropriately. The ground plane is split - digital ground over the digital electronics and analog under the ADS1299. The digital grounds from the ADS go over to the digital ground plane and then are star grounded to the analog plane near the analog regulator. The AVSS and AVSS1 are both just connected locally to the ground plane rather than separately routed back to the star ground. The AVDD plane is similar.

Also one limitation of using my phone to collect the signals (provided processing power isn't the limit) is that I cannot simultaneously connect to a USB radio and control a quadcopter. However - if I get to the point that is the limit I'll happy redesign and use something like Freedom with more build in processing in the embedded board, or combine an RFM22b onto it.

Anyone have any comments on the schematic? I don't think I've got any glaring errors but you never know...

References

  • http://www.ti.com/lit/ug/slau443/slau443.pdf
  • http://www.ti.com/lit/an/sbaa188/sbaa188.pdf - good DRL notes
  • http://www.ti.com/lit/gpn/ads1299
  • http://www.openbci.com/technology-update/

34 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi There. Thanks for the great write-up!

    With respect to OpenBCI and the connection of our electrodes to all the negative inputs, the reason that we did this had to do with the differences in the muxing of SRB1 vs SRB2...

    At first (OpenBCI V1), we used all the positive inputs on the ADS1299, as might be expected. For our reference electrode, we elected to connect it to SRB1, which can be connected to all of the negative inputs. It worked great.

    The only downside is that the ADS1299 forces you to use SRB1 as the negative for *all* the channels or for *none*. So, if you wanted to do something crazy like record EEG on the first 7 channels and then record a 2-lead ECG on the last channel, you couldn't. You would be constrained by the fact that you couldn't tell the mux to disconnect SRB1 from the last channel. For the OpenBCI V2 board, we thought that we could do something cooler and more flexible.

    So, looking at the ADS1299 datasheet, we saw that SRB2 was more flexible and could be connected on a per-channel basis. It is weird, though, because it only connects to the positive electrode inputs. Therefore, to use SRB2 for our reference electrode, we had to move all of the regular electrodes over to the negative inputs. Fine.

    So, we built the boards and they work. Specifically, OpenBCI V2 is set up to always use SRB2 as the reference for the channels 1-7. SRB2 is the optional reference on channel 8.

    If you don't use SRB2 on channel 8, we broke out both the IN8P and IN8N pins so that you can attach another electrode and use it as the reference for channel 8. As a result, you can do both EEG and ECG at the same time.

    It's totally untested in this mode, but it's what we were going for.

    Chip

    ReplyDelete
  3. Ah ok. I was suspecting that was the motivation, so it's good to hear that confirmed. It is a bit weird that the SRB1 approach is a global bit and more recommended. Flexibility is always good though.

    ReplyDelete
  4. I am also working on a building a EEG system around the ADS1258-EP.

    So since a lot of things are similar, I think you should try a better reference implementation for the VREFP & VREFN pins of ADS1299, like in this article: http://www.maximintegrated.com/app-notes/index.mvp/id/3657
    You can ignore the mosfet tranzistor FDN302P, rezistors R2 & R3 because you can just short out the input + of the amplifier and its output. As for reference voltage MAX6126 you can also use AD4525 or AD441 or MAX6325 (all of them are pin compatible). As for the amplifier if the EEG will be used in a very noisy environment probably MAX44246 is a better amplifier.
    Good luck!

    ReplyDelete
  5. Hi James,

    I'm planning an open source ADS1299 based design with bluetooth. Would you be willing to share the EDA files for your board. It looks like a great start to work of.

    Cheers,
    Peter

    ReplyDelete
  6. hai ,

    we are trying to build something similar , could we work parallelly please?

    ReplyDelete
  7. Hi James,

    I have a question regarding the bias output. You mentioned the following:

    "At first I assumed this input was something to do with computing the actual bias value. However, it is actually for situations where you want to reduce the number of electrodes going to the patient. In this case, you actually connect the biasin signal to the positive pin of a channel (i.e. electrode) which creates the path for the driven bias current. This will (obviously) introduce a small bias into the signal recorded on that channel, but this should be small and slow compared to the signals of interest."

    The ADS1299 datasheet specifies that "this feature can be used to dynamically change the electrode that is used as the reference signal to drive the patient body" - p. 48.

    I am hoping to reduce the number of electrodes that I require, but I am still not sure as to using this as a solution, particularly because I need all the inputs to be able to calculate impedance. I'm not sure this can happen if I connect the bias driver directly to one of the channels. Do you have any further information that can perhaps help me?

    Thanks,

    Sean

    ReplyDelete
    Replies
    1. Did you find a solution ? I'm also stuck here.. :-)

      Delete
    2. For impedance measurement? For this the bias we found injects a current at a certain frequency, which is based on the sampling rate you've chosen. I think it's 1/4th the sampling rate. Since this brings it quite close to 60 Hz at the lowest sampling rate, you need to turn off acquisition, and perform the impedance measurement, and then continue acquisition. The other option we found was to acquire signals at a significantly higher sampling rate, whilst also injecting a current through the bias of a known frequency, and using the FFT to determine the impedance.

      Delete
  8. Where can i get the PCB files I would like to make one myself. Thanks in advance. I wouldn't mind to buy a soldered version as well.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Activating Roku can be easier when user is using activate roku link where all basic and advanced requirements are expalined in simple and effective way.

    ReplyDelete
  11. enter avg retail activation code to install and activate your avg antivirus software instantly.to download avg visit : avg.com/retail

    ReplyDelete
  12. Roku provides the simplest way to stream entertainment to your TV. With thousands of available channelsvisit here for more details www.roku.com/link visit here

    ReplyDelete
  13. Webroot Mobile Security is a multi client permit enabling you to utilize your permit on up to 3 gadgets. On the off chance that you are utilizing the www.webroot.com/safe most extreme number of gadgets you should uninstall from the old gadget preceding introducing on the new gadget

    ReplyDelete

  14. mcafee antivirus is commonly used aantivirus distinguishes and kill PC contamination, the mail worms,the trojan programs,and in like manner empowers your structure to free of disease and other malware is a noteworthy consistently challenge. for more nuances visit : here for more subtleties www.mcafee.com/activate visit here

    ReplyDelete
  15. Roku is a streaming device, which is a reasonable roku setup and other Set-up Box. Roku is a bundle of amusement, where client can stream for boundless roku activtion code motion appears, web arrangement, news, animation and a lot more projects.

    ReplyDelete
  16. Activate Roku.com/link, go to www.roku.com/link account activate roku displayed on Roku TV. My roku com link not working use new Roku code

    ReplyDelete
  17. Avg is a well- known name in the field of virus protection. The reason for which this name is common among all end users is its free www.avg.com/retail antivirus and malware protection.It not only sounds avg.com/retail free but it provides a lot more with no money. It scans for virus and malware

    ReplyDelete
  18. norton setup offers a fee-based suite of antivirus products which provide various malware detection method. User can protect their devices by regularly scanning the computer with Norton antivirus.norton setup product key anti-virus suite uses virus definitions, suspicious behavior, emulation and the sandbox method to detect viruses

    ReplyDelete
  19. Webroot & Geek Squad have partnered to provide you with excellent PC security protection. Download your antivirus software install webroot with keycode visit here

    ReplyDelete
  20. This information technology job description sample template can help you attract an innovative rootsfile.com and experienced information technology to your company.

    ReplyDelete
  21. On the off chance that you are introducing Mcafee item on different PCs, or have supplanted a PC and need to mcafee activate product key reinstall your McAfee security programming, you may experience issues if Mcafee item key is being used.

    ReplyDelete
  22. Microsoft Office is an application software. It is used in most of the businesses and organizations Install office setup product key on your Pc's to get best advantage of it. mostly used tasks are ms-word, Ms-excel and Ms-powerpoint

    ReplyDelete
  23. Webroot SecureAnywhere AntiVirus is a powerful antivirus that has been created to fight against malwares and other threats. Visit : for . installing webroot activation code more details

    ReplyDelete
  24. Introduce Office course of action 365 with our help. By and by setting up office.com/setup your record will be a cakewalk with us

    ReplyDelete
  25. Norton offers support to install the software on the computer same way we, here at superb support offers premium services to support the user to install Norton and norton.com/setup other antivirus programs and other computer related issues.

    ReplyDelete
  26. McAfee is a leader in online vulnerability protection. McAfee, the device-to-cloud cybersecurity company, provides security solutions that protect data and mcafee.com/activate stop threats from device to cloud using an open, proactive, and intelligence-driven approach.

    ReplyDelete
  27. Visit the Webroot website to download your Webroot antivirus www.webroot.com/safe product and also get Webroot Installation.

    ReplyDelete
  28. I am Been Reading your blog for a lot time i must say its a amazing blog and i found blog to be very informative and helpfull will come back to read more: mcafee.com/activate

    ReplyDelete
  29. Hey there. I found your blog by the use of Google while looking for a comparable subject, your site got here up.It appears to be good. Amazing article written. I usually don't read such articles but your article is just too good.
    roku.com/link | roku activation code | roku link

    ReplyDelete
  30. Wonderful! You did an amazing job! This is really impressive. Having read the article, I found myself unable to resist saying a few words. Thank you! Check out this recent profile on another great site as well. This one is about Click Speed Test - Check Clicks Per Second (CPS Score) Online. Check out these helpful tips.

    ReplyDelete