# How much voltage and current can a Arduino uno digital input sink?

I am having a digital output of 24VDC and 0.5A from ABB IRC5 controller. I need to feed this digital output to the digital input of Arduino uno. How can I do that?

• Do you want to sink the voltage, or detect it? – Nick Gammon Oct 11 '18 at 7:31
• just to detect sir – Sri Harsha Oct 11 '18 at 8:22
• Why are you asking about current then? That's like asking "how heavy an aircraft can I see in the sky with my telescope?". Just to detect it, you don't care about its weight. And to detect a voltage, you don't care about its current (unless the current is very very tiny). – Nick Gammon Oct 11 '18 at 9:07

## 4 Answers

One common misconceptions is that the current limit of a GPIO pin applies to inputs. It does not.

The 40mA "maximum sink" is only applicable when the pin is set to OUTPUT and is driven LOW - at which point the pin is connected to ground through a MOSFET.

However, when the pin is in INPUT mode it is high impedance. This means that it neither sinks nor sources current (apart from a very tiny leakage current). The only thing that matters is the voltage. That must:

• Never go higher than 0.3V above VCC (5.3V if powered from 5V)
• Never go lower than -0.3V
• Have logic levels that are within the thresholds of the input:
• Below 0.3 × VCC for LOW
• Above 0.6 × VCC for HIGH

You can connect the input to a signal that is 5V and 1,000,000 giga-amps and all will be well.

However, if you inadvertently set the pin to OUTPUT and drive it LOW there will instantly be smoke. For this reason it is common to add a small inline resistor (maybe 100Ω-470Ω) in order to limit any current through the circuit should the pin ever be set to OUTPUT and LOW.

Another "However", though: If you are using a voltage divider to reduce your incoming voltage to conform to the values above (as shown by @user43648 and suitable values given by @EdgarBonet) the inline resistor is pointless. The voltage divider itself will have a very high output impedance which massively limits the current. This impedance is like having a resistance equivalent to both the provided resistors in parallel inline with your input.

• Which will be the better option for me to step down the voltage sir? plz dont mind sir, I am mechanical guy having very very little knowledge in this area. – Sri Harsha Oct 11 '18 at 8:30
• @SriHarsha As long as you're not dealing with high frequencies a simple voltage divider will suffice. – Majenko – Majenko Oct 11 '18 at 8:31
• Can you please share a link regarding this sir? I wanna go through it – Sri Harsha Oct 11 '18 at 8:36
• Regarding voltage dividers? en.wikipedia.org/wiki/Voltage_divider – Majenko Oct 11 '18 at 8:47

You have 2 different questions here. First one can be answered by google search, it is literally the first result.

The Arduino Uno uses the atMEGA328 microcontroller, which has an absolute maximum rating of 40 mA source or sink per GPIO. Also, the total current through the supply or ground rails (i.e. the total of all current OP wants the GPIO pins to sink, or source) is rated to a maximum of 150 200 mA.

And you should not apply more than 5V.

Regarding second question, Google can help again.

Vin is your 24V from controller, Vout is your Arduino digital 5V input. With that established, use voltage divider formula to calculate R1 and R2 values. I hope you can do that? That being said, I am disappointed, because I feel like you have put 0 effort into researching this.

As a complement to user43648's answer, it is worth noting that:

1. According to the datasheet, the 40 mA limit “is a stress rating only and functional operation of the device [...] is not implied” beyond the maximum tested current which is 20 mA.
2. The input voltage should be at least 3 V for the pin to be guaranteed to read high.
3. When sensing voltage through a voltage divider, 10 kΩ is a somewhat typical order of magnitude for the resistors.

Given the above, I would suggest using 47 kΩ for the top resistor and 10 kΩ for the bottom one. This should give about 4.2 V on the input pin, which is near the middle of the appropriate range for the pin to read `HIGH`.

• Sir, should we not bother about the current? What will the current output?I am a mechanical guy, I don't have any idea regarding these things... please kindly help... – Sri Harsha Oct 11 '18 at 8:20
• You will read the high/low level of the pin with digitalRead(). The input current will be 1uA max, 0.000001A. Practically nothing. pinLevel = digitalRead(inputPin); – CrossRoads Oct 11 '18 at 17:05

In addition to the potential divider I would be tempted to strap the input pin to ground with a zener diode between 4V7 and 5V1 in case the lower resistor or its solder joints fail. even with a relatively high value series resistor 24V has plenty of potential to destroy the input pin if not the entire chip. The safest method though is use an opto-isolator and keep the nasty high voltages isolated from the delicate digital level components.