Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Apparent non-linear output from ADC

Apparent non-linear output from ADC

2012-10-26 by Dave McLaughlin

Hi all,

 

I have an ATMEGA32 and I am using the ADC to measure the power supply that
is connected to the device.

 

Having done a similar thing with other processors, I am stumped by what I am
seeing with the AVR device.

 

I have a potential divider on the input so that I can measure up to +32V

 

I have a 10K resistor to ground with a 56K resistor in series with the +
supply I want to monitor. The ADC in the datasheet suggest an input
resistance of 10K is the ideal load.

 

When I measure and do a calibration of the ADC at +24V I get a good reading.
I now set the supply to +12 and I get a reading of +1V above this.

 

I am busy taking readings to see if the readings are linear.

 

The ADC ref is a nice clean +5V from the supply (I am assuming ratiometric
on my design)

 

 

Has anyone any clues to why I am seeing this from the ADC?

 

Cheers

Dave.

 

---

Very funny Scotty, now beam down my clothes.

---

 



[Non-text portions of this message have been removed]

Re: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by Jim Wagner

How have you supplied AVcc? What are you using for reference? Does the reference have a bypass capacitor?

Jim Wagner
Oregon Research Electronics
On Oct 26, 2012, at 8:03 AM, Dave McLaughlin wrote:

> Hi all,
> 
> I have an ATMEGA32 and I am using the ADC to measure the power supply that
> is connected to the device.
> 
> Having done a similar thing with other processors, I am stumped by what I am
> seeing with the AVR device.
> 
> I have a potential divider on the input so that I can measure up to +32V
> 
> I have a 10K resistor to ground with a 56K resistor in series with the +
> supply I want to monitor. The ADC in the datasheet suggest an input
> resistance of 10K is the ideal load.
> 
> When I measure and do a calibration of the ADC at +24V I get a good reading.
> I now set the supply to +12 and I get a reading of +1V above this.
> 
> I am busy taking readings to see if the readings are linear.
> 
> The ADC ref is a nice clean +5V from the supply (I am assuming ratiometric
> on my design)
> 
> Has anyone any clues to why I am seeing this from the ADC?
> 
> Cheers
> 
> Dave.
> 
> ---
> 
> Very funny Scotty, now beam down my clothes.
> 
> ---
> 
> [Non-text portions of this message have been removed]
> 
> 



[Non-text portions of this message have been removed]

RE: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by Mauro Zanin

Ciao
test the reference for stability. I use reference generator diodes, very stable and decoupling it from DC source.
 

Mauro Zanin
Logic Data

> To: AVR-Chat@yahoogroups.com
> From: wagnejam99@comcast.net
> Date: Fri, 26 Oct 2012 08:49:04 -0700
> Subject: Re: [AVR-Chat] Apparent non-linear output from ADC
> 
> How have you supplied AVcc? What are you using for reference? Does the reference have a bypass capacitor?
> 
> Jim Wagner
> Oregon Research Electronics
> On Oct 26, 2012, at 8:03 AM, Dave McLaughlin wrote:
> 
> > Hi all,
> > 
> > I have an ATMEGA32 and I am using the ADC to measure the power supply that
> > is connected to the device.
> > 
> > Having done a similar thing with other processors, I am stumped by what I am
> > seeing with the AVR device.
> > 
> > I have a potential divider on the input so that I can measure up to +32V
> > 
> > I have a 10K resistor to ground with a 56K resistor in series with the +
> > supply I want to monitor. The ADC in the datasheet suggest an input
> > resistance of 10K is the ideal load.
> > 
> > When I measure and do a calibration of the ADC at +24V I get a good reading.
> > I now set the supply to +12 and I get a reading of +1V above this.
> > 
> > I am busy taking readings to see if the readings are linear.
> > 
> > The ADC ref is a nice clean +5V from the supply (I am assuming ratiometric
> > on my design)
> > 
> > Has anyone any clues to why I am seeing this from the ADC?
> > 
> > Cheers
> > 
> > Dave.
> > 
> > ---
> > 
> > Very funny Scotty, now beam down my clothes.
> > 
> > ---
> > 
> > [Non-text portions of this message have been removed]
> > 
> > 
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 
 		 	   		  

[Non-text portions of this message have been removed]

RE: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by Dave McLaughlin

Hi Jim,

I have an inductor in series with the main 5V supply with a 0.1uF cap either
side of the inductor so there is a bypass on Vref. I use this same exact
setup with the isolated ADC I also have on the design and any other design I
use and it works well. AVcc is fed from the same point.

I don't have a stable reference as I need ratiometric measurement. 

Dave...
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Jim Wagner
Sent: 26 October 2012 22:49
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] Apparent non-linear output from ADC

How have you supplied AVcc? What are you using for reference? Does the
reference have a bypass capacitor?

Jim Wagner
Oregon Research Electronics

Re: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by Jim Wagner

That should be good, then.

Jim Wagner

On Oct 26, 2012, at 9:37 AM, Dave McLaughlin wrote:

> Hi Jim,
> 
> I have an inductor in series with the main 5V supply with a 0.1uF cap either
> side of the inductor so there is a bypass on Vref. I use this same exact
> setup with the isolated ADC I also have on the design and any other design I
> use and it works well. AVcc is fed from the same point.
> 
> I don't have a stable reference as I need ratiometric measurement. 
> 
> Dave...
> 
> -----Original Message-----
> From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
> Of Jim Wagner
> Sent: 26 October 2012 22:49
> To: AVR-Chat@yahoogroups.com
> Subject: Re: [AVR-Chat] Apparent non-linear output from ADC
> 
> How have you supplied AVcc? What are you using for reference? Does the
> reference have a bypass capacitor?
> 
> Jim Wagner
> Oregon Research Electronics
> .
> 
>  
> 



[Non-text portions of this message have been removed]

Re: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by David VanHorn

There are a number of possibilities.
10k is not the ideal source impedance, it is the maximum recommended
source impedance. Lower is better.
The I/O pins on most AVRs can have up to 1uA leakage to VCC or GND. (see above)
The internal AREF voltages on the AVRs are not very accurate. See
device spec sheet, +/- 0.1V isn't unusual.
Clocking the converter too fast or too slowly can cause problems.
Noise on the analog input is a problem. Low pass filters are your
friend, as this is a sampling ADC. It takes a snapshot of the voltage
at a particular moment.  You may also be aliasing in some ripple or
other noise by using a sampling rate that is very close to some noise
component.
Changing references and then converting before the ref has time to
stabilize can be a problem.
Not having bypassing on AREF, or any/all of the VCC/AVCC pins.
Not connecting ALL GND pins.
Clocking the chip too fast.
Using the low power crystal oscillator.

Measure your reference voltage and the input voltage to the chip at
the chip pin, and make sure they are what you think they should be.
It may be that the chip is telling you exactly what is going on.   :)

Re: [AVR-Chat] Apparent non-linear output from ADC

2012-10-26 by John Samperi

At 02:03 AM 27/10/2012, you wrote:
>When I measure and do a calibration of the ADC at +24V I get a good reading.
>I now set the supply to +12 and I get a reading of +1V above this.

One of the things that can trip you can be the internal pull up resistor
being inadvertently enabled.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

RE: [AVR-Chat] Apparent non-linear output from ADC

2012-10-27 by Mauro Zanin

i use M32 to control a professional Epilator. It doesn't need a very linear Voltage control. But the project works fine at least since 4 years ago and was ported from a M16 pjt 5 years older.


Mauro Zanin

To: AVR-Chat@yahoogroups.com
Show quoted textHide quoted text
From: microbrix@gmail.com
Date: Fri, 26 Oct 2012 16:19:16 -0600
Subject: Re: [AVR-Chat] Apparent non-linear output from ADC
















 



  


    
      
      
      I don't remember offhand if the M32 has the option to turn off the

digital functions on analog pins, but that may be another source of

error.



    
     

    
    






   		 	   		  

[Non-text portions of this message have been removed]

RE: [AVR-Chat] Apparent non-linear output from ADC

2012-10-27 by Dave McLaughlin

Thanks to all for your help.

 

Based on the information below from David about the source impedance, I
changed the resistors for a 1K and 5K6 to lower the input impedance seen by
the ADC and now I get accurate readings from the system.

 

I do quite well with a lot of my projects but sometimes it just needs that
second or third eye to look over the design.

 

Cheers guys and have a good weekend.

 

Dave.
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of David VanHorn
Sent: 27 October 2012 01:12
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] Apparent non-linear output from ADC

 

  

There are a number of possibilities.
10k is not the ideal source impedance, it is the maximum recommended
source impedance. Lower is better.
The I/O pins on most AVRs can have up to 1uA leakage to VCC or GND. (see
above)
The internal AREF voltages on the AVRs are not very accurate. See
device spec sheet, +/- 0.1V isn't unusual.
Clocking the converter too fast or too slowly can cause problems.
Noise on the analog input is a problem. Low pass filters are your
friend, as this is a sampling ADC. It takes a snapshot of the voltage
at a particular moment. You may also be aliasing in some ripple or
other noise by using a sampling rate that is very close to some noise
component.
Changing references and then converting before the ref has time to
stabilize can be a problem.
Not having bypassing on AREF, or any/all of the VCC/AVCC pins.
Not connecting ALL GND pins.
Clocking the chip too fast.
Using the low power crystal oscillator.

Measure your reference voltage and the input voltage to the chip at
the chip pin, and make sure they are what you think they should be.
It may be that the chip is telling you exactly what is going on. :)



[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.