Pages: [1]   Go Down
Author Topic: AREF Voltage  (Read 1152 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an adxl320 which I have hooked to my diecimila.  The diecimila is powered by usb, therefore VCC and AVCC are 5V. (right?).  My adxl320 is powered seperately by a 3.7v LiPo battery.  When I hook the adxl320 X and Y axis to a voltmeter and move it around, I can see a change in V within datasheet limits.  The adxl320 at rest is showing 1.87V, which is what I would expect with a supply of 3.7V.  So.........my questions are these:

1. Should I be connecting the AREF pin on diecimila to the 3.7 LiPo for better results?
2. If I do this, will it destroy my diecimila? (I read somewhere that if AREF is set to an internal setting of 2.56V and you put power to AREF external pin then you get problems in the form of a dead chip)
3. If putting 3.7V to AREF is OK, does it need to a ground also and if so, would I connect diecimila ground to the 3.7V LiPo ground? (this doesnt seem right)
4.I'm getting bizarre readings from the ADC when adxl320 is hooked to diecimila.  (not very consistent)  I've read that you may need an op-amp. Is this true?

As you can tell, I'm new to this, but I'm hooked like a junkie.  I wish I was 15 years younger and do college over again.......should've majored in EE.

Thanks a million from a noob !!
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You should read the section in the datasheet about the ADC for details.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.  I did read that before posting, but I didnt completely comprehend it.  I guess I need to know if diecimila ships standard with AREF set to VCC or internal 2.56V.  I dont really know how to check this and I'm hoping someone already knows and can just answer that question for me.  

If it's not set to the internal ref @ 2.56V, then the way I'm reading it, I can hook 3.7V to the AREF and should be good to go.  I'm afraid of BRICKING my diecimila, so I'm going to hold off on that connection until I'm comfortable with the right answer, whatever that may be.

If anybody can answer my previous questions, I'd be gratefull.

I did read another post (a few above my original one) which talked about removing the internal 2.56 VREF.  That raised another question for me.  If it is done with code in the sketch setup(), does that make it permanent or when another (different) sketch is uplaoded, is that undone?  

Thanks for any insight

Steve
Logged

Brazil
Offline Offline
Sr. Member
****
Karma: 0
Posts: 443
..., to learn, to know, to make, to share, to l...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmega168 datasheet says:

Code:
23.5.2 ADC Voltage Reference
The reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Single
ended channels that exceed VREF will result in codes close to 0x3FF. VREF can be selected as
either AVCC, internal 1.1V reference, or external AREF pin.
AVCC is connected to the ADC through a passive switch. The internal 1.1V reference is generated
from the internal bandgap reference (VBG) through an internal amplifier. In either case, the
external AREF pin is directly connected to the ADC, and the reference voltage can be made
more immune to noise by connecting a capacitor between the AREF pin and ground. VREF can
also be measured at the AREF pin with a high impedance voltmeter. Note that VREF is a high
impedance source, and only a capacitive load should be connected in a system.
If the user has a fixed voltage source connected to the AREF pin, the user may not use the other
reference voltage options in the application, as they will be shorted to the external voltage. If no
external voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as reference
selection. The first ADC conversion result after switching reference voltage source may
be inaccurate, and the user is advised to discard this result.

internal 2.56V reference is used in Atmega8, not Atmega168 (that you have in diecimila, right?). Atmega internal reference is 1.1v., or Vcc.

I saw many info here saying internal 2.56v too. I think it's a mistake...

Read this too:
http://www.arduino.cc/en/Reference/AREF
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1142283743

Since I couldn't find ADMUX register programmed in Atmegaboot_168.c or other related files, I think it is unprogrammed. This mean voltage reference is set to:
"AREF, Internal Vref turned off"


So, I think you can just connect 3.7v. directly to AREF pin, but note:
[edit]I found another post, and waiting for an answer to be exact:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1197894369/0#9[/edit]

you must connect both source GNDs. So you'll get both DC source with one reference Ground. You cannot work with two DC source not connecting their GND, because voltage is based in reference and potencial difference, not absolute values. Values read will gone crazy.

I never did this, but reading and reading, I think it's ok.

The datasheet has many info about how to reduce noise too. Take a look.
« Last Edit: January 23, 2008, 09:53:44 pm by adilson » Logged

PCB Designer

Brazil
Offline Offline
Sr. Member
****
Karma: 0
Posts: 443
..., to learn, to know, to make, to share, to l...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

fornzix,

I don't know if you read the other forum.
I'll put here the conclusion.

Before trying to change AREF to external, try to put a capacitor between AREF pin and GND, with Arduino GND and 3.7V LiPo GND connected. Check if values are good enough.

If not, and if you want to try changing the AREF, you must:
1) open ...\arduino-0010-win\arduino-0010\hardware\cores\arduino\wiring.c
search this lines:
Code:
// set a2d reference to AVCC (5 volts)
      cbi(ADMUX, REFS1);
      [glow]s[/glow]bi(ADMUX, REFS0);

change to this:
Code:
     // set a2d reference to AREF
      cbi(ADMUX, REFS1);
      [glow]c[/glow]bi(ADMUX, REFS0);
Save it;
Open IDE;
Upload your sketch.

2) connect Arduino GND to 3.7V LiPo GND;

3) connect 3.7v. to AREF pin.

Don't connect nothing to AREF pin until change the wiring.c, open IDE, and upload sketch.
« Last Edit: January 24, 2008, 11:15:47 pm by adilson » Logged

PCB Designer

0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Adilson.  I actually got my lilypad working finally.  (TX and RX traces on Lilypad must be crossed)  The Lilypad will operate on 3.7V, so I used the same 3.7V LiPo power source for the Lilypad and the ADXL320.  I used the same exact sketch with the Lilypad and and the numbers looked much better and very stable.  0G = 512, which is what I would expect.  +1G was 577 and -1G was 449.  It was very consistent with these numbers, whereas the Diecimila was erratic and bouncing all over the place even while sitting still.  SO..........I think there is something to be said about using a consistent power source V.  I am going to try your recommendation about using the 3.7V on AREF and when I do, I'll post back here to let everyone know if it produces the same results as I saw with the Lilypad.

Thanks again for your insight.
Logged

USA
Offline Offline
Sr. Member
****
Karma: 0
Posts: 452
Freeduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ADXL3xx output impedance is 32k, atmega168 expects 10k or less.  This means that if the acceleration value is changing rapidly, you will read inaccurate values in the ADC.  You need to add an op amp to lower the impedance of the ADXL3xx.  I also used the ADXL3xx always connected directly to the MCU, but even without any movement, the ADC was reading different values all the time and I think it is because every time you read the value in the ADC, it is reporting an inconsistent value because of the impedance issue.  I have not tested with an op amp, but it is something that I have in my to do list for the future.
Logged

Pages: [1]   Go Up
Jump to: