Teensy 3.0 ADC details

Status
Not open for further replies.
I'm sorry for the late reply. I had some issues with the data being sent from the T3 to the PC (through USB Serial), and so I spent a lot of time trying to debug it and fix it.

Basically, whenever I use Serial.println to send commands, I would notice that (after about 10 mins from startup), the Teensy starts sending crazy values sporadically (every 1000 values or so, it would send minimum or maximum values [0 and some very high number]). I thought that I should send things through Serial.write instead of Serial.print, so I wasted hours implementing that and debugging my bit-shifting code. I found that the fix was to simply restart the T3 (no need for sending as bytes). Pretty lame.


Anyways, so back to the ADC: Thanks a million for the quote from the datasheet (I don't know how I missed that). I'm assuming that 16-bit accuracy is only achieved when using pins A10 and A11 in differential mode only (I tried using single-ended on A10 then on A11, but I got same noisy results as before).


I just need to ask if you can kindly help with the wiring if I'm using differential mode for the ADC:
So, I have an analog accelerometer, with VCC, GND and ZOUT (z-axis analog signal). I have the accelerometer powered by independent battery to 3.3VReg supply (so far, so good). And the T3 is powered by VUSB. (I also remember that I should join the T3's AGND with the accelerometer's supply GND; is that right? Or should it be T3's GND to accel supply GND?)

The actual question: What exactly do I attach to pins A10 and A11 on the T3? I'm guessing the signal pin ZOUT to A10, and then the accel VCC to A11 (I'm only 20% sure).

(of course, all above is assuming I have the caps set up as you kindly mentioned previously)

Finally, there is the fact that I need to look up how to set up the differential pins in code (but, I'll dig around and hopefully learn how).


If differential mode doesn't work out for me, my last chance is averaging...
 
BTW, I absolutely don't mind ditching Arduino IDE if I have to (to access the differential pins). I might still be a noob in plain 'ole C, but I'm willing to try (and my experience in other languages will help). Besides, I've programmed a few ATMega's to blink LEDs and other cool stuff. How hard could it be to program this 32-bit beast of a uController? :p
 
BTW, I absolutely don't mind ditching Arduino IDE if I have to (to access the differential pins). I might still be a noob in plain 'ole C, but I'm willing to try (and my experience in other languages will help). Besides, I've programmed a few ATMega's to blink LEDs and other cool stuff. How hard could it be to program this 32-bit beast of a uController? :p

No need to drop the IDE, you just have to start addressing the pins in a more direct fashion. On another page here I have started a thread re: how to get to differential measurements - I have yet to have the time to actually make measurements but I think I have the code down.

As a start, see the programming guide for the K20, it's pretty long (1227 pages) and the ADC details, how it works, etc. can be found in the p 600 range. I'd print it and read it a couple of times. There is a lot of data there in a very dense and not so easy (for a ME!) to follow format. Then have a look at my attempt to read differentially on A10-A13.

As for the wiring, I will have to look at that later - right now I have to get ready for work and won't be back until later tonight. Please also note my re-write further up - your 32k source impedance may be problematic after all. Cheers!
 
You can use the ADC in single-ended mode - no need for differential operation - in order to achieve 16 bits. You will have to be careful in the wiring, however, to achieve good results in order to avoid common-mode noise.

For example, if there is a reference ground on the accelerometer, then that's what I'd connect to the AGND. If it doesn't have that, you'll have to connect the GND of the accelerometer to the AGND on the Teensy for there to be a good connection. The 0.01uF capacitor would then span from A10 or A11 to AGND. In single-ended mode, arguably the quality of the power supply going into the AREF pin is more important. Thus, I'd plan on using an external precision series reference like the LM4132 series to provide the AREF pin with a nicely controlled source of power. You may even be able to supply the accelerometer with power from the same power supply (which is how I am using it for my AD8137 op amp and CdS light cell) - in my case, I am supply 3.3V, which is the same as the Teensy supply voltage. Just different power sources.
 
so I tried single-ended mode like you said above (but without a reference voltage source; I'm using a standard 3.3V regulator for AREF). I'm still getting noise (using all the capacitors and AGND etc).

It seems it's either that the AREF needs a decent reference source, or the only way to get accurate data with 16bits is in differential mode (or the ADC is just not good enough).

I'll try to get a decent voltage reference (I can't find the LM4132 in a non-SMD packaging like TO-92 or something). I did find a TL431B with .4% voltage tolerance. Do you think it will be good enough?
 
Hi basheersubei,

Looking through the stuff that Digikey offers, the LM4040AIZ-2.5/NOPB seems like a good candidate for you - through-hole, TO-92, etc. - and it's 0.1%, i.e. a whole order of magnitude better than the AREF reference specification. It's 1.75 ea, but seems like something worth trying. The only thing to watch out for is the resistor calculation since this is a shunt, not a standalone series reference.
 
Maybe my comment is misplaced, but what is the exact requirement that makes you think you need 16-bit accuracy and 2000 samples/sec for your project ?
The internal reference can be user-trimmed around 0.3% maximum deviation, and it's probably going to be as good as what you can do using an external ref.

I don't mean your efforts are misdirected, still in many cases the signal conditioning (using right impedances/cables/caps etc. and averaging) is likely to play a bigger role. Also note that your Serial.println() can disturb your process if you don't rely on interrupts. And that there likely is some power-down mode allowing to turn off the CPU (and the noise it generates) during conversion, like the ATmega328 has. But I don't know for sure how it works for Teensy3, likely you'll need to dive in to the 1000 page documentation ...
 
Thanks for the comment. I need to get 0.1mg resolution data (@ 1000samples/sec) from an accelerometer for my project. Since I couldn't find any accelerometers with ranges smaller than +/- 1g, I need a lot of resolution on the ADC to achieve 0.1 mg resolution.

But I gave up on this particular way (T3 ADC) because I found a digital accelerometer that gives 16-bit resolution data through I2C (and it's relatively clean). The noise level on it is also decently low. My biggest problem was getting that accelerometer on a board (it was one of those tiny LGA-16 SMD chips)...
 
Jumping in this thread cause it seems the most related.

If one uses the internal reference of 1.2V, do you have to be careful of going above 1.2V? And do you essentially get some increased gain, by lowering the voltage range that you are slicing up into bits? And is the 1.2V better maintained than the 3.3V?
I forgot about the internal, so I'll have to try that tonight. I am able to see some intermittent noise pretty clearly at 44kHz (which seems to be power-related).

I was going to order one of these that constantin suggested: http://ca.mouser.com/ProductDetail/...GAEpiMZZMuBck1X%2b7j9fFxOFMTVQaIHwa28E8U1SlI=
And would I benefit from supplying a regulated 3.3V even if the teensy3 is not powering anything else?

Or might it be good enough to provide battery power to the VIN, and put a cap (what would be a good value?).
 
Jumping in this thread cause it seems the most related.

If one uses the internal reference of 1.2V, do you have to be careful of going above 1.2V? And do you essentially get some increased gain, by lowering the voltage range that you are slicing up into bits? And is the 1.2V better maintained than the 3.3V?
yes and yes. And 1.2 is normally more stable than 3.3, but it may have a static offset (die tolerance).
I was going to order one of these that constantin suggested: http://ca.mouser.com/ProductDetail/...GAEpiMZZMuBck1X%2b7j9fFxOFMTVQaIHwa28E8U1SlI=
And would I benefit from supplying a regulated 3.3V even if the teensy3 is not powering anything else?

Or might it be good enough to provide battery power to the VIN, and put a cap (what would be a good value?).
Probably more important than all this is the quality and length of your wires. And the way you connect the grounds and signals. Use the analog ground on Teensy3. There are already caps on board, but adding a 10uF and 0.1uF on the 3.3V supply can never hurt.
 
Last edited:
Some small details for the Teensy 3.0:

The internal reference is 1.2V, can be read with analogRead(39). The internal reference may be chosen with analogReference(INTERNAL), analogReference(INTERNAL1V1), analogReference(INTERNAL1V2) or reset to external with analogReference(DEFAULT) or analogReference(EXTERNAL)

Teensy 3.0 differs from the hints given on https://pjrc.com/teensy/adc.html .
 
Hi Dave,

did you experiment with the stability of the internal reference with the temperature and the power supply ?
 
Status
Not open for further replies.
Back
Top