1
\$\begingroup\$

I want to set a relay when an object passes an IR sensor.

The IR sensor controls the NPN transistor which powers the relay coil.

It may be that the passing object has some holes which allow the IR sensor and thus the relay to switch off prematurely.

I do not want the relay to switch off when a hole passes the IR sensor.

I figured that I could either put a capacitor to keep the transistor open or I could use a polarized capacitor with a few 100 uF to keep the coil energized for a short period of time.

If I were to use the polarized capacitor it would discharge through the coil. The voltage across the coil would slowly dissipate. I believe this should prevent the back EMF from damaging the transistor, but I am not yet 100% sure. If the relay switches off as a result of a too low voltage, do the moving parts also result in a damaging back-EMF?

Is it perfectly safe to leave the flyback diode out in this configuration?

enter image description here

\$\endgroup\$
12
  • 2
    \$\begingroup\$ Ignoring the pyrotechnics aspect of polarized caps, what exactly will you gain from this? Something like a tantalum or aluminium electrolyte is much more expensive than some 1N400x standard diode. \$\endgroup\$
    – Lundin
    Commented Mar 20, 2023 at 11:21
  • 1
    \$\begingroup\$ I thought I was clear that I don't want the relay to fall off when a hole is passing the IR sensor. I edited the question to make it more obvious. I am aware that diodes are cheaper. The component price is irrelevant for this design. \$\endgroup\$
    – bask185
    Commented Mar 20, 2023 at 11:49
  • 1
    \$\begingroup\$ If you parallel a cap and an inductor (coil), that becomes an LC Tank. The capacitor and inductor "take turns" handing-off current, which manifests as an oscillation above and below zero volts. \$\endgroup\$
    – rdtsc
    Commented Mar 20, 2023 at 11:58
  • 1
    \$\begingroup\$ @rdtsc, a quick simulation with a 3H, 800 ohm coil in parallel with 220 uF shows no signs of ringing - just a nice decay. Those values are from a 24 V relay I measured. See electronics.stackexchange.com/a/487353/73158. \$\endgroup\$
    – Transistor
    Commented Mar 20, 2023 at 12:07
  • 1
    \$\begingroup\$ @Transistor you are right; I simulated this and 800 Ohms = too low quality factor (Q) for it to resonate at all. So adding caps to low-power relays seems ok. But on higher-power relays/contactors/solenoids (say 80 Ohms), it would ring. \$\endgroup\$
    – rdtsc
    Commented Mar 20, 2023 at 17:19

4 Answers 4

3
\$\begingroup\$

I don't think adding C3 really gives you the behavior you want, and it presents some risks. You have to remember that when Q1 closes, the inductor will want to continue discharging current, this is the point of the fly-back diode, to allow a path for this current to discharge. At this point, the current flowing through the inductor raises pin A1 to a higher potential than A2, hence a positive voltage across the diode and a discharge. The diode limits the voltage, otherwise, without the diode, the voltage can increase to dangerously high levels.

C3 might not help you keep the relay open, as it's going to be charged in the opposite direction. At the moment Q1 closes, C3 will hold a positive charge across its terminals, but the inductor will want to produce a negative voltage to discharge its current. It won't, therefore, be able to discharge through the inductor, and you've created an LC tank that will possibly resonate, or possibly destroy the capacitor. I ran a quick simulation to show what I mean, note the starting conditions, Vcap = 12V, Lcurrent = 0.1 uA. The values are arbitrary but they demonstrate the point. The red curve is the voltage across R1, which is standing in for the closed transistor, and the green is current through the inductor. R2 and R3 stand in for wire losses. Image of simulation

In this instance, I get obviously a silly value of current, but hopefully, it demonstrates the point. In reality, you might be able to tune and damp this to get a more desirable behavior, but I wouldn't recommend it. [edit] The various values here are just arbitrary, and I'm not proving it will oscillate, just showing it could. Equally, you can get very high voltages with this circuit, which comes back to the need for a fly-back diode [/edit]

As for your intent, to add some time delay to the control to compensate for short dead times, I'd recommend conditioning your signal. I don't know exactly what your control signal is, so I can't give specifics, but I'm going to assume you're able to buffer it to some kind of digital format. One you're input is more or less digital, you can then condition it. singal conditioning image

In the above image, D1, C1, and R3 produce the trace in green. C1 and R3 form a RC filter, D1 stops the input from discharging the circuit and allows the slow discharge through the resistor. Pass this to a comparator, compare it to another value and you've got a way or removing a small dead time from your signal. R4 could be replaced with a MOSFET to drive the relay, or you could directly drive if your op amp is beefy enough. It's just then a matter of crunching the numbers and getting the times you want. You could replace R1&2 with a variable resistor so you can tweak this in situ.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ If you put in some realistic values (say C = 10u, C ESR = 1, coil ESR = 100, coil L = 100m) I think you will find the ringing goes away. It would also be hard to have Q > 1 for any value of coil and electrolytic I can think of. \$\endgroup\$ Commented Mar 20, 2023 at 13:40
  • 2
    \$\begingroup\$ Obviously, the simulation is poor, as 100A is unrealistic, but my point is more that the circuit could potentially oscillate though this might be unlikely, or produce dangerous voltages. If I use your values, you are quite right there's no ringing, but the voltage across R1 jumps to 100V - and that's for a low value of IC = 100 uA. I will make a mild edit to make sure this is clear though \$\endgroup\$
    – LordTeddy
    Commented Mar 20, 2023 at 13:49
  • 1
    \$\begingroup\$ Huh, how does that make 100V? 100uA in 100mH is 500pJ is 10mV in 10uF. Even at saturation (I_L(0) = 12V/100R) the peak is only 12V, or 24 total at the switch. (Notice your 100A peak value comes from the capacitor's IC and the loop's extremely low resonant impedance.) It's not just that it's "unlikely" to produce dangerous voltages--it's provably impossible given a modest constraint on component values (namely, C > L / DCR^2). \$\endgroup\$ Commented Mar 20, 2023 at 14:33
  • 1
    \$\begingroup\$ I changed the values in the simulation, and that's what came out. I'm not pretending my simulation is absolute, or even very good, and there's hardly any point crunching specific numbers unless the OP includes them, I'm just indicating potential problems. As for impossible, well that depends on your definition of dangerous. Any negative voltage across a polarised capacitor would be dangerous IMO, so that's any value Vr1 > 12 V \$\endgroup\$
    – LordTeddy
    Commented Mar 20, 2023 at 15:15
1
\$\begingroup\$

For your application you want your IR sensing system to ignore a brief loss of the IR signal because "the passing object has some holes". This describes a form of low pass filter (rejects high frequency changes). This is something the addition of a capacitor could do, however implementing this on the relay end presents problems (high current requirement, high voltage condition). On the transistor circuit adding a capacitor is more feasible as the transistor requires less current to enable. You might also look into adding a capacitor (or a resistor and capacitor) near the IR sensor to implement a low pass filter. Keep in mind however that adding a simple passive low pass filter might also delay the turn on of the relay.

A much better option, if you are controlling the transistor with a microcontroller, would be to implement a conditional low pass filter in software. Just implement a short delay after loss of the IR signal, after the delay recheck the IR sensor, disable the transistor only if the IR signal is still missing. The length of the short delay would depend on the size of the holes in the object. The software option allows you make the low pass filter conditional, (filter only after the loss of the signal).

But finally, even if you implement a filter or delay option, keep the diode on the relay, few other components can survive a high voltage spike, (which is what the diode prevents).

\$\endgroup\$
3
  • \$\begingroup\$ Adding a capacitor on the transistor (base) side has its own problems - when the capacitor will be discharging, the voltage will drop slowly and will leave the transistor in a semi-opened state for a little while. This will lead to increased heat dissipation on the transistor and possibly require additional measures to prevent. \$\endgroup\$
    – floppydisk
    Commented Mar 20, 2023 at 14:00
  • \$\begingroup\$ @floppydisk - There are numerous ways to add an RC delay to a transistor switching circuit that does not involve leaving it in a linear mode "for a little while". \$\endgroup\$
    – Nedd
    Commented Mar 20, 2023 at 16:12
  • \$\begingroup\$ Yes, but those come with trade-offs too. For example, none are as simple as just slapping a capacitor on a relay. \$\endgroup\$
    – floppydisk
    Commented Mar 20, 2023 at 17:24
1
\$\begingroup\$

Here is a simulation for 12V relay with a 400 ohm coil, and a TC of 40 ms. I added a 100 ohm resistor in series with the capacitor, to limit the surge current at turn-on. Power dissipation of the transistor is only about 500 mW during the linear transition, which lasts only about 50 ms.

Delayed opening DC relay

\$\endgroup\$
1
\$\begingroup\$

I tested the relay circuit using a 5V relay, 470uF capacitor, LED as flywheel diode. I switched the relay by simply hotwiring 5V to the appropiate pins. I have not used a transistor.

Without the capacitor, the flywheel LED sparks nicely when I cut the power. It did not die within the first 20 attempts, perhaps it might after 200 more tries.

With the capacitor, the flywheel LED does not give a kick, not even a small one. It does flash if I disconnect the wires too fast. The capacitor is not charged enough at that point to slowly decay the current through the coil, but if the capacitor was fully charged there was no visible back EMF.

The fall-off delay was not even remotely noticeable. The relay falls off as fast as if there was no capacitor.

I tried adding a 100R resistor in series with the capacitor in the hope to limit the current and thus draining the capacitor more slowly. No effect.

If the conditions are right, you could use a polarized capacitor as substitute for a flywheel diode, but of course you do not gain anything by doing so and it is less stable, less safe, it costs more and it requires more space.

To use a capacitor to slowly let a relay fall off cannot be done easily. It may work if you have a bucketload of farads, but it is not worth experimenting. I will be a looking into a low pass filter on the transistor side.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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