D-type Flip-Flop with arduino

I have recently been looking at using a D-type flip-flop with the arduino.
I found one that seems like it would work. Datasheet: http://www.nteinc.com/specs/7400to7499/pdf/nte74HC74.pdf
I'd appreciate it if someone could tell me if it would actually work with the arduino, and tell me If I don't understand how these things work properly because it will be the first time I have used one. (as far as I can tell, it should work)

I'm thinking of making these connections:
Vcc (pin 14) to Arduino +5v
GND (pin 7) to Arduino Ground
1CP (pin 3) to Arduino digital out pin 53
1D (pin 2) to Arduino digital out pin 52
2CP (pin 11) to Arduino digital out pin 51
2D (pin 12) to Arduino digital out pin 50
1Q, 1Q-bar, 2Q, 2Q-bar will be connected to devices (LEDs).

Question: should I connect the 1S, 1R, 2S, and 2R pins to a +5v, or will the chip work without these connections?
EDIT: This is better phrased as "do the 1S 1R 2S and R pins have pull-up, pull-down, or no resistors?"

well, you could chose a 74HC74 or a 74HC174. the 174 is a more modern design with 4 more flip flops but gives up a PRESET pin... and keeps the CLEAR pin.

Inputs and Outputs Directly Interface to CMOS, NMOS, and TTL (which includes Arduino pins)... so no issues there.

I hate to say it this way... but what you ask and what you need to know really is in the datasheet, specifically, the truth table section.

My advice... if you place just the 74hc74 by itself on a breadboard and use a 330 Ohm resistor and LED and some extra wires... you can see the chip work based on the truth table and how you stimulate the pins (with 5V or GND) using wires.

for example: what is needed to make the pins WORK the way you want... is in the table I attached (Hint, you need to hold SET and RESET pins HIGH if you want the outputs to follow the changes at the data and clock pins... )

pwillard:
I hate to say it this way... but what you ask and what you need to know really is in the datasheet, specifically, the truth table section.

I was 99% sure that I needed to set them high, but if it had some kind of internal pull-up resistor that defaulted them to high, I wanted to know before I bought one. I read the datasheet and this is what I gathered, but if I was wrong about things, I didn't want to go toasting chips as it is my first time using flip-flops.


also, the 174 only has one clock pin that runs all six of the flip-flops. If it had six seperate clocks, It would be great, but it wouldn't work properly for these purposes if all 6 were clocked at the same time.

TTL logic needs no pull-ups unless the part SENDING the signal is listed as OPEN COLLECTOR and that is not the case here with Arduino or the 7474. Arduino pins and standard TTL logic pins will source the 5V signal on a HIGH and Sink the GND path on a "LOW... so no external parts are needed.

If you are dealing with TTL LOGIC IC's and the arduino, if you stick to using only arduino pins for interfacing... you won't blow anything up... the parts are designed to be "compatible".

The IC's GND pin and the VCC pin are compatible with Arduino GND and +5v.

Just out of curiosity, why do you need the flip flop? The output of an Arduino is essentially a D-Type flip flop. You are basically using two Arduino pins to do the job which can be done by just one.

no, this is to control some indicator lights on another device.

I'm actually using 2 pins to do a job that would need 4 without a flip-flop, so I'm saving 2 pins, not wasting 1

thepenguin:
no, this is to control some indicator lights on another device.

I'm actually using 2 pins to do a job that would need 4 without a flip-flop, so I'm saving 2 pins, not wasting 1

Ahh, that makes sense :slight_smile:

pwillard:
If you are dealing with TTL LOGIC IC's and the arduino, if you stick to using only arduino pins for interfacing... you won't blow anything up... the parts are designed to be "compatible".

good to hear that, at least.


so, I take it this means that the Set and Reset pins cannot be left unattached, but must be driven high by the arduino's +5V supply as I originally thought. Not a big deal, only 4 more wires.

Just TIE them to the Vcc rail and it will work the way you need.

To me, this

1CP (pin 3) to Arduino digital out pin 53
1D (pin 2) to Arduino digital out pin 52
2CP (pin 11) to Arduino digital out pin 51
2D (pin 12) to Arduino digital out pin 50
1Q, 1Q-bar, 2Q, 2Q-bar will be connected to devices (LEDs).

just says you need 2 output pins to act as 1Q, 2Q, and 2 inverters to make 1Q/ and 2Q/. Each inverter can be an NPN transistor and 2 resistors even.
You don't have any inputs back to the arduino.
Am I missing something?

I'm going to ask another question. By the looks of things, having reread your post, that you are using 4 pins for the flip flops, to control 4 LEDs. In which case you are not saving any pins, you are just adding additional hardware.

If your goal is to drive two pairs LEDs, where each pair of LEDs is on at opposite times (Q vs !Q), this simple circuit could do that from just two pins:

LEDsInverse.png

These indicator lights are actually going to be controlled from the same set of pins as the device they are indicating for. I just downloaded eagle, so I'll try a schematic of what I'm doing. I realized that a d-type flip-flop has the same "protocol" to activate it as the circuit I was planning on using.

UPDATE: Just got the parts together, and they are working as intended :slight_smile: