Logic Switching Problem

Thread Starter

liquidair

Joined Oct 1, 2009
192
Hi All,

I am having a problem with switching circuitry using CMOS Logic. The simplified schematic I've attached shows what I am trying to do. I have 2 banks of relays (A,B,C, and D,E,F) and I want to cycle between them, but when one bank is selected, the other bank switches off.

I have built and tested the circuit and it works sort of, but I can't figure out the sort of part. Both banks work fine when they are selected, the problem lies with the unused bank. If say bank "A,B,C" is on, and E is the relay selected, then the 4017 outputs a 12V to it's gate, but D and F also see 5-7V (rising slowly too) when I expect 0V. All of these relays are then turned on.

I've tried strapping a high value resistor across the bank MOSFETs, thinking the floating 12V was a problem. I then added a second high value resistor across all of the relay MOSFETS, and I've tried removing pulldown resistors (not shown on the schematic) and nothing has worked. This is my first real foray into using Logic as switches so I'm completely stumped.

Anyone see anything or can point me to a solution? Thank you in advance!!
 

Attachments

Thread Starter

liquidair

Joined Oct 1, 2009
192
Crutschow, good pick-up!

I have been mulling over the appearance of the voltage on those gates for so long now that I didn't realize that yes, at least some of the unselected bank relays are on (not all though because when I push the toggle to cycle through D,E,F I hear clicking even when Q21 is off (or supposed to be) and that shouldn't be happening.

That gives me something to look for.
 

ScottWang

Joined Aug 23, 2012
7,409
The connection of clk input, may cause the oscillation, if you have the scope, then you can measure the Q or /Q of CD4013.

If you don't have the scope, then you can add a 0.1uf~1uf cap and use DC voltage meter to measure the Q or /Q of CD4013, if there is any voltage shows up, it means that there is a oscillation occurred.

Change the connection of clk input, it may avoid to occurs the oscillation, take R7,R8 to the input side of clk and another pin connecting to ground, shorted the orignal position of R7,R8.
 

Thread Starter

liquidair

Joined Oct 1, 2009
192
Guys, I think I found something. I checked for oscilation and I did find some a small amount of high frequency noise, maybe about 5-10mV or so. I decided to simplify the problem and remove one of the CD4017s. To my surprise, we got the same results!

The problem seems to be the protection zeners for the MOSFETs. When a bank is off, say Q21, the source voltage on Q21 should be roughly the supply voltage. In this case it was 5-7V as stated in the OP (which is low meaning relays are drawing current, but this forward biases the zener diodes so this appears on the MOSFET gates, -0.7V. What I didn't show on the diagram was the LED indication circuit which is simply switched by a 2N3904. This is the path for the "off" bank relays to still be "on".

Knowing this now, do I need the zeners for protection? When is this important and when is it not? Any insight into this?

Thank you for your help guys!
 

praondevou

Joined Jul 9, 2011
2,942
Is there any specific reason to use two Mosfets in series?

In your first post you say A B and C are ON. Does that mean Q1 Q2 Q3 and Q20 are conducting? That would also mean that Q21 is OFF.

So it doesn't matter what signal you send to E, the transistors are in series with Q21 (which is OFF).
I guess you could use the ENA input of the 4017 to select one bank or the other. Can you describe what exactly this circuit is supposed to do? (Sequence diagram)

Then, I think it was mentioned, while the switches are open, the CLKs are floating. An undesirable condition. I would not use R7 and R8 , instead put a pull-down resistor from the CLKs to ground and a 100nF in parallel with the resistors.

A small oscillation of 5 to 10mV is not your problem.

Also, are there bypass caps on the ICs?

EDIT: just looked at it again. You already had the answer. Of course the sources of DEF are floating when Q21 is off. If you put a resistor over Q21 and try to turn on E then the voltage at it's source will depend on the voltage divider made out of the relay and the resistor.

Putting these Mosfets in series is really not the right way. Use some logic gates for each side to couple the output of the FF with the outputs of the 4017 . Or just use bigger gate resistors for the upper MOSFETs and use the bank MOSFETs to short the gates of the bank that should be off to ground.
 
Last edited:

Thread Starter

liquidair

Joined Oct 1, 2009
192
Thank you praondevou!

Is there any specific reason to use two Mosfets in series?
Yes, I am trying to go for an "AND" function with priority given to the ground referenced MOSFETs. The ideal circuit functions such that if I want A to be "on", then the correct bank must be selected as well.

In your first post you say A B and C are ON. Does that mean Q1 Q2 Q3 and Q20 are conducting? That would also mean that Q21 is OFF.
I sorta mislead by my wording in the first post, I only want one of those conducting at a time, so "A, B, or C" or "D, E, or F".

Your idea of using the enable input is brilliant, but the reason I want to do it this way is that I want status indication of what the other bank is doing(I didn't show this circuitry). So, for example, if A is selected and is the "on" relay, I want to see that if I switch banks, i would jump to say E. If I wanted to jump to F instead, then I could change that before I switch banks.

What was happening is that if I was trying to get "A" on, I would get "A", but also some combination of D, E, and F. If I switched banks, then whichever of D, E or F was actually supposed to be on would be on, and also I would get some combination of A, B and C.

I just removed the protection zeners, and this behavior stopped. The relays on the "off" bank were finding a path to ground through them and the LED transistors (not shown in the diagram, all the LEDs were lighting up as well).

To answer the other questions, I did decouple the chips (100nF Cer right up against the chip) and I do have pull down resistors, I just didn't draw them in.

So how do we keep the MOSFETs safe? Do we even need to? I just found some new power BJT's in the same package, is that the better way to go?
 

praondevou

Joined Jul 9, 2011
2,942
I personally would not use these Mosfets in series. I'd prefer something like this:



If the current found a way through the zener diode, does that mean that the supply voltage for the relays is not 12V, but higher?
 

Attachments

Thread Starter

liquidair

Joined Oct 1, 2009
192
Gotcha, I that way I could still run the panel indication off of the 4017 before the 4081's. Out of curiousity, what is the function of the new capacitors, C1 and C2?

The voltage is slightly higher than 12V, but because one of the MOSFETS is always on regardless (Q1, Q2, or Q3 for example), when Q20 is off, all of the sources see ~12 too. Since 2 of the gates should be at ground, the 2 zeners protecting those MOSFETs are forward biased, so the zeners act as a diode. But I've got those damn 2N3904s in there for the LEDs (setup exactly like the MOSFETs), so the relays still turn on.

I really think your circuit is a better way to go though, I actually was going to do this originally but I can't remember why I didn't. Thank you again!
 

praondevou

Joined Jul 9, 2011
2,942
Out of curiousity, what is the function of the new capacitors, C1 and C2?
A common switch being activated will bounce for some ms. The capacitors should avoid multiple positive going clock pulses when pressing the buttons.

The optimum values of the R and C depend on how long the switch takes to stay in its final position and the maximum allowed rise time of the clock pulse to the 4017.
 
Top