R4 Wifi board A0 and A1 weird behavior

Hi,

I’m having trouble reading values from a potentiometer (should be the easiest thing ever)

Setup : 1 potentiometer, left and right pins to 5v and gnd on the board, and middle pin connected to A0.

Here is the code :

int pot1;

void setup() {
  Serial.begin(9600);
}

void loop() {
pot1 = analogRead(A0);

Serial.print("pot1 ");
Serial.println(pot1);
Serial.println(" ");

delay(500);
}

When turning the potentiometer the voltage goes from 0.04 to 1.5v (with my voltage meter) in the meantime the serial monitor displays an instable value from 125 to 472

I tried with A0 disconnected, the voltage goes from 0 to 5 so the potentiometer is working as espected.

Same problem with A1. But other analog pins are fine.

I noticed that A0 and A1 are shorted to ground when the board is unpowered, which is not the case with A2 A3 A4 A5

What is going on ?

Connect 3.3V-point with A0-pin and try this sketch and see what comes on the Serial Monitor. My UNOR4 WiFi works well.

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  float testVolt = (5.0 / 1023) * analogRead(A0);
  Serial.print("Test volt: ");
  Serial.print(testVolt, 1);  Serial.println(" V");
  delay(1000);
}

Ouput:

Test volt: 3.4 V
Test volt: 3.4 V
Test volt: 3.4 V

Test volt: 1.7 V

My voltmeter shows 3.300 V though

Please connect 3.3V from the UNO R4's header pin with A0-pin and then upload the sketch of #2.

That’s exactly what i did

Also the 5 V from the board is 4.7 V, even at no load (pot disconnected)

Post what has appeared on the Serial Monitor.

1 Like

Keep connection between 3.3V-point and A0-pin. Now, measure the voltage between A0-pin and GND-pin using DVM. What does DVM show?

3.301 V as expected

The problem comes from inside the R4 board

Keep connection between 3.3V-point and A0-pin.

Keep connection of DVM between A0-pin and GND-pin.

Connect A1-pin with GND-pin..

What does DVM show?

Check the voltage on the AREF pin. It should be a steady 5V.

3.3 V, it hasn’t changed

It’s not

4.7 V, same as the “5v pin” voltage

Sorry!
While grounding A1-pin, measure voltage between A1-pin and GND-pin by DVM. What does DVM show? Also measure voltage between A0-pin and GND-pin. This is to verify if A1 and A0 are shorted or not.

Well obviously 0 V as both are connected now

1.54 V. Your code is still running and telling me 0.9 V

Just to be sure the internal reference is set correctly, add the following to setup

analogReference(AR_DEFAULT);

When A1 is not shorted to GND, you got 3.3V on A0-pin. Now, we have got a clue that the there is a problem involving A1 and A0.

It hasn’t changed anything

Well, I think @GolamMostafa has done just about any test you can think of, maybe your board is actually bad.
Is it a Genuine Arduino R4 WiFi?

It is

Damn this is driving me insane, 2 whole days for a potentiometer value…

Do you know if arduino easily refund people with defective boards ?