Maker Pro
Maker Pro

JK FLip Flop trouble - confused.

Krissie

Nov 23, 2010
8
Joined
Nov 23, 2010
Messages
8
In theory this should be simple - build a divide by two circuit with a JK flip flop using a push switch for its clock... but it's not working out that way. is is my circuit, as breadboarded/prototyped...

jkcircuit.jpg


When I turn the circuit on, I expect to find the LED either on or off, and for a button press to toggle it (though I realise that the switch needs debouncing too). What I actually get is the LED flickering a half brightness. When I hit the switch it either goes off or gets brighter (a seemingly random decision as to which).

To make sure it wasn't something to do with the switch itself, I removed the lead from the bace of the transistor to the IC and the LED went out. I also connected the base of the transistor to both Q and !Q outputs on the IC, and the same thing happens on each - flickering at half brightness and random brightening or going off on pressing the switch.

I'm pretty confounded, so if anybody can help I'd very much appreciate it.
 

barathbushan

Sep 26, 2009
223
Joined
Sep 26, 2009
Messages
223
your JKFF connections are right , but the problem is you have chosen a large collector resistor Rc , your led may require 20ma current through it and 2.5 v across it (voltage depends on color) , so you have to lose 4.3-2.5 = 1.8 v [0.7v at the transistor]

so Rc=1.8/20ma=100ohms

also use a 1k base resistor

Now your circuit must work :)


 
Last edited:

Krissie

Nov 23, 2010
8
Joined
Nov 23, 2010
Messages
8
I tried that, and while the flickering stopped, the circuit still failed. I took the resistor from the collector out while the circuit was live and noticed that the LED was still lit, and so while wondering if the transistor might have become damaged, I removed it from the circuit and added a voltmeter...

jkcircuit2.jpg


While the switch is open, pin 15 (Q) supplies between 2.2v and 2.4v at the voltmeter, and pin 14 (!Q) supplies between 2.6v and 2.8v

While the switch is closed, pin 15 (Q) supplies 0v at the voltmeter, and pin 14 (!Q) supplies 5v

... leaving me with no idea what's going on. I've even tried a replacement IC.
 

barathbushan

Sep 26, 2009
223
Joined
Sep 26, 2009
Messages
223
While the switch is closed, pin 15 (Q) supplies 0v at the voltmeter, and pin 14 (!Q) supplies 5v

.

pin 15 and 14 are complimentary to each other so it means that the chip is working fine ,
just replace the transistor and everything will be fine

BTW the way you connected your voltmeter to the 1k resistor is utterly wrong , meaning you have dropped enough voltage at the 1k resistor and your voltmeter is shoowing the residue voltage
 
Last edited:

Krissie

Nov 23, 2010
8
Joined
Nov 23, 2010
Messages
8
pin 15 and 14 are complimentary to each other so it means that the chip is working fine ,
just replace the transistor and everything will be fine

BTW the way you connected your voltmeter to the 10k resistor is utterly wrong , meaning you have dropped enough voltage at the 10k resistor and your voltmeter is shoowing the residue voltage


I made that resistor 1k for testing... sorry.

The problem is, it's not working, because what I have is an LED at half brightness, which goes off at pin 15 while the switch is pressed, or gets brighter at pin 14 when the switch is pressed. What it's supposed to do is provide a push on/push off circuit.. Pins 15 and 14 are supposed to be toggling on each clock pulse, and they aren't. I've connected the voltmeter that way to see what voltage I was getting at the LED... placing the LED inline instead of the voltmeter confirms that the readings are correct - it flickers at half brightness (the 0.2v flickering of the voltage), and while the switch is closed goes bright from pin 14, or turns of at pin 15... the two do not alternate as they should, and nor does pressing the switch result in either Q or !Q being at 0v when the switch is released.

Both Q and !Q are supplying roughly the same voltage. While the switch is closed, Q is always low, and !Q is always high. While the switch is open, both Q and !Q supply 2.2 - 2.4v and 2.6 -2.8v respectively.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
At least one problem is that you are using CMOS and you are leaving inputs open circuit.

Inputs need to be pulled up, or pulled down, but not left floating.

In your circuit, a resistor from pin 13 to ground would be a really good idea. You should do the same thing for all other unused inputs.

Also, it's far better to draw the circuit using symbols to reflect the function that to draw what is more akin to a wiring diagram.

Tie pins 3 to 7 low as well (those are the unused inputs).

Even with a series resistor a reasonable voltmeter should still show a voltage swing from 0V to just short of 5V.

edit: With digital circuits, a LED at half brightness (or an unloaded output not pulled to a supply rail) implies that the circuit is oscillating (or at lerast switching rapidly). I thing the pull down on the clock input is the most likely culprit.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
It's CMOS, just stick the LED in series with the 1K resistor.

Connect the transistor up later if you want a brighter LED (but leave the 1K resistor between the output and the base of the transistor) and use a lower value resistor (say 220 ohms) in series with the LED. Best to have the emitter grounded and the resistor/diode in series with the collector too.
 

Krissie

Nov 23, 2010
8
Joined
Nov 23, 2010
Messages
8
solved

Steve, thank you! I'd kiss you if I could! lol

Grounding al inputs and ading the resistor fixed it. Thankyou!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
This is one of the basic gotcha's of CMOS.

The input impedance is so high that really odd things can happen. An open input can stay stuck at the last logic level (because the input capacitance is charged or discharged) or it can follow some other input or output (because it gets capacitively coupled) or it can just randomly change state due to noise.

Clock inputs are especially sensitive to this sort of thing, and that was one reason why it stuck out like a sore thumb to me.

The really good thing is that some people never experience these types of problems in such a clean and obvious way. You are lucky to have been able to see such a clear cut case, and now hopefully you will be able to spot it in the future (perhaps even before it happens).
 

Krissie

Nov 23, 2010
8
Joined
Nov 23, 2010
Messages
8
Absolutely steve! It's been an enlightening experience :) ... I should have remembered that gotcha, but then, my last electronics class was 12 years ago lol.

@Krissie Finally did you use the transistor , or just stuck the LED in series with the 1K resistor as steve said ??

I'm just using the LED and 1K as steve said at the moment... for purposes of prototyping, it's easier for the time being because the JK toggle is just one part of the circuit... also, my transistor appears to be powering the LED from the base instead of the collector - so I'll come back to that one later. lol...

... I will be using the transistor later though, as I plan on using a 30mA LED.
 
Top