Sinking Vs Sourcing Current in Arduino

Introduction: Sinking Vs Sourcing Current in Arduino

About: Part software developer, part maker.

In this Instructable we will look at the difference of sourcing and sinking current through an Arduino.

Supplies

Step 1: Sourcing Current

When working with an Arduino on a project and you need to control a digital output, they can have one of two states. The output can either be high, or low.

When the output is pushed high, the full supply voltage is applied to the pin and this can then be used to power an LED or turn a device on depending on the project. This configuration is called sourcing where the current source is the Arduino. This way the current exits the power source, enters the Arduino and then enters the load.

Step 2: Sinking Current

In the opposite situation when the output is pulled low, we can no longer source current but current can still flow through it. If we now connect the LED with its positive connection to the power source and connect the cathode to the Arduino pin that is pulled low, current will once again flow. This is called sinking where the current first flows through the load and it is then connected to ground via the digital pin on the Arduino.

Step 3: Comparison and Usage

In both ways, the same limitations will apply. The Arduino Uno has a maximum current limit of 40 mA but should not be handling more than half of that for extended periods of time. Both sourcing and sinking have exactly the same effect on the chip and can be used depending on the configuration and the requirements on the circuit.

From what I’ve seen, sourcing is more commonly used but if you have a project where you are sinking current, I would love to see it so let me know down in the comments. If you liked this Instructable then subscribe to my YouTube channel and follow me here on Instructables.

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • Remote Control Contest

      Remote Control Contest

    6 Comments

    0
    HansEHV
    HansEHV

    11 months ago on Introduction

    Hi, thanks for the info
    nice to know about the sourcing or sinking capability.
    I like to drive an analog meter with two PWM ports.
    The analog indicator has a dial in the mid position and with positive current of 0.5mA I have full scale left. and with -0.5mA i have a full scale right.
    So I use port 5 as a 'zero' at analog write 128 and drive port 6 from 0 to 255
    so the max voltage is 2.5 + or - and with a 4k7 resistor I limit the current
    The only thing I am still puzzling is that during start-up or fault conditions there can be 5V and thus double current when port 5 is 0 and port 6 is 255. this may damage the analog indicator.
    Tips for protecting my analog indicator are welcome
    regs
    Hans

    0
    taste_the_code
    taste_the_code

    Reply 11 months ago

    Use a voltage divider with resistors and power the meter from that. That way you can work with the 5V at all times and your meter will be safe. Plus, the added resolution of the 5V will make the control more sensitive and precise.

    0
    HansEHV
    HansEHV

    Reply 11 months ago

    OK thnx,
    I am considering that, however with an added emitter follower, so that changes in the current through the analog indicators does not change the the 2.5Volt reference.

    0
    greg.schmidt.9406
    greg.schmidt.9406

    Reply 3 months ago

    I don't see how adding a voltage divider helps. Pin 5 must be capable of producing 5v since your reference is 2.5v and your meter swings between -2.5 and 2.5. So even with the divider, if pin 5 is at zero and pin 6 is at 255, you'll still have a 5v swing. I suspect you're running into a problem because your pin initialization code isn't quite right. Set the reference voltage (pin 5) before setting the control voltage (pin 6). If you're still concerned about your software going haywire, you could use a zener on the control pin to prevent overvoltage.

    0
    greg.schmidt.9406
    greg.schmidt.9406

    3 months ago

    When driving common anode LEDs (e.g. RGB LEDs), it is necessary to tie the cathodes to a current sink. The ULN chips are high current darlington chips that do this. Current sinking chips such as these are for more common and less expensive than their sourcing counterparts.

    0
    taste_the_code
    taste_the_code

    Reply 3 months ago

    Thanks for sharing this!