Powering sensors through the digital pins?

  • Hero Member

    I'm wondering whether it is possible to power different sensors using the digital outputs of the microcontroller. I guess I can put a reed switch between two digital pins, but what about a DHT22, a distance sensor, light sensors, and all the other types of sensors that consume some power? I seem to recall that the digital pins can source or sink 50 mA which I suppose is enough for most sensors? This would make mounting stuff much easier since I could just solder any three pin digital sensor directly to the board. I guess analog sensors are a bit more difficult unless I can pull power from the analog pins as well?

  • Mod

    @kolaf please keep in mind that there's also a maximum total power budget for the whole atmega (don't have the figures at hand)

  • I'm usually doing this test for each and every sensor i bought and I can confirm that many of them can work without problems.
    Sensors like DHT seems to need a delay(500), before call the sensor read function, in order to let him "boot-up" otherwise you will experience communication errors.
    Sensors connected to analog input, like soil humidity, will not give correct measurement, if the precision is not your must is possible to use pin powering,

    Pay attention on the max current required for the sensor, if you exceed that the Arduino will be damaged. Measure it before to connect!

    Radio cannot be powered by digital pin (too much current during transmission).

    Arduino has also a maximum total current that normally can never be exceeded, special attention to be given if you use radio with PA antenna!