[solved]Unexpected analog read for voltage when using 3.3V input

Hello,

I have a simple setup to measure voltage:

circuit img

Math:

R1 = 220 Ohm
R2 = 1000 Ohm
power supply = 3.3V

I = 3.3/(220 + 1000) = 2.7mA
V1 = I220 = 0.6
V2 = I
1000 = 2.7

By using digital multimeter I do get the expected values:
V1= 0.6 and V2 = 2.7 and the circuit is 3.3

For coding I am using visual code with PlatformIO but I tested in sketch too with same results.

#include <Arduino.h>

int readPin = 3;
int readVal = 0;
float v2 = 0;
int delayTime = 500;
float vout = 3.3f;


void setup() {
  // put your setup code here, to run once:
  pinMode(readPin,INPUT);
  Serial.begin(9600);
}

void printVars
(int n,char separator,...)
{
  va_list l;
  float val;
  va_start(l,separator);
  for (int i = 0;i < n;++i){
    val = va_arg(l,double);
    Serial.print(val);
    Serial.print(separator);
  }
  Serial.println();
  va_end(l);
}
void loop() {
  // put your main code here, to run repeatedly:
  readVal = analogRead(readPin);
  v2 = ((float)readVal/1023.0f)*vout;
  printVars(2,' ',(float)readVal,v2);
  delay(delayTime);
}

The output:

542.00 1.75 
542.00 1.75
...
661.00 2.13 
661.00 2.13 
...

1.75 is the reading when the analog read is pinned after R1 (before R2) - which should be 0.6 as per multimeter
2.13 is the reading when the analog read is pinned before R1 - which should be 2.7 as per multimeter

Why am I getting 1.75 and 2.13?

As I understand, by placing analog read between the 2 resistors it should read 2.7 (V2)

TLDR: (solution)
I was using 3.3V input source and I assumed that in arduino I should multiply the value read from analogRead() by 3.3 but it is 5V.

DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)

Have you checked your resistor values with a multimeter?
Have you checked the value of V2 with a multimeter?

Your "Vout" should be named "Vref" and is not 3.3V.

I created a folder with all the documentation.
Drive documentation shared

What I did first is check the Voltage in V1 and V2 points:

Both readings are in line with the expected results:
I = 3.3/(220 + 1000) = 2.7mA
V1 = I220 = 0.6
V2 = I
1000 = 2.7

Just for reference, I am following Arduino Tutorial 11: Understanding the Arduino Serial Port and Print Commands - YouTube where I follow instructions and results are the same while using multimeter but the output from the analog reading yields something off.

in the setup() remove this line:

pinMode(readPin,INPUT);
void setup() {
  // put your setup code here, to run once:
  //pinMode(readPin,INPUT);
  Serial.begin(9600);
}

After removing pinMode it still procudes same ouput:

540.00 1.74 (after R1)
660.00 2.13  (before R1)

As it was mentioned above:

your vout should be named vref and it is not 3.3V

By switching 3.3V to 5V:

542/10235 = 2.6 (circuit voltage after R1)
660/1023
5 = 3.3 (circuit voltage input expected)

Do you understand why 'x 5' is correct and 'x 3.3' is incorrect?