I have a 12v signal, I want to read it as a digital input on an analog pin. I am also using a resistor divider to bring down the voltage to about 4.5v-4.8v. My question(s) are do I still need to add another resistor on the output of the voltage divider to ensure the current doesn't exceed the amount the input pin can take or does the divider already drop it enough? I'm using 2.2k and a 1.2k. I can actually use the analog pin as a digital "Input" right?
All you need is the two resistors, as long as the 12V is regulated/controlled and doesn't go too high.
The input impedance is very high (~100 Megohms) so essentially no current flows into the Arduino (Ohm's Law. Current only flows through the voltage divider.
Correct.
The "analog inputs" are actually digital inputs with analog input as a special function. They have all the attributes of digital inputs including internal pullup resistors.
1. On the Arduino UNO Board, we have the following legends besides one of the edge connectors:
A0, A1, ..., A5 which are called as A0-pin, A1-pin, ..., A5-pin.
2. The pins of Step-1 are Digital Pins (DPin) by default and work exactly the same ways the other DPins (0, 1, ..., 13) work. Now, we can say that we have:
DPin-A0, DPin-A1, ..., DPin-A5.
3. When we activate the internal ADC of the MCU (Fig-1), the A0-pin to A5-pin work as the input lines for the 6-channel of the ADC and are connectd with external analog signals to be digitized. This is the justification to name them Analog Pins and the legends A0 - A5. They can be now called as: APin-A0, APin-A1, ..., APin-A5.
Figure-1:
4. The A0-pin to A5-pin can be replaced by nummerical values which are 14 to 19 respectively.
And the internal pullup resistors are very useful when using analog measurements as a resistive device can simply be connected between the input and ground, particularly if it is in the tens of kilohm range - such as a small LDR.
On the Nano - which is generally more useful than the UNO for a practical project, Analogs A6 and A7 are not general digital pins and have no "plain" digital functionality including pullup.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.