# Problems clocking a cd4027 with 74hc74

#### animationman

Joined Apr 3, 2018
12
As I am novice to electronics I took on a project with a model monorail . It has a 20 volt li-ion battery to run a 24vdc brushless motor. It runs on a track that has charge buss at each end . Sensors see the train before entering the charge buss and engage a timer relay to turn it on for X seconds. The charge charges the battery and shuts the motor of because it runs on an H-bridge that has 5 vdc enable and left and right pwm terminals . The lpwm and rpwm are just recieving a 5 volt hi or low to reverse polarity when the charge buss turns off enable goes hi and the train takes off in the opposite direction. A cd4027 toggle Q and Q not to left or right pwm term on the H-bridge. The 4027 is clocked with a 74hc74 all running on 5 volts from a lm317 regulator.However , it is not consistent and not sure why. It works perfectly on the breadboard so I etched my own card using Ki Cad and it works fine in the shop. Why would the 4027 not be consistent ? Im at a loss. I also have a battery cut off circuit so that if the battery goes below 12 volts it shuts the whole thing down.

#### Attachments

• 43.4 KB Views: 54

#### ebp

Joined Feb 8, 2018
2,332
The circuit between the HC74 and 4027 looks OK, but Q1 is upside down, assuming that it is intended to discharge C2 through R5.

[EDIT:] I don't understand the intent of D7 and R6 - it is not wrong but I don't see a purpose. Same for using two separate voltage regs if both are set for 5V output . Remnants of different initial design?

Last edited:

#### crutschow

Joined Mar 14, 2008
27,212
A number of curiosities in your circuit.

What is the purpose of D7 and R6?

What is the purpose of Q1 with its collector going to ground? It can't operate as a normal transistor in that configuration.

What's the purpose of C1?

Suggest the next time you design a circuit, your post it here for review before you build it.

#### ScottWang

Joined Aug 23, 2012
7,024

#### MisterBill2

Joined Jan 23, 2018
8,761
I suggest that the circuit is far more complex than it needs to be, And that driving a cmos flipflop with a TTL device and the diode in between may not deliver enough voltage and a fast enough rising edge. And the analog timer using an opamp is not the best choice. You could use a 555 timer IC and have a more reliable system.
And since you say the breadboard circuit did work and the PCB does not, my guess is that the circuits are not quite the same. That sort of problem happens a lot.

#### crutschow

Joined Mar 14, 2008
27,212
driving a cmos flipflop with a TTL device
The 74HC14 is a CMOS version of the old bipolar TTL devices.

#### MisterBill2

Joined Jan 23, 2018
8,761
The 74HC14 is a CMOS version of the old bipolar TTL devices.
OOPS!!! You are right. That leaves there being some difference between the prototype and the production as a logical explanation.
"I never claimed to be infallible or invincable" . Fortunately I have not been vinced.

#### animationman

Joined Apr 3, 2018
12
The circuit between the HC74 and 4027 looks OK, but Q1 is upside down, assuming that it is intended to discharge C2 through R5.

[EDIT:] I don't understand the intent of D7 and R6 - it is not wrong but I don't see a purpose. Same for using two separate voltage regs if both are set for 5V output . Remnants of different initial design?
The resistor is to keep CP from floating. I will remove it ,Im taking the the 74HC14 will keep it stable? Also ,on the breadboard I noticed that the clock pulse input had a couple volts on it so I put a diode in there thinking it would backfeed into my schmitt trigger. Ill remove the resistor and diode and flip the transistor correctly my mistake for sure. The extra voltage regulator was because for dir 1 (Qnot) and dir 2 (Q) are for the gates of the HBridge which is a BTS7960 that purchased from Amazon. They seem to pull a little more current . I have a heat sink on that one. Also, I had to put a cap C1 across the coil of the relay because the it vibrated on and off because the opamp reacts pretty fast when the transistion of the common of the relay is mid state the opamp tries to turn it on then off really fast.That is for the battery so that it doesnt go below 12volts as it is a dewalt 20 volt battery. I have an adapter it slides into and decided on 12 volts because when a dewalt drill stops and needs charging its always at 12 volts if it goes below 5 the maintenance circuit will make the charger fault and usually have to throw away a 70$battery. Forgive me if I sound very novice its because I am. I have only learned from reading and videos but its very addicting. I thank everyone's input as a matter of fact this was my first post. Ill update after the changes were made to my crazy circuit. BTS7960 43A A number of curiosities in your circuit. What is the purpose of D7 and R6? What is the purpose of Q1 with its collector going to ground? It can't operate as a normal transistor in that configuration. What's the purpose of C1? Suggest the next time you design a circuit, your post it here for review before you build it. #### BobaMosfet Joined Jul 1, 2009 1,776 Nearest I can tell is that Q1 is used to ground one side of a voltage divider (R5) while letting the other side remain high (R4), thus causing the inverter U4A to flip-flop it's output. R5 feeds signal to U4A, while R4 feeds Vcc to U4A. #### eetech00 Joined Jun 8, 2013 2,361 Hi Why so many LM317's? eT #### crutschow Joined Mar 14, 2008 27,212 Also ,on the breadboard I noticed that the clock pulse input had a couple volts on it so I put a diode in there thinking it would backfeed into my schmitt trigger. The input is just that, an input. It generates no voltage, so I don't know where that couple volts is coming from. The resistor is to keep CP from floating. I will remove it ,Im taking the the 74HC14 will keep it stable? Yes, as long as he 74HC14 is powered and has a proper input signal voltage, its output will be a stable high or low. #### dl324 Joined Mar 30, 2015 12,871 Forgive me if I sound very novice its because I am. I have only learned from reading and videos but its very addicting. I thank everyone's input as a matter of fact this was my first post. Given that you're a novice, it's understandable that your circuit and schematic are terrible. If you're older than 12, there's no excuse for your grammar. Use paragraphs to organize your thoughts. What is the input voltage to the regulators? You're using too many voltage regulators. The inverter and flip flop need to be operating at the same voltage, so you only need one voltage regulator for them. If the logic is operating at 5V, you don't need the two LM317 and can power them all from the 7805. You're using an LM324 as a comparator and are trying to drive the relay coil high side. This is a bad idea because the opamp output is only guaranteed to get within 1.7V of Vcc (3.3V with Vcc=5V). If you want to drive the relay coil high side, you should use a PNP transistor. If you want to use an NPN, drive it low side. You also need a snubber diode to protect the transistor. What is the relay coil voltage? Is BT1 20V? What do the flip flop outputs drive? Thread Starter #### animationman Joined Apr 3, 2018 12 Given that you're a novice, it's understandable that your circuit and schematic are terrible. If you're older than 12, there's no excuse for your grammar. Use paragraphs to organize your thoughts. What is the input voltage to the regulators? You're using too many voltage regulators. The inverter and flip flop need to be operating at the same voltage, so you only need one voltage regulator for them. If the logic is operating at 5V, you don't need the two LM317 and can power them all from the 7805. You're using an LM324 as a comparator and are trying to drive the relay coil high side. This is a bad idea because the opamp output is only guaranteed to get within 1.7V of Vcc (3.3V with Vcc=5V). If you want to drive the relay coil high side, you should use a PNP transistor. If you want to use an NPN, drive it low side. You also need a snubber diode to protect the transistor. What is the relay coil voltage? Is BT1 20V? What do the flip flop outputs drive? No need to be condescending about my grammar sir. I dont believe you would take so kindly to such ridicule .Have a nice day. #### dl324 Joined Mar 30, 2015 12,871 I dont believe you would take so kindly to such ridicule . I intended for the criticism to be constructive. Sorry if you took it otherwise. #### MisterBill2 Joined Jan 23, 2018 8,761 No need to be condescending about my grammar sir. I dont believe you would take so kindly to such ridicule .Have a nice day. I did not like the nasty remarks about the grammar either. A whole lot of the folks who use this site clearly don't have english as a first language, and so we let it slide. If something is not clear then is the time to ask more questions to get a better answer. Treating others in a decent manner is the way to go. There are lots of other places on the internet for nasty talking people, I don't want that here!!! #### MisterBill2 Joined Jan 23, 2018 8,761 The resistor is to keep CP from floating. I will remove it ,Im taking the the 74HC14 will keep it stable? Also ,on the breadboard I noticed that the clock pulse input had a couple volts on it so I put a diode in there thinking it would backfeed into my schmitt trigger. Ill remove the resistor and diode and flip the transistor correctly my mistake for sure. The extra voltage regulator was because for dir 1 (Qnot) and dir 2 (Q) are for the gates of the HBridge which is a BTS7960 that purchased from Amazon. They seem to pull a little more current . I have a heat sink on that one. Also, I had to put a cap C1 across the coil of the relay because the it vibrated on and off because the opamp reacts pretty fast when the transistion of the common of the relay is mid state the opamp tries to turn it on then off really fast.That is for the battery so that it doesnt go below 12volts as it is a dewalt 20 volt battery. I have an adapter it slides into and decided on 12 volts because when a dewalt drill stops and needs charging its always at 12 volts if it goes below 5 the maintenance circuit will make the charger fault and usually have to throw away a 70$ battery. Forgive me if I sound very novice its because I am. I have only learned from reading and videos but its very addicting. I thank everyone's input as a matter of fact this was my first post. Ill update after the changes were made to my crazy circuit.
BTS7960 43A
Protecting the battery is a very good idea!

#### animationman

Joined Apr 3, 2018
12
I intended for the criticism to be constructive. Sorry if you took it otherwise.
Its fine I am grateful for the intelligence on this site I am just new.

#### animationman

Joined Apr 3, 2018
12
I suggest that the circuit is far more complex than it needs to be, And that driving a cmos flipflop with a TTL device and the diode in between may not deliver enough voltage and a fast enough rising edge. And the analog timer using an opamp is not the best choice. You could use a 555 timer IC and have a more reliable system.
And since you say the breadboard circuit did work and the PCB does not, my guess is that the circuits are not quite the same. That sort of problem happens a lot.
Turns out I should not have tried to drive the gates of the Hbridge with the output of the JK flipflop. Instead I used an NPN 2222 to drive it. The JK now just drives the base. I have only just started playing with electronics to this degree for four months. I am used to machining and welding and hydraulics simple electrical but like I said it is so addictive. Anyhow the Flip Flop is not getting as hot and I have decreased the amount of voltage regulators I am using.

#### dl324

Joined Mar 30, 2015
12,871
Here is a redraw of your schematic:

EDIT: Corrected annotations near K1.

Annotated with comments and questions. I meant to include asking what DR1 and DR2 are driving.

I removed D7 and R6 because they weren't needed.

Voltage regulators U1, U3, and U5 may not regulate. Minimum current for 7805 is 5mA and 10mA for LM317.

Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,221
I do not see capacitors on the input and output of the LM317; they are not optional. You should have a 0.1uF cap from IN to ground, and another from OUT to ground, as close as you can get them to the regulator. You should also have a 100uF electrolytic cap from IN to ground, and a 10uF from OUT to ground.

You also need to have 0.1uF caps across the Vcc/Vdd and GND/Vee terminals of your IC's, or you may experience odd glitches.

Also, your relay coil needs to have a reverse-EMF diode across the coil, preferably with a resistor of 100 to 510 Ohms in series; Otherwise, when the power to the coil is turned off, the inductance of the coil will try to keep current flowing, resulting in a high voltage spike of reverse polarity across the coil, which can destroy other components.