Voltage divider for digital pin input

I need to reduce the voltage from 12V to 3.3V for a nodeMCU digital pin input.
I want to minimise the current draw of the voltage divider by using high value resistors.
Is there a problem if I go too high? The digital input might need to draw a little current?
Any idea what current I should allow?
Am I right in thinking that the resistor inbetween the 12V source and the 3.3V pin is the one that will determine the current by ohms law?
There will also be the internal resistance of the input to consider I suppose.

Or....... is there a better way of reading a 12V source (in a digital fashion). Maybe a transistor between 3.3V and the input pin triggered by the 12V source?

Thanks in advance for any help!

Is there a problem if I go too high?

Yes but it is nothing to do with the input drawing current it is that the higher you go the more sensitive to interference the input becomes.

None of the other things you mentioned are relevant.

Aim for the overall resistance to be about 12 K to give 1mA through both resistors.

Am I right in thinking that the resistor inbetween the 12V source and the 3.3V pin is the one that will determine the current by ohms law?

No, the current is determined by the sum of the two resistors and applying ohms law to that.

Input current to a digital input is negligible. The current drawn for a voltage divider is the voltage across the divider divided by the total resistance (Ohms law).

Am I right in thinking that the resistor in between the 12V source and the 3.3V pin is the one that will determine the current by ohms law?

You have to consider the bottom resistor as well as being in parallel with the input, but for all practical purposes the input has infinite resistance.

Start with a 10k bottom resistor and work from there. If that's too low try 100k. The problem with high value resistors is not the voltage it's noise pick up.

As a very rough test, if you can change the input reading by touching the pin then the resistance is too high.

Now the noise pickup to a high impedance pin is minimised by mounting the voltage divider as close to the Arduino pin as possible. Your longer wires must be between the source of the voltage you are monitoring and the voltage divider.

If you can accept slow, low frequency inputs, you can block the noise with a capacitor (example 100nF) in parallel with the "lower" resistor of the divider. That allows you to greatly increase the resistance values of the voltage divider, without excessive sensitivity to electrostatically coupled noise at the input.

If this is for an automobile, it's advisable to include a bit more protection because auto battery voltage is not well regulated.

Noise prevention is "holistic", you have to pay attention to everything because it tends to obey the "weakest link" principle - it will only be as good as the worst part.

Thanks all! Lots to look at there.
I phrased the question badly - I was referring to the current draw of the nodeMCU pin when I mentioned using the value of the first resistor and using ohms law.
I'll try a total of 10k for 1 milli amp approx. And I'll have a look at the noise. This would be noticeable by extra pulses being recorded on the digital input?

I phrased the question badly - I was referring to the current draw of the nodeMCU pin when I mentioned using the value of the first resistor and using ohms law.

I know! It's negligible.

I'll try a total of 10k for 1 milliamp approx.

You will be fine with 10k as the bottom resistor and the top resistor as required.

For 10k being the bottom resistor ....... use 27k for the top resistor (ie. 26.4 k, or 39k in parallel with 82k).

Or ...... for 3.3k being the bottom resistor ...... use 8.7k for the top resistor (eg. 10k in parallel with 68k).

I didn't know this, not having worked with the NodeMCU's A0, but it has a voltage divider already (220k, 100k).
The ESP's range is 0-1V.
May want to note that vis-a-vis adding another network in parallel.

See section B/C-4 of the attached drawing.

I was referring to the current draw of the nodeMCU pin when I mentioned using the value of the first resistor and using ohms law.

If you just had one resistor between the 12V and the input pin the. You would be putting 12V into the input pin and thus risk damaging that pin. You must have a bottom resistor.

A resistor will not in of itself do anything to the voltage without current flowing through it. The input impedance impedance of a pin is that high it is essentially an open circuit as far as calculations are concerned.

Depending on what you want to do, if it's just one 12V 'signal' that you are concerned with, you could place a 1MΩ resistor between this 12V and A0, then analogRead that. Perhaps not as fast as a digitalRead, but simple, as it seems you're after.

Grumpy_Mike:
The input impedance impedance of a pin is that high it is essentially an open circuit as far as calculations are concerned.

I know you meant, "high impedance", not "in a HIGH output state"...

know you meant, "high impedance", not "in a HIGH output state".

Bit puzzled as I never said high output state.

Grumpy_Mike:
Bit puzzled as I never said high output state.

Paraphrasing. It's just a grammatical mixup.
You said,

The input impedance impedance of a pin is that high it is essentially an open circuit as far as calculations are concerned.

You probably meant, "The input impedance impedance of a pin which is that high is essentially an open circuit as far as calculations are concerned".

Or something like that. Maybe

"The input impedance impedance of a pin that high is essentially an open circuit as far as calculations are concerned".

I thought someone might take it as, "The input impedance impedance of a pin that is high is essentially an open circuit as far as calculations are concerned". Because pins sometimes are HIGH.

I thought someone might take it as, "The input impedance impedance of a pin that is high is essentially

I see, yes if someone does not actually read the works I put, then they are likely to miss interpret what I said.

What Mike clearly meant is "The input impedance impedance of a pin is so high that it is essentially an open circuit as far as calculations are concerned."

Just a couple of words missing. :astonished:

Paul__B:
What Mike clearly meant is "The input impedance impedance of a pin is so high that it is essentially an open circuit as far as calculations are concerned."

Just a couple of words missing. :astonished:

No, that's exactly the same thing in different words. "That" and "so" both mean extreme, as in
"he's so tall he has to stoop going through doors"
"he's that tall he has to stoop going through doors"

This is because tall is an adjective, as is high. A noun after "that" would be completely
different.