Adruino M0 PRO ADC issues

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cyrus104
 
Posts: 12
Joined: Sat Feb 02, 2008 7:29 pm

Adruino M0 PRO ADC issues

Post by cyrus104 »

I have purchased 3 M0 PRO's from adafruit and several Zero's. I understand one is made by .cc and the other by .org, which are currently in a trademark legal battle.

My issue is that with he M0 PRO the ADC maxes out at around 1.8 volts showing 4095 steps. At step 4095 for the Zero I get the full 3.3 Volts. I am using the same code on both of them. I have also tried the analogReference(EXTERNAL) command with the ARef pin connected to the 3.3volt source.

I figure that I'm doing something wrong between the two board because all the M0 PRO's act alike and all the Zero's act alike.

Example:
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
analogReadResolution(12);
// analogReference(EXTERNAL);
}

void loop() {
// read the analog in value:
Serial.println(analogRead(A0));
delay(2);
}

Thank you for the support.

User avatar
cyrus104
 
Posts: 12
Joined: Sat Feb 02, 2008 7:29 pm

Re: Adruino M0 PRO ADC issues

Post by cyrus104 »

After running several more Google searches I finally found a solution but I am sad that it's not documented any better.
After inspecting the file, I realized that the EXTERNAL value is no longer an option when working with the M0 and the analogReference() function. The new values are AR_INTERNAL, AR_EXTERNAL and AR_DEFAULT. After using analogReference(AR_DEFAULT) in the Setup() function everything worked fine and the reading coming from the ADC were ok.
Hope this helps others too.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adruino M0 PRO ADC issues

Post by adafruit_support_mike »

Good find. Thanks for posting it!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”