5
\$\begingroup\$

I've created simple circuit to protect MCU's digital input against eg. induced spikes. I want to connect quite long wires to this HW and highly probable that this board will be placed close to the relays, etc.

My schematic: schematic

These long wires will be connected to switches, relays or to digital outputs of any other devices. I would like to prepare this circuit to work with 24V and 5V - not only 12V.

Questions

  • Is it a good circuit or should I modify something?
  • When 24V is connected instead of 12V I will have to adjust R8 resistor and U3 TVS diode to higher voltage. But what in case of 5V - what is the correct value of R7 and R8 resistors?
\$\endgroup\$
3
  • \$\begingroup\$ Should the DI0 arrow be reversed, or am I reading the schematic wrong? Since the input is unipolar, why not use the unipolar SMCJ18A TVS diode instead? Adding a capacitor in parallel with D3 to low pass filter the input may be helpful to suppress transients. \$\endgroup\$
    – C. Dunn
    Commented May 8 at 14:59
  • \$\begingroup\$ Yes, you’re right that DI0 label should be reversed. I used SMCJ18CA (bipolar) because I thought that some spikes might be induced also on 12VGND long wire - am I wrong? Should I add this capacitor even if there is another RC filter before MCU DI pin? \$\endgroup\$
    – szymo092
    Commented May 8 at 20:47
  • 1
    \$\begingroup\$ On a unipolar voltage line you usually put a unipolar TVS diode, which will protect you against spikes on both wires. For example, if 12VGND tries to rise above 12V, a unipolar TVS will breakdown (conduct 1 mA) at about 1 volt (less stress on the electronics), the bidirectional at 21 volts (more stress). Some of the spike will get by the TVS, so adding a capacitor in parallel with D3 will help blunt the spike further, protecting U2. It will also reduce your rise time of the signal going into the phototransistor, so choose carefully. Use twisted pair for the wires to reduce pickup. \$\endgroup\$
    – C. Dunn
    Commented May 13 at 16:21

2 Answers 2

1
\$\begingroup\$

Instead of fixed resistors, use a constant current source. Instead of a shunt diode, use a series Schottky. The circuit below maintains about 14mA through the optocoupler LED for input voltages between 5V and 30V. Q1 should be in SOT-89 or SOT-223 with allowance for heat dissipation through a copper area on the PCB.

schematic

simulate this circuit – Schematic created using CircuitLab

The output circuit is OK as you've done it, although low-pass filtering should be done in firmware since it's trivial, not using an RC filter.

schematic

simulate this circuit

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for your reply. But assuming that I have only one input voltage level (12V) you would change only diode to Schottky and delete RC filter? \$\endgroup\$
    – szymo092
    Commented May 8 at 20:52
1
\$\begingroup\$

In the past we've interfaced with a similar circuit on a piece of military hardware, so I think you are on the right track. Ideally you would do a transient analysis of the circuit, but you need to know the characteristics of the spikes. To start, let us simulate the circuit in LTspice using a DC simulation:

enter image description here

The following has been modified compared to your circuit:

  • D3 was replaced with a 4.7 V Zener diode to limit current into U2 in the event of a spike.
  • R7 and R8 were adjusted because of D3.
  • R3 was added to simulate your microprocessors input resistance. The value was a guess.
  • C2 was added to low pass filter the signal. The value was a guess.
  • D1 was added in case of a negative spike on 12V. This might be unnecessary if you use a uni-directional TVS diode.
  • R2 was added to decouple the input and output grounds.
  • The TVS diode U3 was removed because I'm doing a DC analysis, and didn't want current to flow through it.

Sweeping V1 (the supply driving the 12V line) from -50 V to 50 V we can look at the output at DI0 and the current from V1: enter image description here

When the 12V net is above 4.9 V, DI0 is below 0.3 V. Reducing the value for R7 will reduce the voltage at which DI0 goes low. D1 prevents any current from flowing when V1 is negative. So far so good.

Looking at the power dissipated by the input components: enter image description here

D1, D3, and R8 are less than 250 mW, but R7 is taking a big hit. You have several options at this point.

  • You could use two resistors in series with a M6432 (2512) package to dissipate this power.
  • If you know the characteristics of your pulse, you can choose a pulse withstanding resistor which will handle this power with a smaller package.
  • Choosing the TVS diode U3 correctly will limit current passing through R7.

Obviously, a transient analysis should be done once you know more about the characteristics of the spikes.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.