2

I have a theoretical question about using digital pins of arduino. The specification of Arduino Uno (or any other I guess) says, that maximum current from digital pin is 40mA. If I would need more than 40mA and less than 80mA, can I use two pins to supply enough power to the sensor or would it burn the pins in the end?

Thanks

2
  • You could also hook the sensor up to the 5V rail of the Arduino?
    – aaa
    Commented Oct 3, 2016 at 16:56
  • I know, as I have written, it is only a theoretical question. I was more interested in arduino internals than real usage of this...
    – Divisadero
    Commented Oct 3, 2016 at 18:50

1 Answer 1

4

40mA is the absolute maximum current allowed. The recommended steady-state current is 25mA, so you'd need three or four IO pins to remain safe.

Theoretically, yes, that should be possible. However in practice doing such things is problematic. You have to ensure that there is no point at which the sensor is being powered by less than the required number of IO pins, which means turning them all from off to on at the same time (doing them one at a time means you start with the full load through just one pin then start sharing it around). That means ensuring that all your pins are on the same port and using direct port manipulation to control all the pins at once.

It is far better, more reliable, and simpler to program, to just slip a simple p-channel MOSFET in there with a pullup on the gate to control the 5V power to the sensor. Pull the gate low and the sensor gets all the power it needs.

2
  • You also have to make sure that the maximum current draw for the port in use is not violated, as those have their own separate limits. Commented Oct 3, 2016 at 17:04
  • @IgnacioVazquez-Abrams Yep. And don't forget the maximum current on a power or ground pin...
    – Majenko
    Commented Oct 3, 2016 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.