Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

OR Gate & Relay Circuit

Status
Not open for further replies.
spec, you got any ideas for that diode-phenoma?
Hy fezder,

Given the circuit- no.

I can only imagine that the OP connected the diode the wrong way around and the transistor was thus taking gulps of current that caused the power line to collapse and then recover and that set up an oscillation, but this is a remote possibility.

Another long shot would be that with the inductance of the coil and some feedback mechanism, the layout formed an oscillator, but once again this is pure speculation.

Like you, I am intrigued, but I feel sure that if we could get our hands on the circuit we would soon get an explanation.

spec
 
Last edited:
You are all missing the problem.
did you terminate all open CMOS inputs used with switches with a resistor? 1~100k to Gnd, close to chip.
Your big problem is all Wires must be twisted pairs with ground both on inputs and outputs more than 1" and two good decoupling caps on top or beside the chip with the proper voltage on supply. The relay coil will kick back large currents causing crosstalk, so these need to be twisted pair too. AWG30 magnet wire is sufficient with 12 turns per inch or so.

So 4 problems. Simply fixes.
Drop 5V to 4.3 with a diode for 74AC chip,
add caps to Vcc, of 4.3V
add diode to shunt reverse coil EMF, as mentioned already.
Use twisted pair for long wires.
Add pull-down R 's if you forgot to 4.3V, as I just did...to all CMOS inputs to SPST switches to 4.3V and NOT 5V!!!

Rb must guarantee Ic/Ib>=10 so for 30mA coil , you were a bit low with only 2.5V or 2.5-0.7= 1.6 mA or about half of what you needed. Ib on each transistor must be >=3mA , pref <5mA.

Spec'scct I saw omitted the reverse diode which protects the 2N2222 from premature failure due to secondary breakdown.
 
You are all missing the problem.
did you terminate all open CMOS inputs used with switches with a resistor? 1~100k to Gnd, close to chip.
Your big problem is all Wires must be twisted pairs with ground both on inputs and outputs more than 1" and two good decoupling caps on top or beside the chip with the proper voltage on supply. The relay coil will kick back large currents causing crosstalk, so these need to be twisted pair too. AWG30 magnet wire is sufficient with 12 turns per inch or so.

So 4 problems. Simply fixes.
Drop 5V to 4.3 with a diode for 74AC chip,
add caps to Vcc, of 4.3V
add diode to shunt reverse coil EMF, as mentioned already.
Use twisted pair for long wires.
Add pull-down R 's if you forgot to 4.3V, as I just did...to all CMOS inputs to SPST switches to 4.3V and NOT 5V!!!

Rb must guarantee Ic/Ib>=10 so for 30mA coil , you were a bit low with only 2.5V or 2.5-0.7= 1.6 mA or about half of what you needed. Ib on each transistor must be >=3mA , pref <5mA.

Spec'scct I saw omitted the reverse diode which protects the 2N2222 from premature failure due to secondary breakdown.

Hy Tony,

I cant see that anyone is missing the problem. Perhaps you have not read all the posts in this thread.

As previously stated, the problem is that the original circuit oscillated/induced hash for the reasons already stated. We have already described fixes, which I judged not to be to be worth the effort. Instead my circuit fixes the problem by eliminating the source, rather than sticking plasters all over the place. It is also simpler, smaller, easier to build, more expansible, and less prone to oscillations/pick up, never mind how many additional measures are taken with the original gate.

The relay is only 30ma and the supply line is only 5V so an up swing catching diode is not necessary for a 2N2222 which has the following characteristics.

(1) Vceo: 40V
(2) Vcb0: 75V
(3) Icm= 600mA
(4) Ptot= 625W

It is conceivable that a down swing could reverse bias the transistor EB junction via the forward biased CB junction but the resistance in the base circuit does limit the current and would tend to absorb the energy in the relay coil . Even though I have not seem any significant up and down swings from this type of relay, for belt and braces, it may be wise to fit a couple of 1N400x diodes, one from the collector to the 5V line and one from the collector to the 0V line.

Your statement that the transistor has to have Ic/Ib =10 is not an absolute truth as I have said before. It is a specification condition used in data sheets to measure deep saturation. I have used Ic/Ib= 50 which is more than adequate, especially as that is calculated with an input voltage of 2.5V, rather than the full 5V. The objective in not necessarily to put the transistor into deep saturation, but to provide sufficient voltage and current to operate the relay. The must-operate voltage for the relay is only 4V. The 2N2222 has an hFE of around 200 with a VCE of 1V, so it will have an extremely low VCE, more than low enough to operate the relay. Besides which, it would have been a trivial exercise to push more base current into the 2N2222, but it is simply not necessary or desirable.

Finally, the proof of the pudding is that the circuit works, as stated by the OP.

spec

Data Sheet 2N2222
https://www.onsemi.com/pub_link/Collateral/P2N2222A-D.PDF

Data Sheet Omeron GSV-1-DC5 Relay
https://www.omron.com/ecb/products/pdf/en-g5v_1.pdff
 
Last edited:
Alternate solution should be acceptable but collector voltage will reach abs. Max breakdown, which affects reliability from V=L*dI/dt


Relay chattering can be from insufficient drive current and modulated by oscillations in the unused- unterminated OR gate with EMI feedback from the an unshielded diode spike causing more oscillations. ( I was visualizing lots of EMI issues)

>>Spec
What collector voltage did you expect at turn off without a diode and V=L*dI/dt for the relay ( assuming no catch diode inside )... the ideal location is across the coils if far away.
 
Last edited:
You beat me to it Spec, I was going to suggest a diode or gate. Good to see it resolved successfully.

Mike.
 
Alternate solution should be acceptable but collector voltage will reach abs. Max breakdown, which affects reliability from V=L*dI/dt
As I mentioned I have not seen fantastic back emfs from this type of relay.

Relay chattering can be from insufficient drive current and modulated by oscillations in the unused- unterminated OR gate with EMI feedback from the an unshielded diode spike causing more oscillations. ( I was visualizing lots of EMI issues)

The relay has more than sufficient drive as already stated.

The OR gate is terminated by the B/E resistor

What collector voltage did you expect at turn off without a diode and V=L*dI/dt for the relay ( assuming no catch diode inside )... the ideal location is across the coils if far away.
At the very most I would expect around 10V. Don't forget, the collector circuit comprises the resistance of the relay coil, which predominates, the inductance of the coil, and capacitances. As a result, the waveform at the transistor collector is not due to the dI/dt of a perfect inductor, but more like low Q resonance.

I do agree though, as fezder said early on, that it would be wise to fit up and down catching diodes.

spec
 
Last edited:
You beat me to it Spec, I was going to suggest a diode or gate. Good to see it resolved successfully.

Mike.
Hy Mike,

Simplest is the best.

As you imply, if you had input drives of 5V at 30mA, you could do the whole thing with just three 1N400x diodes.:happy:

Chuck
 
Last edited:
I guess you are right, the load resistance of the moving contact reduces the Q of high inductance coil, so that the open circuit voltage is rises to
As I mentioned I have not seen fantastic back emfs from this type of relay.



The relay has more than sufficient drive as already stated.

The OR gate is terminated by the B/E resistor

At the very most I would expect around 10V. Don't forget, the collector circuit comprises the resistance of the relay coil, which predominates, the inductance of the coil, and capacitances. As a result, the waveform at the transistor collector is not due to the dI/dt of a perfect inductor, but more like low Q resonance.

I do agree though, as fezder said early on, that it would be wise to fit up and down catching diodes.

spec

Although I agree with your comments, the fact was the relay chattered and got worse with a kickback clamp diode. These all indicate insufficient drive current during switching for a "magnetically saturated relay " and stable operation. As the CMOS devices have high gain ( OR= 2 stages of x10 ) and high bandwidth in linear operation (during output transition), layout and complex EMI stray coupling must be reconciled in the design and layout, even for a simple switch with debounce, back-emf clamp, shielding and common mode noise.

The non-linear effects of a diode on an inductor with stray capacitance are known to induce 0.7Vpp oscillations to form an envelope bursts of UHF RF which can be rectified by diode inputs from stray wire coupling ( non-twisted pairs) which can in turn introduce disturbances to the input signal integrity of the CMOS and result in chaos ( as observed). My suggestions would have isolated these issues. It means when using relays and CMOS, once needs more care with EMI emissions and susceptibility for signal integrity, which has a variety of methods for filtering, snubbing, PCB ground plane, twisted pair, shielding etc.

That was my point.

I agree for a open layout setup, simple DIODE OR logic is a better solution and avoids these sensitivity issues. Contact bounce adds even more drama ( EMI chatter) from the input switch and the output relay contact current surge and coil diode current surge.)
 
Last edited:
I guess you are right, the load resistance of the moving contact reduces the Q of high inductance coil, so that the open circuit voltage is rises to


Although I agree with your comments, the fact was the relay chattered and got worse with a kickback clamp diode. These all indicate insufficient drive current during switching for a "magnetically saturated relay " and stable operation. As they CMOS devices have high gain ( OR= 2 stages of x10 ) and high bandwidth in linear opeartion (during output transition). The non-linear effects of a diode on an inductor with stray capacitance are known to induce 0.7Vpp oscillations form envelope bursts of UHF RF which can be rectified by stray wire coupling ( non-twisted pairs) which can be introduce disturbance to the inductive wire inputs to the CMOS and result in chaos. My suggestions would have isolated these issues. It means when using relays and CMOS, once needs more care with EMI emissions and susceptibility for signal integrity, which has a variety of methods for filtering, snubbing, PCB ground plane, twisted pair, shielding etc.

That was my point.

I agree for a open layout setup, simple DIODE OR logic is a better solution and avoids these sensitivity issues. Contact bounce adds even more drama ( EMI chatter) from the input switch and the output relay contact current surge and coil diode current surge.)

The odd action of the relay was with the OP's original circuit which had tons of base drive and we know that the original circuit had major problems. My circuit has no problems as the OP has reported.

This is only a simple transistor driving a low current relay!

By the way, you will be pleased to know that I have amended my circuit to include + and - catching diodes.

spec
 
"Pin 11 will show about 2.5v - 2.8v"

With 0.7V for Vbe , the 1K resistor current to base drive would be 1.8 to 2.1mA.

I would have designed it for 10% Ic or 3mA for improved saturation and increased relay current and reduced contact bounce for extended life. ( for a 12V coil perhaps you can get away with 50:1 ratios on Ic:Ib )

If you assumed Vce was 1V and Relay is guaranteed to switch at 4V min., one must keep in mind the force and acceleration of contacts is also reduced 20% so the risk of contact chatter is far greater with layout immunity issues.

Contacts will close ( spec guaranteed) but will take longer to switch and contact bounce will occur and bounce time will be extended. Thus with addition loss in signal integrity on the drive current and voltage drop, the tendancy for contact bounce increases. When it is too much , we call it chatter.

If there is an inductive load ( e.g. motor) the contacts will wear significantly faster as each operation is not 1 but many bounce operations with slower switching. OMRON Relays ( world's best) are rated for a ~ million mechanical operations, as I recall, but this reduces to many orders of magnitude quickly with accelerating factors like arc current and contact bounce.
This why DC contact ratings are always far less current than AC ratings with inductive loads for the same life expectancy.

This relay p.n. has gold plated contacts ( as all Relays do for low current rated <2A) and is not indend for motors where 8x surge current can burn out the gold plating, resulting in rapid degradation.

This may not be relevant since pertinent details were excluded, but I think it is worth mentioning to other readers for all applications. These are also mandatory design rule checks (DRC, DFM) from my experience.
 
Last edited:
We once used OMRON Relays for Jeep Cherokee leather seat heater control boards, and made millions of them 15 yrs ago.
  • To qualify the design, the process and the reliability, Chrystler engineers had drivers take Jeeps from Detroit to the Arctic circle in winter. They operated many devices until failure. They inspected every step of the process from procurement to shipping (JIT).
  • OMRON flew its quality engineer to feel the vibrations on our pick & place equipment for an indication of maintenance quality.
  • Scandmec and Johnson Controls (JCI) verified the many design details including flammability and water proofing of our conformal coating process.

And this was just a simple under seat heater control board with relay that cost $5 to make with 30% margins.
 
Last edited:
"Pin 11 will show about 2.5v - 2.8v"

With 0.7V for Vbe , the 1K resistor current to base drive would be 1.8 to 2.1mA.

I would have designed it for 10% Ic or 3mA for improved saturation and increased relay current and reduced contact bounce for extended life. ( for a 12V coil perhaps you can get away with 50:1 ratios on Ic:Ib )

If you assumed Vce was 1V and Relay is guaranteed to switch at 4V min., one must keep in mind the force and acceleration of contacts is also reduced 20% so the risk of contact chatter is far greater with layout immunity issues.

That is an invalid assumption. Both circuits will have a 100 milivolts or so at the collector, giving 4.9V across the relay coil. The relay coil is voltage driven not current driven. It make very little difference how much current you pump into the base of the transistor after collector voltage saturation.

2016_04_20_ETO_P2N2222_SATURATION_GRAPH.png

May I suggest that you build the circuit and measure the collector voltage for yourself. You can use a resistor in place of the relay coil for the exercise. It should only take a few minutes.

spec
 
The EMF electromotive force is proportional to current. It applies to voltage only in the steady state where coil inductance has no effect.
Relays like bipolar switches can and will oscillate when they do not saturate sufficiently in the linear mode during transition with stray noise.

I only attempted to explain the relay chatter.
but I failed... I still agree your solution is better, just that the root cause was overlooked.

hFE is the linear gain rated from 35 to 800. Designing for worst case is best practice and using 10:1 ratio ensures this . Motorola called this the "beta overdrive" factor for reliable switching.

50:1 may be OK for diode OR for 99% of all devices, but not OK for 74ACxx running at 5V, due to EMI issues and lack of saturation margin.

In a noisy environment without shielding and excessive Vcc for 74AC devices makes it more sensitive to generating and receiving noise. excessive high dv/dt and high gain during input switching with possible shoot-thru conduction spikes from output stage, internal to the chip operating above absolute maximum of device rated for 3.6V with abs. max of 4.6V, running at 5V.

When we want a reliable design , I use 6 sigma methods which means using worse case. Your Graph indicates the variation for a "nominal device" with an hFE of 200 @10mA
I believe the worst case for 10mA is an hFE=75 @25'C

The problem initially stated is not satisfied by a passive load test with a nominal device, rather with actual design issues and transients overlooked details in layout, excessive Vcc, lack of filtering and shielding, which was what I attempted to describe.

The EMF electromotive force is proportional to current. It applies to voltage only in the steady state where coil inductance has no effect. Thus it is the transient effects of EMI that induced the chattering which did not have tons of base current, but adequate for nominal hFE and low sensitivity diode OR inputs.

Relays like bipolar switches can and will oscillate when they do not saturate sufficiently in the linear mode during transition with stray noise with negative feedback.

I just pointed out that the root causes were neglected and now I failed to convince the readers.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top