Pull-up Resistor Needed?

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
Hi - I have a 12V source which goes through a relay that I want to use as input to a pin on my MCU. I intend to use a voltage divider to bring the 12v down to ~4.5v. Is the circuit ok as I have drawn it or do I need a pull-up resistor? Thanks....

circuit.PNG
 

MrChips

Joined Oct 2, 2009
34,662
What you have is fine. I would reduce the resistor values by a factor of 10 or 20, i.e. 91k and 56k.
That is to take into account that the input pin will draw some current.
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
What you have is fine. I would reduce the resistor values by a factor of 10 or 20, i.e. 91k and 56k.
That is to take into account that the input pin will draw some current.
Thanks. Can you please expand on why I should lower my resistor values? Are you saying that I need to have more current going to the MCU than I have with the larger resistors? thanks again...
 

MrChips

Joined Oct 2, 2009
34,662
Thanks. Can you please expand on why I should lower my resistor values? Are you saying that I need to have more current going to the MCU than I have with the larger resistors? thanks again...
To accurately answer that question, one needs to examine the datasheet of the MCU used on the Arduino Nano, which is the Atmel ATmega328p.

The input current is about 1 μA which puts the input impedance between 3 and 5 MΩ.
Rule of thumb suggests that external input device should supply at least 10 times that current, i.e. greater than 10 μA, or a source impedance of 300 to 500 kΩ.

Furthermore, if the internal pullup resistor is enabled (20 to 50 kΩ), you need a source resistance of 2 to 5 kΩ.

If you are going to use the input pin as analog input, the source impedance should be less than 10 kΩ.

Now let us examine the current capability of the 910 kΩ/560 kΩ voltage divider.
The current through the divider is 12 V / (910 kΩ + 560 kΩ) = 8 μA.
When connected to the MCU pin, the expected voltage will be different depending on the 1 μA input sink or source.
With ten times lower resistors, 12 V / (91 kΩ + 56 kΩ) = 82 μA, ten times more current. This is not affected as much by the 1 μA input current.

It is not about how much current is flowing to the input pin. It is about how the output voltage of the voltage divider circuit will change when the input pin is connected.

To put it in another way, you selected 910 kΩ and 560 kΩ to drop +12 V down to +4.5 V. When you connect the MCU pin, will the voltage still be +4.5 V? In order to take into account the effect of input impedance of the I/O pin, the impedance of the voltage divider should be 10 times (or more) lower than that of the input pin.
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
Thank you for the explanation. On a separate note, when the relay is open as shown, pin 3 will be connected to ground which is what I want. Will R2 cause the pin to float? I want it to read LOW. Thank you again.
 

BobTPH

Joined Jun 5, 2013
11,479
Thank you for the explanation. On a separate note, when the relay is open as shown, pin 3 will be connected to ground which is what I want. Will R2 cause the pin to float? I want it to read LOW. Thank you again.
Floating means no connection. It is never floating as long as R2 connects it to ground. The is exactly what is meant by a pull-down resistor.
 

MrChips

Joined Oct 2, 2009
34,662
Thank you for the explanation. On a separate note, when the relay is open as shown, pin 3 will be connected to ground which is what I want. Will R2 cause the pin to float? I want it to read LOW. Thank you again.
By pin-3 I presume that you are referring to the RESET input to the Aruino Nano. I don't see what pin-3 has to do with the input requirements of the I/O pin.

R2 is a pull-down resistor to ground. The same considerations apply. You need to calculate the input voltage at the pin based on the current flowing through R2.

If the internal pull-up resistor (50 kΩ) is enabled, then R2 = 560 kΩ will not be able to pull the input pin to LOW.

You cannot pull the input to 0V with a pull-down resistor and you don't need to. What you need is to pull the input low enough, say 1 V or lower, to guarantee a logic LOW input even in the presence of noise.
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
By pin 3 I was referring to the one-line in post 1. I have it shown in this post too with new resistor values.

I appreciate your explanations but I don't understand it all. I might be making something out of nothing from the info I've been reading about pull-up resistors. Ultimately, I want my Arduino sketch to be able to discern input pin 3 as LOW or HIGH based on the relay being opened and closed. I think I am in the respective voltage ranges for HIGH and LOW to make it work but am unsure. Hence my questions about pull-up resistors. Am I worried about nothing? Do you think my sketch will be able to read pin 3 as either LOW or HIGH, e.g: the pin won't return random HIGH or LOW voltages? Thank you again for your patience and information.

Capture.PNG
 

MrChips

Joined Oct 2, 2009
34,662
It is still not clear what you mean by pin-3. I see pin-3 as being the /RESET input.
The voltage divider output is connect to pin-6, with signal identifier D3. Is this what you are calling pin-3?

You don't need R3.
R1 = 100 kΩ
R2 = 47 kΩ

When relay switch is closed, voltage divider output is
12 V x 47 kΩ / (100 kΩ + 47 kΩ) = 3.8 V

The 1 μA input current will not severely affect this. However, you need to check the supply voltage on the ATmega328p MCU chip.
If the supply voltage is 5 V, then 3.8 V input will register as LOGIC HIGH.
If the supply voltage is 3.3 V, then 3.8 V input is too high.

When the relay switch is open, the R2, 47 kΩ resistor, is the pull-down resistor. The input will register this as LOGIC LOW so long as you do not enable the internal 50 kΩ pull-up resistor.
 
Top