Cannot measure voltage of both resistors after following Paul McWhorter's tutorial 10

Hello everyone,

After watching PW's tutorial 10, I set up the following sketch and wanted to measure the voltages of both resistors (horizontal 330 ohm and vertical 220 ohm):

With code:

const int READ_PIN = A3;

void setup() {
  // put your setup code here, to run once:
  pinMode(READ_PIN, INPUT);

  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  int realVal = analogRead(A3);
  float actualVal = realVal / 1023.0 * 5.0;

  Serial.println(realVal);
  delay(1000);
}

However, in the sketch, I can only measure the voltage passing through the 330-ohm resistor, but in the video PW measured that of both resistors. So I was wondering if you could give me a hint of what I should do and where I did do wrong?

Thank you! (Also I am new to Fritzing, so the image may not be the best...)

Current passes through. Voltage is measured between two points.

You know the ground is 0V, and you are assuming the VCC is 5V to calculate V1= realVal / 1023.0 * 5.0, so the voltage across the second resistor is V2=5-V1.

1 Like

Yes, sorry for not asking more clear: I wanted to know with this setup, is it possible to measure the voltage of vertical resistor directly with only moving the wires (i.e., keep the resistors untouched)?

Still unclear.

The ADC can measure the voltage of the node/junction/point attached to A3 as a n/1024 fraction of the voltage between 0V and VCC (AREF).

I'm not likely to watch the video to see what he did when. Maybe he swapped the GND and VCC connections to the resistors?

1 Like

The resistance of the two resistors in series is 330 + 220 = 550. If 5volts is applied across 550 Ohms, the current flowing will be 5V / 550Ω = 0.00909090909091 Amps. That current flowing through 220Ω will build a voltage of 220Ω * 0.00909090909091 Amps = 2V. The same current flowing through 330Ω, it will build 3V.

This will come in handy:

formulas

3 Likes

Hint look up voltage divider, that is what he is making. Assuming 5V simply subtract your reading from 5V and you have the other.

2 Likes

Thank you for the answer! I guess I misunderstood that we can directly measure two, instead of only measuring one and calculating another.

You have six analog inputs.
You can measure six nodes as long as they do not exceed Vcc or go below 0V.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.