Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: ADC offset with GND vs AGND

  1. #1
    Senior Member
    Join Date
    Jan 2013
    Location
    San Francisco Bay Area
    Posts
    644

    ADC offset with GND vs AGND

    Well I was writing up my troubleshooting question and in writing it finally figured out what could be happening. Instead of not posting my question, I thought I'd write it up as a good example of unexpected problems one can have with AGND and GND.

    My original request for help
    -----------------------------------
    I am using an interrupt timer to drive my ADC sampling. I'm using 2 buffers, so that one can be written to sdcard while the other one is still collecting samples.

    I'm at a loss for the behavior I'm seeing. At first I thought it must be my code, but from testing it seems more likely to be something electrical.

    There is a considerable voltage offset depending on which buffer was written to the sdcard.

    At first I tried moving to different pins. Still there.
    If I write known data to the buffers (instead of sampling the pins) in the interrupt, I don't get an offset.
    The offset appears to be different whether I have the pin floating, or connected to AGND, but there is always an offset. If I jumper the 2 pins that I'm sampling, the offset goes away. I assume that implies that there is an actual voltage offset.

    I don't think it's the writing to sdcard, because I would expect it to be more transient, and not the exact length of the buffer.

    What could be the problem?
    -----------------------------------------------

    Ok, in realizing that my reference could be a problem I checked the ground on the sdcard and it was using AGND.

    Switching from AGND to GND and it seemed to fix the offset.

    I was thinking that using digital ground would produce more spurious activity, but not an offset that would last the whole length of my buffer (10 seconds).
    Is it the switching of pins and the sdcard creating the offset? It's difficult to imagine that accessing a different segment of RAM would create the offset.

    Top signal is 50Hz or 100Hz, bottom is 50Hz or 25Hz (1/2 of top). Values on y-axis represent signed int value of ADC.

    Left is known values inserted. (20 seconds with 2 buffers of 10 seconds)
    Middle is everything connected to AGND (40 seconds with 4 buffers of 10 seconds)
    Right is AGND for sampling pins, GND for sdcard (40 seconds with 4 buffers of 10 seconds)
    Click image for larger version. 

Name:	t3_interruptTransfer.jpg 
Views:	197 
Size:	33.1 KB 
ID:	373Click image for larger version. 

Name:	t3_interruptTransferAGND_all.jpg 
Views:	224 
Size:	230.2 KB 
ID:	374Click image for larger version. 

Name:	t3_interruptTransferAGND_separate.jpg 
Views:	187 
Size:	234.1 KB 
ID:	375

    Everything is still noisier than I would have expected, but one problem at a time.

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    706
    Just to clarify... which device are you using (Teensy 2? Teensy 3?) Powered via USB, or separately? Using onboard Vref or not? It's hard to tell what the scale is in your graphs, what is the amplitude of the offset steps in units of ADC counts? What is your ADC voltage reference (eg. what is full-scale?) Assuming you are on a T3, are you using 16-bit mode? Averaging mode on or off?

  3. #3
    Senior Member
    Join Date
    Jan 2013
    Location
    San Francisco Bay Area
    Posts
    644
    Teensy3 w/16-bit mode, averaging off. Same offset seen with averaging, but signal is cleaner.
    Powered via USB.
    I assume I am using onboard Vref. I don't have a separate chip to provide a Vref if that's what you are asking.
    The y-axis values didn't come thru with the downscaling of the image for uploading.
    The pictures are auto-scaled, so it's not very helpful for comparing across.

    The typical offset was 50 to 100 counts when connected to ground. But when I was bringing in an amplified signal, the offset was magnified too.

    I'm attaching a new picture that is a pdf of the amplified signal. You can see the offset occur in the middle. The signals came out a little faint tho.

    test.pdf

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Location
    San Francisco Bay Area
    Posts
    644
    I figured I should update this, since it might be misleading. When I get further along I might test this out again.
    But, my pics were misleading. Altho I was alternating writing buffers, they were the same 2 buffers I was writing over and over again.
    So, the first 2 buffers are accurate, but after that it's just a repeat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •