Go Down

Topic: Incorrect AnalogRead values (Read 425 times) previous topic - next topic

MatejB

Sep 28, 2018, 09:38 am Last Edit: Sep 28, 2018, 09:45 am by MatejB
Hello guys,

I have 3 Arduino Due boards and I am receiving incorrect AnalogRead values compared with my multimeter measurement.
Very same symptoms as here
https://forum.arduino.cc/index.php?topic=491339.0

- Same issue on all analog input ports.
- Simple voltage divider scheme (attached my scheme). I am using potentiometer. It is just testing board where on real board instead of potentiometer will be 10k NTC thermistor.
- Serial output only shows 2 values. For 0-0.3V it show 512, for 0.3-3 it is 768 (10bit resolution)
- Board is supplied from my PCs USB port


- In my case it is same on all 3 boards.
- All my boards have desoldered DC jack and ICSP pins. I recieved this boards from colleague in this state. But I don't think it should have some impact.
- What is most strange, I have one clone of Due board from ebay and there same scheme and code works correct. Attached photos of original and clone board.

I tried without success:
- Put 10k resistor between analog pin and GND
- Put 100nF capacitor between analog pin and GND
- Set INPUT_PULLUP

Here is my code

Code: [Select]

#define ReadPin A5

void setup() {
 Serial.begin(9600);
 pinMode(ReadPin,INPUT);
}

void loop() {

 int sensorValue = analogRead(ReadPin);
 Serial.println(sensorValue); //768 or 512
 delay(250);     
}


Thank you for your time!


MatejB

#2
Sep 29, 2018, 10:41 am Last Edit: Sep 29, 2018, 10:57 am by MatejB
This might help you:

http://www.djerickson.com/arduino/due_adc.html


Thank you for this.

Based on your topic I found, that on original boards resistor jumper was set to AREF pin instead of supply 3.3V. So colleague probably forgot to mention me, that I should set reference voltage.

When I shoreted 3.3 pin with AREF, it started to measure values.

Problem solved!

Go Up