Help with a Flip Flop CD40107BE circuit

Started by bushidov, August 25, 2020, 02:08:48 PM

Previous topic - Next topic

bushidov

Hi All,

So, I am working on a switching circuit that utilizes 2x two-input NAND gates to function as a flip flop for switching. When I use a CD4011, like in the configuration below, it works great:


The output starts low (0V), and if I press the momentary switch, the output goes high (9V). If I press the switch again, it goes back to low (0V), and so on.

However, I feel the 14-pin DIP is a bit of a real estate hog, when I am only using two of the four NAND gates. So, I found a Dual, two-input NAND gate IC, the CD40107BE.

At first, I tried this setup:


It didn't really do anything. So then I looked up the datasheet for the CD40107BE and discovered it needed a 10K pull-up on the output of each gate. I verified this by just powering it and playing with pins 1,2, and 3 to see if it did what I would expect from a NAND truth table, and with the 10K resistor on pin 3, it did.

So, then I tried on a breadboard again to do a flip-flop, but only put the pull-up on pin 3, like below:


Now it just stays high (9V) no matter what. So then I added the second 10K pull-up to the other NAND gate (probably should have tried that first):


No change. Just stays high on the output (9V). If I press the switch, I see the voltage drop from 9V down to like 8.23V, but that's about it.

Anyone know what I am doing wrong?
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry

anotherjim

Try again, but first make sure C1 is discharged to 0v.

bushidov

QuoteTry again, but first make sure C1 is discharged to 0v.
I am not following.
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry

Rob Strand

#3
Try adding a 4k7 resistor between pin 5 and pins 1+2.

Here's an old thread with a similar circuit.   The main difference is the 4k7 resistor.
https://www.diystompboxes.com/smfforum/index.php?topic=120879.0

You could probably ignore most of the thread since you have covered half of it yourself.

With the circuit in this post, keep in mind,
- the pull-ups are through LEDs + 4k7.   Your 10k's should be fine
- the final circuit has a extra cap and stuff so the circuit powers up in a particular state.
  Some options for start-up state are discussed in the post.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.


bushidov

#5
Why would adding 100K resistors or reducing ones to 4.7K make the CD40107 work, but were not necessary on the CD4011?
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry


bushidov

I have seen this done somewhere else, but with only 1x 10K pull up (on the pin 3, but not on the other gate out). I think the problem is the 100K resistor needs to be smaller, like 68K and the capacitor, larger, like 330nF, to make the rise times correct. It definitely didn't have anymore than those two resistors and one capacitor. Now to find those part values somewhere and breadboard it.
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry

Rob Strand

#8
Quote... ur missing 100k between output at pin 3 and pin 5
Both pins 3 and 5 are outputs.
Pretty sure it's between pin 5 and pins 1+2.


FWIW, DOD uses the same idea,
https://www.hobby-hour.com/electronics/s/schematics/dod-fx60-schematic.png
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

bushidov

#9
Alrighty, I got it! And I know how the other board had to have worked!

So, this whole circuit only needs 1 capacitor and 3 resistors, and an LED along with the CD40107.

So, I was partially correct. Step one was that the rise and fall times are very picky with that IC. And this almost would be the end of the story, too.


This works, but I remember the circuit I saw before only had 1 capacitor and 2 resistors. So I was wondering if I have the two pull up resistors, maybe one of them isn't "exactly needed". Then I remember the circuit I saw before had a third resistor, but it was a current limiting resistor for an LED. Then I wondered if I could use the LED and its current limiting resistor as one of the pull ups on the CD40107, and behold!


Works like a champ! It doesn't have a lot of current it can source at the output, but it does have enough to drive a BS170 style MOSFET, and that's good enough for me!
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry