74HC74 D Type Flip Flop

Thread Starter

NikkiM

Joined May 8, 2015
6
Hello Everyone

I'm relatively new to electronics but am an experienced programmer. I'm currently working on an Arduino weather station project and making good progress. However, I am having problems with a reed switch based rain gauge. For various reasons I don’t want to use an Arduino interrupt (saving them for another function) to monitor the rain gauge, so I have been experimenting with using a flip flop IC.

I just happen to have a 74HC74 D Type flip-flop in my collection which I bought years ago for another (unfinished) project. I have not used a flip-flop before and so having problems understanding the IC. I have spent considerable time Googling and experimenting with the IC, all to no avail.

Basically, I want to connect one pin of the rain gauge to ground and the other pin to +5V, that in turn connecting to the SET pin of my IC. So when the rain gauge tips there will be a short pulse of +5V hitting the SET pin. This should hopefully cause Q1 to go HIGH and stay high until my Arduino sketch reads it and then causes the RESET pin to go high which should reset the flip-flop.

I'm however having problems understanding the IC. I know that the 74HC74 has a clock pin but I just want to use it as a standard SR flip-flop. This is what I have tried so far.

Experimenting with the flip-flop lighting an LED when SET goes HIGH...

PIN1 (RESET) — To Arduino so it can be reset with +5V
PIN2 (DATA) — to +5V
PIN3 (CLOCK) — NOT USED
PIN4 (SET)— Quick pulse of +5V to set
PIN5 (Q1) — TO LED
PIN6 (Not Q) — NOT USED
PIN7 (GND) — to GROUND
PIN14 (VCC) — to +5V

However, connecting as above I cannot get the flip-flip to set or reset correctly. Initially, I thought that the IC might have been faulty so I tried various other 74HC74 IC’s. All to no avail. I have even tried this setup using an online circuit simulator, of course, it does not work.

Am I misunderstanding something? Is it not possible to use this IC as a standard SR flip-flop? If not, can anybody recommend an IC?

I hope this makes sense and I appreciate any help.

Kind Regards

Nikki
 

crutschow

Joined Mar 14, 2008
34,280
Did you look at the Data Sheet Truth Table? That shows your problem. The Set and Reset inputs are active low, not high (a carryover from their TTL origin). They need to stay high when not used and go momentarily low to perform their defined function.
This is the opposite of the CD4013 FF where the Set and Reset inputs are active high.

Also, never leave any inputs (not outputs) floating in CMOS circuits.
Connect the clock input and all other unused inputs on the chip to Ground (including the FF you are not using).
 

Thread Starter

NikkiM

Joined May 8, 2015
6
Did you look at the Data Sheet Truth Table? That shows your problem. The Set and Reset inputs are active low, not high (a carryover from their TTL origin). They need to stay high when not used and go momentarily low to perform their defined function.
This is the opposite of the CD4013 FF where the Set and Reset inputs are active high.

Also, never leave any inputs (not outputs) floating in CMOS circuits.
Connect the clock input and all other unused inputs on the chip to Ground (including the FF you are not using).
 

Thread Starter

NikkiM

Joined May 8, 2015
6
That makes perfect sense now, I did get the chop working when making the SET pin low. Unfortunately, I think this will cause me a problem using the Arduino to send a reset command. Do you recommend the CD4013 FF?

Many thanks
Nikki
 

crutschow

Joined Mar 14, 2008
34,280
That makes perfect sense now, I did get the chop working when making the SET pin low. Unfortunately, I think this will cause me a problem using the Arduino to send a reset command. Do you recommend the CD4013 FF?
Why is that a problem with the Arduino? It can be programmed to output either a momentary high or low signal, as needed.

You can use a CD4013 if you want an active high for Preset and Clear (Set and Reset).
 

Thread Starter

NikkiM

Joined May 8, 2015
6
Thank you, I appreciate your help. Of course I can set a pin to be momentary high or low — I keep thinking in terms of LOW being floating...

Final question for this thread. Aside from not grounding the unused pins, is the following OK for this particular FF?

PIN1 (RESET) — To Arduino so it can be reset with +5V / Ground
PIN2 (DATA) — to +5V
PIN3 (CLOCK) — GROUND
PIN4 (SET)— to sensor
PIN5 (Q1) — TO LED
PIN6 (Not Q) — NOT USED
PIN7 (GND) — to GROUND
PIN14 (VCC) — to +5V

Again, thanks for pointing a novice in the right direction.

Nikki
 

crutschow

Joined Mar 14, 2008
34,280
Thank you, I appreciate your help. Of course I can set a pin to be momentary high or low — I keep thinking in terms of LOW being floating...

Final question for this thread. Aside from not grounding the unused pins, is the following OK for this particular FF?

PIN1 (RESET) — To Arduino so it can be reset with +5V / Ground
PIN2 (DATA) — to +5V
PIN3 (CLOCK) — GROUND
PIN4 (SET)— to sensor
PIN5 (Q1) — TO LED
PIN6 (Not Q) — NOT USED
PIN7 (GND) — to GROUND
PIN14 (VCC) — to +5V
It's a common mistake to think that a floating pin is logic low. It is not. Floating (an open pin) is an undefined level and can cause odd things to happen in CMOS logic circuits. Always tie inputs high or low.

The circuit looks okay as long as you have a pull-up resistor (say 10k) to +5V going to the SET input and the rain gauge contact going to ground so that you get a momentary pulse to ground at the set pin when the rain gauge trips.
 

Thread Starter

NikkiM

Joined May 8, 2015
6
Once again, thank you. And I apologise for the extraneous Quote posts...

I have taken your advice and added a pull-up resistor.


Nikki
 
Top