Low-noise sampling from electromyography amplifier in a multitasking teensy 3.

Status
Not open for further replies.

Piero

Member
Hello everyone,

TL;DR: How to use a LM431 (or something else ?) properly to get a 3.3V stable AREF, and some other questions.

I'm currently prototyping a circuit using a Teensy in the context of a neuroscience experiment, I have a computer that runs a cognitive task, and I will use the teensy for the following things:
- Measure display luminance with a TEMT6000 phototransistor (datasheet) in a corner of the computer monitor showing the task to the subject, to have precise timing of the main task events (the task will flash something in this corner of the screen).
- Send strobed digital events (16-bit words, using two 8-bit shift registers) to a neurophysiology acquisition device, to sync the task events (which onsets are detected as described above) to the neurophysiological data file.
- Open and close a solenoid valve (12V) that is used to give liquid reward to the subject.
- Additionally, I want to use the teensy to sample analog signals coming from an electromyography amplifier/filter. The amplifier has a "signal conditioner" unit (datasheet), which allows me to output a signal that is ADC-friendly: I can offset the signal by 1.15V, and set clippings at 0 and 3.3V (data sheet says 4V, but it goes lower). I can then adjust the gain to avoid clipping of the signal.

I have tested everything on a breadboard and it seems to work, as does my programs to exchange data between the cognitive task program and the teensy (the 4-channel EMG data is sampled and streamed to the computer at 2KHz –I can set a 1KHz low pass filter on the EMG amplifier). For now I've only tested the EMG by connecting directly the output of the conditioner to analog input pins and the AGND, without setting an AREF.

Now I am in the process of designing a PCB that will fit all this nicely, and I would like to have input on how to minimize noise contamination between the different parts, and particularly to the EMG digitization . Here is my schematic (all connectors will be BNC connectors, except the digital out which is dsub 37):

Capture d’écran 2013-09-12 à 12.13.47.png

- I've read in multiple posts that a voltage regulator on AREF is a nice addition, but I'm still a bit confused on how to use it correctly (and without doing any modification to the teensy board). I've added a LM431 voltage regulator in my schematic, but I'm not sure… will this work, and will I get a 3.3V reference or lower ? I can't really afford to have AREF much lower than 3.3V because my signal conditioner clipping is right around 3.3V. I also already have 3.3V zener diodes (the kind with an envelope made of glass) would putting one between AREF and GND work, what is the advantage of the LM431 ?
- If I use the LM431, should the Vin to the TEMT6000 be AREF or should I keep 3V3 as in the schematic ?
- Do you have suggestion on how to do ground planes ? I will order double-sided PCBs, and intended to have 3 pairs of separate ground planes, one for the 12V reward system, one with the GND, and one with the AGND.
- Do you have any general comment on the schematic, about things to improve, obvious errors, etc (I'm just a biologist !) ?
- For now I'm not using interrupts to take measures of the EMG signal, and it works well enough, except when the teensy receives a large amount of data through USB serial. I guess it's a bad solution to send serial data when inside the interrupt since my serial communication depends on nicely formatted packets. Is there some example code on how to handle this situation properly (like filling a buffer in the interrupt), and sending the data in the loop() function ?

Thank you ! (especially if you read this long post till the end)
 

Attachments

  • Capture d’écran 2013-09-12 à 11.14.43.png
    Capture d’écran 2013-09-12 à 11.14.43.png
    51.7 KB · Views: 292
Last edited:
I won't comment on the electrical stuff, but usually you'll want a 10-15Hz High-Pass Filter. Since it goes down to DC, you'll have quite a bit of DC drift in your signal. Also, if you aren't aware, you'll often get EKG interference in your EMG signals.
 
I won't comment on the electrical stuff, but usually you'll want a 10-15Hz High-Pass Filter. Since it goes down to DC, you'll have quite a bit of DC drift in your signal. Also, if you aren't aware, you'll often get EKG interference in your EMG signals.

Thanks for the EMG tips ! The amplifier/conditioner does includes analog high-pass and low-pass filters, but if there is drift in the digitized data, I can offline filter it without problems. I'll look out for the EKG (and read how to get rid of it if it shows up).

No ideas on this analog reference problem ?
 
Last edited:
Better to use an analog filter, cause the drift can take all of your digital resolution, or hit the rails of the amplifier/ADC.

The EKG interference will typically increase depending on EMG location & fat composition increasing EKG conduction.

Several options to remove EKG interference. If you are recording multiple EMG channels you can use something like Independent Component Analysis (ICA). You could record a separate EKG channel and use something like a Least-Mean-Square (LMS) adaptive filter. The higher your high-pass filter, will also reduce it.
 
Any idea on this ? Especially about the LM431, I'm still not sure about this...

The 431 would be an external reference, why do you feel you need that? You can certainly use the Vcc 3.3V that is available on the T3 board, unless it's too noisy or inaccurate for it.
Have you tried using the 3.3V signal? It will have some digital switching noise, but you should try that first, then go to an external reference if you need it. Not sure I would use a 431 these days,
there are far better solutions, same goes for the 3.3V zener. The best accuracy you can get with the zener would be 5% ....and you can do better with the T3 Vcc line.

You will certainly want some filter caps on the inputs to your ADC pins, not knowing what your sensor inputs look like, but I would start with maybe .01uf ceramic X7R caps and go up or down from there......
Ground planes are pretty easy, you just flood all the area that is not taken with copper. If you group all the analog together, you probably don't need a separate plane. You generally want to connect separate planes ( if you decide to go that route) at the ADC.
Tim
 
- Do you have suggestion on how to do ground planes ? I will order double-sided PCBs, and intended to have 3 pairs of separate ground planes, one for the 12V reward system, one with the GND, and one with the AGND.
There is a pretty good paper by Analog Devices at http://www.analog.com/library/analogdialogue/archives/43-09/edch 12 pc issues.pdf
It's a bit dated, but good analog practices never go out of date.
Note that you can do a good ground plane with a two sided board.
Tim
 
Oh yeah...one last bit of advice.
Put in an LED in your design.
You can blink it for debugging and to know if your circuit is alive.
Also you can hook a scope to it for measuring timing on critical parts....if you have any of those.
Tim
 
Thanks for the tips, and the link for good practices. I will definitely add some LEDs for debugging, as well as some holes for filter caps.

About the external voltage reference, I was looking towards the 431 after reading some posts on this forum, namely those:
http://forum.pjrc.com/threads/23516-ARef-input-impedance-Other-considerations
http://forum.pjrc.com/threads/23585-AREF-is-making-me-lose-my-hair

…but I'm still confused about this ! Seeing these posts, it seems that using Vcc isn't recommended because of the switching noise. What would be the simplest (by that I mean without external power) way to have a clean 3.3V external reference in your opinion then ?
 
Status
Not open for further replies.
Back
Top