Flip flop fail

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: luketeaford, Joe., lisa, Kent

Post Reply
honeyb
Common Wiggler
Posts: 143
Joined: Sun Jul 29, 2018 1:37 am
Location: Luxembourg

Flip flop fail

Post by honeyb » Sun Sep 15, 2019 10:36 am

Trying to build what should be a super-simple circuit-- using a flip-flop as a clock divider. But it doesn't flip.

Driver circuit is a simple osc. driven by a CD40106 schmitt-trigger (leftmost chip) with output via the white wire. Oscillates at cirac 8hz in current form, if I connect a LED via the resistor to negative (or to ground) it flashes nicely as expected (tried both, the resistor is currently at row 24 heading to the negative rail, LED removed).

Image

The osc. connects by the green and then the grey wires to the clock input (pin 11) of the cd4013 flipflop.

!Q (pin 12) connects to data (pin 9) via the orange wire
Set and reset (pins 8 & 10) are connected via the red jumper, and then grounded via the yellow jumper.

Q outputs via white wire (breadboard 34 to 43),
!Q outputs via brown wire (breadboard 35 to 45).

I'd expect the LED (connected by 1K resistor to white wire Q output, breadboard rows 43/46) to strobe at half the frequency of the 40106 circuit, i.e. around 4 Hz.

No blink. No flip. No flop.

I've been pulling my hair out all weekend over this, lots of different tests/trials. Some tests the LED is on, others it is off, but whatever I try I can't get a nice 4hz blink, or, even better, a red LED on Q, a blue LED on !Q, and alternating blinky lights. The jumpers down below row 50 are from earlier experiments, likewise the small cap at the very top of the board.

What am I missing?

Currently running the circuit off of a 9v battery. The rightmost strip is positive ("J" side of the board), the leftmost ("A" side of the board) is negative. I also created a virtual earth using 2 100K resistors connected to the "+" rail on the "J" side.

However, I get the same (lack of) results when running off of my bench power supply.

User avatar
guest
Super Deluxe Wiggler
Posts: 4360
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Sun Sep 15, 2019 10:45 am

nothing should connect to the "virtual ground" (4.5V). all of the logic should be either 9V or 0V. so move the LED, capacitor, and yellow wire to 0V.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 5489
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Post by EATyourGUITAR » Sun Sep 15, 2019 11:53 am

guest wrote:nothing should connect to the "virtual ground" (4.5V). all of the logic should be either 9V or 0V. so move the LED, capacitor, and yellow wire to 0V.
or he could run the entire thing on 4.5v and use 200 Ohms for the LED resistor. but yeah there is no need for anything to be half the supply here. there are no opamps and no analog signals.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

honeyb
Common Wiggler
Posts: 143
Joined: Sun Jul 29, 2018 1:37 am
Location: Luxembourg

Post by honeyb » Sun Sep 15, 2019 1:49 pm

guest wrote:nothing should connect to the "virtual ground" (4.5V). all of the logic should be either 9V or 0V. so move the LED, capacitor, and yellow wire to 0V.
Remember I said pulling hair all weekend?

I did as you suggested (thanks!), and additionally hooked up a LED to !Q.

Result: the osc LED, Q, and !Q all blinked at the same frequency. As is, they were all on together, and all off together (I slowed down the oscillation to under 1hz to make a visual easier).

No division by two, and again, both Q and !Q were on at the same time.

Interesting thing: I pulled the power connection to the flip-flop. I still saw the above pattern.

I'm wondering if my breadboard is getting old? Could that be it? Something shorting out inside??

Or is the flipflop a bad chip??

User avatar
guest
Super Deluxe Wiggler
Posts: 4360
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Sun Sep 15, 2019 2:08 pm

its possible its a bad chip or bad connection. try clocking it really slow (maybe just jumper the clock line to power and then to ground to create a clock pulse) so that it holds state long enough to make measurements. measure the voltage on all of the pins of the 4013 for both the LED "on" state, and "off" state. its super odd that both Q and !Q are on at the same time.

its possible the chip got damaged by having the inputs at 4.5V, but this failure mode is usually via overheating, which you would probably have smelled. also, its good practice to tie unused inputs to ground (the other half of the 4013).
openmusiclabs.com

Synthiq
Veteran Wiggler
Posts: 571
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Post by Synthiq » Sun Sep 15, 2019 2:21 pm

I think set and reset are active high so they should be connected to 0V and not Vdd.

honeyb
Common Wiggler
Posts: 143
Joined: Sun Jul 29, 2018 1:37 am
Location: Luxembourg

Post by honeyb » Sun Sep 15, 2019 3:11 pm

Aaaand....

It's working. Thanks, all.

guest wrote:nothing should connect to the "virtual ground" (4.5V). all of the logic should be either 9V or 0V. so move the LED, capacitor, and yellow wire to 0V.
I'm going to be running the circuit in Eurorack. Would you recommend then that the logic is +12V, -12V? Or +12V, 0V? In other words, is logic 0 set to ground current (0v) or negative rail current (-12V)?

If I answer my own question, it works with logic zero at -12V. but what do I know?

adam
Super Deluxe Wiggler
Posts: 2956
Joined: Wed Dec 25, 2013 6:24 am

Post by adam » Sun Sep 15, 2019 3:13 pm

0, i don't think the 4000 series like negative voltages

User avatar
guest
Super Deluxe Wiggler
Posts: 4360
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Sun Sep 15, 2019 3:22 pm

yeah, i would run it with +12V / 0V as the powersupply rails. the output will be a square wave going from 0V to 12V, and if you want to use this as audio, you can use a capacitor to shift it down to +/-6V.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 5489
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Post by EATyourGUITAR » Sun Sep 15, 2019 4:46 pm

Look at my joystick module schematic. I am interfacing a CD4000 style cmos with TL072 in both directions. Go to my site, go to synths, joystick, build guide. You can use the opamp like a comparator against a reference voltage 2.5v. the cmos is +12v/0v but the TL072 is powered from +12v/-12v. You can do it without the buffers but you must use diode protection on the inputs of the cmos to protect for reverse voltage.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

honeyb
Common Wiggler
Posts: 143
Joined: Sun Jul 29, 2018 1:37 am
Location: Luxembourg

Post by honeyb » Mon Sep 16, 2019 1:34 am

EATyourGUITAR wrote:Look at my joystick module schematic. I am interfacing a CD4000 style cmos with TL072 in both directions. Go to my site, go to synths, joystick, build guide. You can use the opamp like a comparator against a reference voltage 2.5v. the cmos is +12v/0v but the TL072 is powered from +12v/-12v. You can do it without the buffers but you must use diode protection on the inputs of the cmos to protect for reverse voltage.
guest wrote:yeah, i would run it with +12V / 0V as the powersupply rails. the output will be a square wave going from 0V to 12V, and if you want to use this as audio, you can use a capacitor to shift it down to +/-6V.
Thanks, both of you. :)

User avatar
fuzzbass
Super Deluxe Wiggler
Posts: 2082
Joined: Thu Feb 06, 2014 6:08 pm
Location: Florida, USA

Post by fuzzbass » Mon Sep 16, 2019 5:18 pm

Here is my super helpful suggestion:
Rename this thread Flip Flop Flail. :party:

I dunno if this will help, but when I was designing a couple of years ago with CD4013, it would not behave itself in a cloned divider circuit from the Roland SH-101. I stumbled on amateur electronics threads where people complained that digital clock projects using this chip from the 1980s don't seem to work anymore. The assumption was that TI's improvements over the years have sped the chip up and made some old designs obsolete. See the pic. R61 and C6 have been added to sort of hobble the chip and slow things back down to 1980s speed. Beware, in this setup, if you push the clock up past audio frequencies, the chip will lock up.

PS you are on the right track with using a Schmitt Trigger before the flip flop. That will reduce jitter a lot.

Image
Wired for weird

User avatar
guest
Super Deluxe Wiggler
Posts: 4360
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Mon Sep 16, 2019 5:42 pm

yeah, ive had trouble with 101 flipflop circuit as well. the issue is a glitch propogating from the Q! to the CK. the pins are right next to each other, and the Q! transition is really fast, which can capacitively couple to the CK and cause a runt pulse which resets it. so from the outside perspective it looks like the pin is never changing, when in fact its going high then low in just a few hundred nanoseconds. there are a couple of solutions - the one shown above slows down the D input, so any runt pulses dont clock in a new state. aother solution is to put a bit of capacitance on the Q! pin to slow it down. and another solution is to make sure that the CK drive is very low impedance so the Q! pin can not modify it capactively.

also, i found this in some old schematics i was looking at a while back. i cant remember which synth it was, but it was probably some roland gear:

Image
openmusiclabs.com

Synthiq
Veteran Wiggler
Posts: 571
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Post by Synthiq » Mon Sep 16, 2019 9:34 pm

fuzzbass wrote:Here is my super helpful suggestion:
Rename this thread Flip Flop Flail. :party:

I dunno if this will help, but when I was designing a couple of years ago with CD4013, it would not behave itself in a cloned divider circuit from the Roland SH-101. I stumbled on amateur electronics threads where people complained that digital clock projects using this chip from the 1980s don't seem to work anymore. The assumption was that TI's improvements over the years have sped the chip up and made some old designs obsolete. See the pic. R61 and C6 have been added to sort of hobble the chip and slow things back down to 1980s speed. Beware, in this setup, if you push the clock up past audio frequencies, the chip will lock up.

PS you are on the right track with using a Schmitt Trigger before the flip flop. That will reduce jitter a lot.

Image
With a proper clock, one of my CD4013 worked up to 8 MHz with a 10V supply so it shouldn't be limited to audio frequencies. It is possible you have a problem with the rise and fall times of the clock. When I increased the rise and fall times to 32us or more I also started to see problems with the Q output getting stuck high. The spec limit is 10us @ 10V.

Image

User avatar
guest
Super Deluxe Wiggler
Posts: 4360
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Mon Sep 16, 2019 10:13 pm

the sh101 clock driver is from an npn collector with a 68k pullup resistor. so the rising edge transition is really weak and slow, so the Q! pulse easily influences it via capacitive coupling and it ends up causing a runt pulse. the slowness is a factor because it spends way more time right at the transition region, and is therefore easier to toggle.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 5489
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Post by EATyourGUITAR » Mon Sep 16, 2019 10:32 pm

4013 is a low power cmos. if we start putting caps everywhere it might consume %1000 more power. this would depend on the clock frequency. as for the hysteresis, you can do this with resistors. you are probably wise to keep the schmitt triggers if only to increase the rise times. I never needed it but I guess if people say this is a thing then I believe it. I am curious if the slow rise times people are getting is a side effect of all the PCB and components increasing the capacitance from clocks and Q!->D. if we put very small single strand copper wire from Q! to D would this still be a problem? like maybe there is a sweet spot where the capacitance is enough to make it auto retrigger but not enough to RC filter? feel me?
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
fuzzbass
Super Deluxe Wiggler
Posts: 2082
Joined: Thu Feb 06, 2014 6:08 pm
Location: Florida, USA

Post by fuzzbass » Tue Sep 17, 2019 9:36 am

Now that I think back on it, the additional cap on the CD4013 was to address flipping and flopping back on the same cycle (repeating as opposed to dividing). The schmitt trigger was added so that the divider would yield good results with a variety of input waveforms. I'm sure I understand the workings here less than guest or etit. The choices I made were the result of experimentation on my breadboard, and the conditions were specific to the source signals, which were all from the TTSH.

Here is the entire divider circuit I came up with. The output section has selectors for bipolar or unipolar, and /2 or /4.

Image
Wired for weird

Post Reply

Return to “Music Tech DIY”