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):

- 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)
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):

- 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
Last edited: