How to make a working flip-flop?

Hello, I'm trying to simulate a flip-flop design from an electronics kit (re-building from the schematic they provide), but can't seem to get the expected behaviour -- the lights switching back and forth.

The components and design are done pretty faithfully, with the following exceptions:

  • The LEDs are originally supposed to be segments in a digital LED for the number 8. But the 360Ohm resistors are consistent.
  • There isn't a ground in the schematic I have, but adding one seems to get rid of some jittering noise in the simulation.
  • The PNP transistors are a different component: 2SA733 Q, PNP, Si

If I had to guess, I'd say it's not working due to the specs on the transistor (difference in required base voltages or something), but I have no clue of where to start with figuring that out. Any help would be greatly appreciated.

Thanks. Cheers

by haz
February 09, 2013

Hi Christian,

You got it right, “unlisted” for design studies, gooood!

To simulate correctly CL always needs a “GND” (a reference).

Whenever using the TDS together with capacitors you must take care of what is called “start condition”which means you have to switch ON (or ramp up) your power supply after the simulator (here the CL solver) has started to calculate the first point. Otherwise the capacitors are fully “charged” from the beginning and your simulation will fail.

… Sorry, I can’t explain because I do not understand that, I think it’s simply a bug, but the solution is: Add a “time controlled switch” to your battery, set the time to e.g. 0.01 seconds.

Also see a funny discussion about that (read “charge” instead of my “load”):

https://www.circuitlab.com/forums/support/topic/kq6zmn6f/loading-a-capacitor/

In your circuit also increase the stop time to 6 seconds and the time step to 0.1 to see faster and better results.

BTW it’s more common to draw “GND” at the bottom and “+” on top of the schematic.

Regards, Sancho

by Sancho_P
February 09, 2013

Have a look through:

https://www.circuitlab.com/browse/by-tag/initial-conditions/

by signality
February 12, 2013

Thank you both for the response. Now on to actually figuring out how the circuitry works ;).

Out of curiosity, what's the `"+" on top of the schematic' refer to? Voltage source should be placed vertically with the positive end on top?

Thanks again. Cheers

by haz
February 12, 2013

The “+” … I mean usually the positive supply voltage is drawn at the top of the schematic, the ground line (negative, 0V) at the bottom. Thus the primary power source (your battery) is pointing up, on your left or right hand side. It may be only me but I have a hard time to follow otherwise.

;-)

Regards, Sancho

by Sancho_P
February 12, 2013

This is the simplest example from the search I suggested:

It uses NPN transistors so the power supply polarity is reversed with respect to your original PNP circuit.

Unless there's a very good reason to use PNP's, most discrete circuits are based on NPN's with a few PNPs where necessary.

by signality
February 13, 2013

Oh, the switch definitely fixed things up to the expected behaviour. The schematic is from an old kit I dusted off earlier this month:

It comes preloaded with 1 NPN and 2 PNP's, so most switch circuits use the PNP's to get things done.

by haz
February 13, 2013

@haz,

Note that you don't need to use a switch to kick start a sim. The search term I suggested shows many other ways to do it and the particular flip-flop example above just uses a slight imbalance in base resistors to nudge the initial condictions away from equilibrium.

by signality
February 13, 2013

@signality: Really an interesting example, as it starts without switch or ramping up, also when using the battery element. Here capacitors do not start already fully charged (?).

Another question (OK, plural would be better):

From your example, when you move (hint) the label “base” to the real base this voltage goes down to -9V, isn’t that dangerous (Vebo = 6V)? I have to confess I don’t understand the polarity taken from the data sheet and if that (-6V) would happen in reality? A “big” cap would kill the transistor?

@haz: Yes, you do not “need”, but whenever you face any unexpected result you should try that “ramp up” first!

Regards, Sancho

by Sancho_P
February 13, 2013

"From your example, when you move (hint) the label “base” to the real base this voltage goes down to -9V, isn’t that dangerous (Vebo = 6V)? I have to confess I don’t understand the polarity taken from the data sheet and if that (-6V) would happen in reality? A “big” cap would kill the transistor?"

Oops: thanks for that Sancho, I'd not realised I'd put the label in the wrong place!

But yes, the base does swing down to a -ve voltage. That's exactly what you'd expect.

If you were to set V1 to say 5V or 3.3V then the sim would look just like a real circuit. Running at V1 = 10V, the sim is wrong because it does not show the reverse Vbe breakdown of the NPN's that would happen in reality.

And so yes: your are right, big base capacitance could and do destroy tranny be junctions in such a simple flip-flop.

Running them at low supply voltages (< Vbe reverse breakdown) or adding base protection and clamping circuits are ways that such simple designs can be enhanced and protected.

And yes again ... simulator bjt models let us all down badly. As far as I know, none of the spice or spice-like bjt models support reverse Vbe breakdown!

That is probably a legacy of their having being developed for IC design where such bad practices as reverse biasing be junctions anywhere near Vbe reverse breakdown and heavily saturating devices is banned.

Nonetheless it is very frustrating for discrete designers and catches newbies and the experienced out alike on a regular basis.

by signality
February 13, 2013

For the avoidance of confusion: the "base" label is now in the right place.

:)

by signality
February 13, 2013

Uuuups!

Imagine in reality @haz’s circuit only works because of today’s sunshine, and no one could tell how long, let alone what will happen at +60°C.

So this is another example to vote for reasonable element limits with a warning or breakdown / solver stop. A simulator should help to find design flaws, not hide them.

Regards, Sancho

by Sancho_P
February 13, 2013

It's amazing how much good stuff does get done with all this dodgy simulation nonsense!

:)

What's even more amazing is how much people will pay for commercial stuff that hasn't really addressed many of these flaws.

:(

And I've only scratched the surface of many of these "bugs" and "workarounds" after 16 years of intensive simulation work.

It's such a good job that the simulation tools that things like the automotive and aerospace industries use don't have any of these sorts of, um, features.

Imagine if the battery system simulation in an airliner weren't quite right.

Or the EMC susceptibility of the throttle control circuit in a car wasn't modelled in the simulations.

How scary might that be?

:0

by signality
February 14, 2013

!

(I had to add some words, the exclamation mark alone was too short for the forums editor ;-) )

by Sancho_P
February 14, 2013

Post a Reply

Please sign in or create an account to comment.