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/

84 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. Students who encounter trouble with completing their nursing assignment writing service and book report writing service can contact our company as we have expert writers in the field.

    ReplyDelete
  10. Ensuring our clients get 100% Already Written Essay Writing Services is one of the strategies we have adopted in becoming the best provider of do Literature Review Service in the industry.

    ReplyDelete
  11. office setup provide different and amazing sort of applications like Excel, PowerPoint, Word, Outlook etc.Get started with office setup at activate office

    ReplyDelete
  12. Activate your Mcafee antivirus by going through with mcafee activate product key. Mcafee Antivirus helps the user protect your data from harmful malware.

    ReplyDelete
  13. office setup is the best software which is widely used in globe .It is a powerful service that helps you unleash your best ideas , get things done, and stay connected download office 2016 click here for details.

    ReplyDelete
  14. Get started with office setup at office setup product key. It provide ease of working and systematic arrangement of your worksheet.

    ReplyDelete
  15. Mcafee Antivirus helps the user protect your data from harmful malware.Activate your Mcafee antivirus by going through with enter mcafee activation code

    ReplyDelete
  16. Norton antivirus protects your data and important information from getting lost and damaged. Get your norton antivirus installed in your PC today at norton security

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

    ReplyDelete
  18. Norton Antivirus is the best internet security that protects your data and device from being lost and damaged. Get your Norton Products started today. Visit norton antivirus

    ReplyDelete
  19. Norton Setup is easy to install and activate than that of any other internet security. norton install will here provide you easy and quick understanding about Norton.

    ReplyDelete
  20. norton internet security can only work when it has been activated.To activate your Norton Setup, the user is required to Enter 25 digit Norton Product Key.

    ReplyDelete
  21. With download norton user can get the best protection against harmful threats and viruses. Norton setup protects your data and keeps your information private secure.

    ReplyDelete
  22. webroot Antivirus is the best program to protect your device from any threat and virus. Get started with your Webroot Antivirus today at download webroot antivirus

    ReplyDelete
  23. Activate your Webroot Account by entering your Webroot Activation Code. Facing issues…visit webroot install to get easy and quick steps to activate and install webroot with key code.

    ReplyDelete
  24. Protect all your data with Norton subscription. activate norton makes it easy for you to set up your Norton protection, check your security status, and extend your protection to other PCs, Macs, smartphones, and tablets.

    ReplyDelete
  25. To install Norton that you purchased from norton security or from a retail store, you must create a Norton account or add the purchased product to the existing account.

    ReplyDelete
  26. Roku provides the simplest way to stream entertainment to your TV. On your terms. With thousands of available channels to choose from.
    activate roku link

    ReplyDelete
  27. 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
  28. Mcafee Antivirus has recognized to be an effective way of keeping up your devices and your data safe from getting infected by any hackers and virus attackers. mcafee activate product key will help the user to get easy support.

    ReplyDelete
  29. Visit install mcafee with activation code to activate mcafee security. Enter your product key code present on your McAfee retail card, login and get protected.

    ReplyDelete
  30. McAfee Antivirus is the most trusted and preferred software. To get the benefit of it the user id recommended to enter mcafee activation code to their device and activate McAfee for complete use of it.

    ReplyDelete
  31. enter Roku activation code and sanction your roku gadget. Contact for Support if standing up to any issue. roku.com/link Find support with game plan and exploring, find answers to record and charging questions, and make sense of how to use your Roku device.

    ReplyDelete
  32. Go to Roku page record enter Roku com association code appeared on Roku TV. roku.com/link My Roku com associate not working use new Roku code.

    ReplyDelete
  33. Do you want to set up hulu antivirus in your computer then click here hulu.com/activate for more details.

    ReplyDelete
  34. On the off chance that you need to reinstall office or fix it, you can reverify your item key on setup page Office.com/setup and can download more established form of office

    ReplyDelete
  35. mcafee activate have without a doubt the course of action of highlights which can ensure your electronic on the webMcafee.com/activateand isolated nearness of the getting ready contraptions, and it causes you secure it similarly as it can keep up the power of your PC.

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

    ReplyDelete
  37. To activate office setup you need to visit Office.com/setup Sign in, create new account,

    ReplyDelete
  38. To introduce or download any item on any gadgets, for example, verify key online PC, mobiles and so on, you have to have a confirmation key.

    ReplyDelete
  39. On the off chance that you need to reinstall office or fix it, Office.com/setup you can reverify your item key on setup page and can download more established form of office

    ReplyDelete
  40. Webroot is a best-known antivirus software protects your devices against phishing, webroot.com/safe ransom attacks, viruses and malwares. visit here for more details : URL , It can keep your data, files and essential information safe and also scan your files against online threat.

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

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

    ReplyDelete
  43. McAfee empowers relationship to mastermind a truly planned computerized condition that at the same time guarantees, Mcafee.com/activate recognizes and redesigns security risks. For customers, McAfee guarantees your contraption at home and abroad from contaminations, malware and various perils.

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

    ReplyDelete
  45. Roku gives the least complex approach to stream excitement to your TV. roku.com/link On your terms. With a great many accessible channels to look over.

    ReplyDelete
  46. The Roku Channel is your home for nothing and premium , anyplace you go. Stream many hit films, famous shows, roku.com/link all day, every day live news, and more for nothing. Effectively include and oversee Premium Subscriptions like Showtime, Starz, and Epix with one login, one bill, and one spot to stream them all.

    ReplyDelete
  47. 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
  48. 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

  49. 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
  50. norton web security is generally utilized antivirus gives the least demanding to utilize and most intutive assurance for your PC and your mobiles .introduce it and disregard viruses,spyware,root-units, hackers.for more subtleties visit: www.norton.com/setup today

    ReplyDelete
  51. Accomplish more with OneDrive and Office 365 Create cleaned reports, open bits www.office.com/setup of knowledge, present with lucidity, and work together continuously utilizing Office 365

    ReplyDelete
  52. Go to Roku page record enter Roku com association code appeared on Roku TV. My Roku com associate not working roku link code use new Roku code.

    ReplyDelete
  53. 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
  54. 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
  55. 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
  56. 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
  57. An office.com/myaccount gives you authorization and full support to access all the office setup product key advanced features and services of Microsoft Office.

    ReplyDelete
  58. mcafee antivirus is generally utilized aantivirus recognizes and kill PC infection, the mail worms,the trojan programs,and likewise enables your framework to free of mcafee 25 digit activation code infection and other malware is a significant day by day challenge. for more subtleties visit:

    ReplyDelete
  59. McAfee inception with Mcafee antivirus gives all-around protection blocking all the mcafee activate product key bothersome perils, malware disease which can hurt your PC

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

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

    ReplyDelete
  62. roku.com/link this is simplest way to stream entertainment to your TV. On your terms. With thousands of available channels to choose from for more detils activate roku visit here

    ReplyDelete
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. Visit the Webroot website to download your Webroot antivirus www.webroot.com/safe product and also get Webroot Installation.

    ReplyDelete
  70. Roku.com/link is the free official site to connect, enact and set-up your Roku player or Roku TV. Roku never charges www.roku.com/link for connecting or set-up help.

    ReplyDelete
  71. 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
  72. I am really very happy to visit your blog. Very powerful and have true and fresh information. Thanks for the post and effort! Please keep sharing more such a blog.
    mcafee.com/activate | mcafee login | install mcafee with activation code

    ReplyDelete
  73. 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
  74. Your post is very helpful.. this is a great thought against content of wrighting…very informative and usefull…
    drawing | nature drawing | scenery drawing |how to draw flawers

    ReplyDelete
  75. Microsoft Outlook offers its users the freedom to create their own personalized signature in the mails they are used to send one another. If this interest you feel free to visit our blog to know how to add signature in Outlook.

    ReplyDelete
  76. As the schools, colleges, and offices are closed, and people are unable to go outside due to lockdown the trend of online gaming is at its peak but most of the game comes with a hefty price tag. This is why people are looking for free online games. If you are the same then visit our blog about Top 10 Free online games.

    ReplyDelete
  77. One of the most common errors, HP printer user might face while using it is the HP printer offline. To know more about how to resolve this error visit our blog HP printer Offline.

    ReplyDelete
  78. If one is using an HP device than he definitely knows that one can print from anywhere from there HP Smart App a new feature comes with HP Printer. To know more about this please visit us at how to Install HP Smart App.

    ReplyDelete
  79. 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