the electronic switch component will sink the load current.
Sinking current means that the electronic switch component
being controlled by the microcontroller’s I/O pin provides a
ground path for the I/O device. You can easily pick out a
sink configuration as the positive power source is always
connected to the I/O device in a “sink = on” configuration.
In electronic terms, the opposite of sink is source.
Connecting an LED’s anode directly to a microcontroller’s I/O
pin and grounding the LED’s cathode is an extreme example
of sourcing current to illuminate the LED. Naturally, you would
have a current limiting resistor in the mix to keep from driving
the LED into darkness and/or the microcontroller’s I/O pin
into burnout. I’ve drawn up a couple of simple LED driver circuits in Schematic 1 to illustrate the difference between sourcing and sinking current using a PIC microcontroller’s I/O pin.
The electronic switch component I alluded to earlier is
usually a transistor or MOSFET device. We could talk for
weeks about selecting transistors and MOSFETs as there are
tons of these devices to choose from. In my experience,
light to medium loads can be easily handled by standard
switching transistors. Darlington array transistor devices can
be used in high-power situations. Many of the LM723-based
high-current power supply circuits you can find on the
Internet use Darlington transistors in their high-voltage/high-current output stages. However, in high-current/high-voltage applications, I prefer MOSFETs.
Honestly, I prefer MOSFETs over transistors in the light to
medium application area, as well. The fact is, logic-level
gate MOSFET devices are designed to be driven from a
microcontroller I/O pin and exhibit very low “on” series
resistances, which lead to lower voltage drops across the
electronic switch component and reduced heat in the
electronic switch component.
Using a logic-level gate
MOSFET is just as easy as
using a 2N2222A switching
transistor. The idea is to
provide enough drive to the SOURCE
MOSFET gate to completely 20
turn on the MOSFET’s 28
Drain-Source junction. Once 27
you supply enough voltage 25
to exceed the MOSFET’s 22 21
Gate-Source threshold, the
Drain-Source resistance will
drastically decrease allowing
current to flow between the
MOSFET’s Drain and Source.
I’ll let you debate on which
way the electrons flow. In
■ SCHEMATIC 1. Applying
VCC to the LED1 anode via the
PIC’s RB0 I/O pin illuminates
the sourced LED. When RB0
provides a ground path for
LED2 — which is configured
in a sink configuration — you
will see the light.
our case, it really doesn’t matter as all we want to do is toggle the device at the end of the PIC’s I/O pin off and on. Let’s
put this MOSFET switching theory discussion into practice.
For this theory-to-hardware exposition, I’ve chosen the
Zetex ZVN4306G as our electronic switching component. The
ZVN4306G is actually an N-channel DMOS FET with a minimum Gate-Source threshold voltage of 1.3V and a maximum
Gate-Source threshold voltage of 3.0V. We really don’t have to
worry about current drain on our microcontroller I/O pin as
the ZVN4306G gate current requirements are in the dust.
For our discussion, our PIC is powered with a +5V VCC
supply. So, according to the ZVN4306G’s maximum and
minimum Gate-Source threshold voltage specifications, all we
have to do is provide a logical high state from our PIC I/O pin
to the ZVN4306G’s gate to open up the MOSFET’s Drain-Source channel. Conversely, a low level on the ZVN4306G
gate will pinch off the current flow and turn the target device
off. Once the ZVN4306G is turned on, its Drain-Source
resistance drops to 0.32Ω. When in the on state, the
ZVN4306G can switch up to 2.1A of current continuously.
The maximum switching voltage (Drain-Source voltage) of the
ZVN4306G is 60V. If things get warm, the ZVN4306G is
housed in an SOT223 package that can be soldered to a
suitable heatsink pad on the printed circuit board (PCB).
The ZVN4306G is designed into a sinking configuration
as shown in Schematic 2. The ZVN4306G is acting as a
high-voltage/high-current buffer for the PIC’s RB0 I/O pin. In
this case, we are driving a simple solenoid assembly like the
one you see in Photo 1 in the sink configuration. At 12V, the
solenoid coil in the fluid switch you see in Photo 1 will draw
450 mA when energized. The application that uses this fluid
switch requires the solenoid to open and close the fluid
passageway for 10 seconds once every hour. This is a light
January 2008 83