I just learned how to synthesize a diagram of a finite state machine into a diagram of a logical circuit composed of D flip flops, a clock and logical gates.

However, I don't really have much experience with an actual physical building of an electrical circuit, so I thought I might try.

I was thinking about trying to actually build an electrical circuit of the following state machine diagram:

state machine diagram with 3 possible states

In other words, the description of the circuit is:

The circuit will have a button to press down and 3 LEDS.

At each point in time, only one of the LEDS will be on.

If the button is not pressed, it will remain in it's current state. If the button is pressed, then the turned on LED will change cyclically between the 3 LEDS, at a frequency determined by the Clock component.

(Also, possibly, a reset button to bring the state machine to an initial state)

My question is this: How would you technically do this? I have no acquaintance with the different brands and kinds of electrical components.

I know I need 2 D-flipflops because there are 3 states. I also know I need a clock to connect into the flipflops, and I would need OR/AND/NOT gates. I think I would also need a Mux to choose the specific LED to light according to the current state.

How do I find such suitable components to buy? I'm afraid I wouldn't know such a component if I saw one, the technical terms in some of the buying sites I visited kind of baffled me. Could you suggest components for the gates, mux, flipflops and clock?

Any tips and advice regarding this first amateur try would be very much appreciated.

  • \$\begingroup\$ Where you can buy the components is irrelevant at this point, since what you want to do is figure out how to make the machine work. To do that, it seems you already have a basic working knowledge of digital logic, but need help with a circuit design, yes? \$\endgroup\$
    – EM Fields
    Sep 20, 2014 at 12:28
  • \$\begingroup\$ It isn't clear how fast the clock is. If it is slow, say 1-5Hz, then you will see the LEDs show which state the circuit is in. Much faster than that, and the LEDs will switch on and off so quickly that they will look like they are on all the time, and the result of a button press will be a near-random outcome. Is that what you imagined? Hence, it might be easier to test with a slow clock. Alternatively use more than one button. I assume you designed the circuit to avoid the mechanical problems of "switch bounce", i.e. a button might make and break a contact several times when pressed \$\endgroup\$
    – gbulmer
    Sep 20, 2014 at 12:41

2 Answers 2


You should look at the 40xx CMOS series.

Wikipedia has a good list:


You also should inform yourself what you have to consider using cmos devices in real life (what to do with open pins, additional capacitors, what means open drain, output current and so on...)

Some important considerations:

  • Do not leave inputs unconnected
  • use 100nF capacitors between the supply Inputs
  • check if your device is open drain and if you really want it to be
  • check the output current a 40xx device can drive may add a driver(transistor) if you need a higher output current

Another think is maybe implement your statemachine in a logic simulator first and when it works there design a shematic using the 40xx logic gates.

This should get you started.

  • \$\begingroup\$ Thank you very much :) And what about the Clock and the Mux? And perhaps you know of a good place to start informing myself of the issues you mentioned? \$\endgroup\$
    – Ana M
    Sep 20, 2014 at 11:39
  • \$\begingroup\$ For the clock you can use a cmos oscillator there are types which generate directlly 3.3V or 5V clock signal. Some of your questions are answered here: analog.com/static/imported-files/rarely_asked_questions/… But I do not have many other information about it. Maybe look up an example project and try to understand it. \$\endgroup\$
    – TM90
    Sep 20, 2014 at 11:54
  • \$\begingroup\$ I modified the answer a bit hope it helps. I do not think the list is complete but this are some considerations \$\endgroup\$
    – TM90
    Sep 20, 2014 at 12:05

Here's a circuit that'll do everything you asked for:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.