SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
#216717
Hi, whenever I read voltages from a pin using analogRead() I get a value that is about 85% of the true voltage. The problem appeared when measuring battery voltages in a circuit, resulting in about 4.40 V for a true 5.1 V voltage (which is reduced to fit the 2V range of the ADC)

I'm using a custom board with the Artemis module, but I mounted a small testing circuit with a RedBoard Artemis Nano, getting the same results. The testing circuit applies a constant, 1V voltage to A0, and analogRead() returns 0.83-0.85 V after conversion.
This is the code:
Code: Select all
void setup() {
	Serial.begin(115200);
	delay(10);

	pinMode(A0);
	analogReadResolution(14);
}

void loop() {
	uint16_t meas = analogRead(A0);
	Serial.print(meas); Serial.print(" ");

	float volt = meas * 2.0 / 16384.0;
	Serial.println(volt); 
	delay(1000);
}

The ouput is something like this:
Code: Select all
6900 0.84
For 1V input analogRead() should return something near 8192 for a resolution of 14 bits, not values around 6900.

I tested it with Eclipse, the Arduino IDE and PlatformIO, getting the same results. Using other ADC pin doesn't change anything. The problem persists also when other ADC resolutions are used.
The boards are updated to the last version, 1.1.1 at this moment.

Has anyone encountered the same issue?
Thanks,
David.
#216720
The analogread() is always using ADC slot 0 of the Apollo3 chip, which has an impedance of 720K according to the datasheet. Slot 1 to 7 are not used by design, but they have an impedance 3600M and thus less impact on your circuit. As reference an Arduino has about 100M. You could change the slot in the library file ap3_analog.cpp if you want for test.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]