To interface SWiTh to other electronic devices (small LEDs, switches and other basic components), some circuit is needed. This is necessary when we are coupling SWiTh to devices working at different voltage levels or when driving high-power loads (e.g. lamps, relays, etc.).

For safety, an optocoupled interface is mandatory if we need to drive loads connected to the 230V mains.

A series of simple, practical examples follows. These should cover the most common situations and can be used with any similar systems.

Driving a low-power relay using one N-CH MOSFET

Example 1: this circuit allows SWiTh to drive a low-power relay. Very few components are needed. The input resistor insures a stable logic L when the input is floating (the input impedance of the MOSFET is very high). The diode protects the MOSFET against the voltage spikes generated across the relay coil when this latter is powered on and off.

A bipolar transistor drives a low-power relay.

Example 2: a common NPN transistor is used instead of a MOSFET (see Ex. 1).
Both circuits turn on the relay when a high level (5V) is applied to the input.

A bipolar PNP transistor drives a low-power relay

Example 3: a PNP transistor drives a relay.
This circuit is useful when an inverted logic is needed: the relay is OFF when a 5V voltage is applied to the input and ON when the input is floating or logic zero.

Using an integrated darligton driver ULN-2003

Example 4: a circuit using a very useful and popular IC, the ULN2003.
This ICs can drive different loads of various types: relays, lamps, motors, even at high voltages and currents.
Each channel is rated at 500mA, that can be paralleled for higher demands.
Each driver has its own suppression diode for driving inductive loads. A very handy IC !

Optocoupled digital input

Example 5:  a digital input circuit using an optocoupler,
useful when the electrical separation of two interconnected circuits is needed for safety reasons.

For an effective isolation the two devices must not share any signal/voltage (including ground).

Optocoupled output

Example 6:  an optocoupled digital output circuit.
This circuit can be used to drive low-voltage devices.
This circuit is inverting: the output goes low when the input goes high.
If the interfacing circuit has its own pull-up resistor just remove the 4.7 kΩ collector resistor.
Do not share any signal or voltage between the left and the right circuits.

An optocupled output, driving a relay (for greater safety)

Example 7: this circuit can be used to drive devices connected to the mains or high-current switching (using a suitable relay).
At the cost of a little more complex circuit you get an interface that can safely drive high-voltage devices.
A medium- or high-power relay may need the use of a medium power NPN transistor.


, , ,