# Switching multiple Inductive load and isolate higher voltage from MCU

#### cyberpks

Joined Nov 29, 2020
12
Hello all,

I am working on a project and I need to decide a way to setup switching on one part of the circuit that would work as output for an external machinery.

The equipment being designed works more like a PLC, but for a very specific purpose and I wanted to understand if I have a better choice than using regular electromechanical/solid-state relays.

Below is my test schematic.

I am using an STM32 based MCU (different from schematic. Used SM32F030 for keeping away the complexity.
The place where I need your attention is the "?", and the usage of darlington transistor array IC i.e. ULN2003

The DB9 connector is the output for this board and will be fed to the machine for controlling. In the machine I have seen the controller board, which basically uses Omron G5V-1 (24v) Relay, so each output of my circuitry would need to handle atmost 150mW of power at 24vdc (that would essentially be the power rating of relay coil).

So, each pin on the DB-9 (2-8) basically need to allow passage between Pin 1, thats +24vdc, to be able to send signals to the machine being operated. So when this is connected, the relay in the Machine's controller circuit is ON, as the current flows between, one of the pins from 2-8 and GND1 (Pin 9).

So, I technically speaking I need to handle an inductive load on pin 2-8. From my research and past experience, I have made use of ULN2003/ULN2803 for multiple projects, which is a good choice, when it comes to handling inductive loads like a relay or a stepper motor (under 500mA and < 50v). But, looking at what the subject/machine accepts is to have a passage between +24VDC and one of the Pins 2-8. So my questions are:

1. ULN2003 is an NPN type Darlington array (common Cathode), so I guess, it wouldn't be an option for me due to its polarity (please correct me if its not the right terms). Is there a PNP type Darlington array with same spec but PNP transistor (common Anode)?
2. If I use something like ULN2003 or ULN2803, I will have to ground its 24vdc supply, to the ground of my STM32, which handles 3.3vdc. Though, it may not be a big problem, but I still wanted to have a complete isolation on this switching circuit (with 24 vdc supply) and my STM32.
3. Need to keep the whole footprint as small as possible.

#### cyberpks

Joined Nov 29, 2020
12
1. Need to keep the whole footprint as small as possible.
So, is usage of Optocoupler like PC847, a better choice (instead of a ULN2003), since it can handle about 50mA at a max of 35v, and above all, it gives total galvanic isolation keeping MCU and 24v physically disconnected. Looking at Omron G5V-1 datasheet, I calculated a current of 6-7 mA, at 24v. So this is well under the maximum limits of an Optocoupler like PC847

#### Irving

Joined Jan 30, 2016
2,662
Lots of options as stated above... here's a couple more. The first uses a conventional optoisolator to drive the ULN2003 (suggested is a quad package for space saving) leaving the heavy lifting to the ULN2003 giving more options for output capability.

Option2 uses a photoMOSFET and there are versions available in a DIP4 package for 60v/100mA at around £0.50 ($0.7) through 30v/1A at £3 ($4) in small numbers.

#### cyberpks

Joined Nov 29, 2020
12
Lots of options as stated above... here's a couple more. The first uses a conventional optoisolator to drive the ULN2003 (suggested is a quad package for space saving) leaving the heavy lifting to the ULN2003 giving more options for output capability.
@Irving , is a ULN2003 even necessary? The relay being operated has a power rating of 150mW @ 24VDC (theoretically ~7mA), so isn't it better if I run it directly off the Optocouplers like PC847 (with max rating of 35v and 50mA collector to emitter)?

I'm trying to keep the footprint as small as possible.

Also, I wanted to use photoMosfets like you mentioned above, but I am unable to find any on the store of the PCB manufacturer.

#### Irving

Joined Jan 30, 2016
2,662
If all you want to drive are those relays then the PC847, or similar, will suffice. You'll need a diode across the relay coil (i.e PC847 collector to +24v as in the ULN2003). To be sure of the relay pulling in you'll need to drive the 847's led at around 8mA, so a series resistor around 430R (5v mcu, 220R for 3.3v) will be needed.

#### Ian0

Joined Aug 7, 2020
5,062
PC847 has a minimum current transfer ratio of 50%. To make sure it switches a 7mA relay you need to put 14mA through it.
14mA will be a bit of a challenge for a MCU output, and 7x14mA will probably overload its maximum supply current.
You would have to buy a graded PC847 with a 130% or 200% minimum current transfer ratio.

#### eetech00

Joined Jun 8, 2013
3,146
You can also do something like this.
Use a Mosfet array to drive the relays (or inputs). The mosfet driver inputs will work down to 2.0v.
The opto's wouldn't be needed unless the isolation is required. I've only shown two inputs used but they all could be used if needed.

#### Irving

Joined Jan 30, 2016
2,662
PC847 has a minimum current transfer ratio of 50%. To make sure it switches a 7mA relay you need to put 14mA through it.
14mA will be a bit of a challenge for a MCU output, and 7x14mA will probably overload its maximum supply current.
You would have to buy a graded PC847 with a 130% or 200% minimum current transfer ratio.
True, a PC847X7 is needed. Interestingly Digikey lists the PC847 as obsolete and offers the LiteOn LTV847BC as the 130% equivalent, or better still the LTV845 which is better spec'd at 600%CTR and only marginally more expensive (or actually cheaper at Mouser).

#### Ian0

Joined Aug 7, 2020
5,062
Yes, in this application a darlington output is ideal, and being about as fast as a sloth on Horlicks won't be a problem.