Current can flow in two different ways with respect to the load. Sensors often provide real-world, analog input for embedded applications. MCUs rely on sensors to be their electronic “senses” and actuators to physically interact with world. Interfacing with external devices requires some planning on the part of the designer to ensure efficient operation. One design consideration is whether to use a current sourcing or current sinking interface for Inputs and Outputs (I/O).

What’s the difference between current sourcing and sinking? Current sourcing is probably the more intuitive of the two options for most people. Current flow is always in the direction of a higher potential energy (voltage) to the lower potential, which makes sense because current flow is analogous to that of water. When sourcing current to energize, or activate a load, the General Purpose I/O (GPIO) pin of the microcontroller is driven high, current flows from the pin to the load, and ultimately the current flow finds ground (accomplishing some sort of work along the way). Conversely, current sinking requires either an external power supply or a connection to the Vcc pin of the microcontroller. However, with current sinking, the positive lead of the load connects directly to the power supply and the negative terminal of the load connects to a GPIO pin of the microcontrollers. To activate the load, the GPIO is driven low and current flows from the external power supply (or Vcc pin), through the load (accomplishing work), then through the GPIO pin to ground.
With a cursory glance, it seems like there is not much of a practical difference between the two. However, each option has both pros and cons. For instance, if the load can be driven directly by the GPIO pin then it is possible to keep the component count to a minimum and your design is simplified because you are utilizing the current sourcing method. If you choose to source the flow to the load, be sure to check (by looking at the microcontroller’s datasheet) that the GPIO pin can safely provide the needed output voltage and current needed to drive the load. Most of the time, an MCU output can only directly drive a few milliamps so an additional driving source may be needed.
Sinking current can be very useful when the load requires a higher operating voltage than the microcontroller’s internal operating voltage. Special attention needs to paid to ensure that the current is limited so as not to exceed the maximum current handling capacity of the GPIO pin. Again, check the datasheet as some microcontrollers can sink more current than they can source, but not always.
One last note about choosing between a sourcing or sinking current design: your choice of current handling configuration in hardware will have impact on the software. When writing code, or even more importantly when using pre-built software libraries, be sure to review how the logic handles the GPIO pins. Remember when sourcing current that in order to turn on the load you have to drive the GPIO pin high. The opposite is true for sinking current, and thus designers must ensure that a negative logic is being used in the code base. This can be a simple yet frustrating source of “buggy behavior” for an application if you forget.
Leave a Reply