3
\$\begingroup\$

I'm trying to learn some electronics and I have something in mind that I don't know if it is possible to achieve.

I've worked before with micro-controllers (Arduino, etc) and I know I would be able to do this with code, but I would like to know if this is possible without any code/micro-controller.

enter image description here

I would like to have a push button and 3 LEDs.

  • First time you press the button, first LED will light.
  • Second time you press the button, second LED will light (and the first one will be off).
  • Third time you press the button, third LED will light and the second one will be off.

If you push it again, every LED will be off. And then the process will start again with every press of the button.

I hope I was able to explain it correctly

Is this possible??

Thanks a lot.

\$\endgroup\$
3
\$\begingroup\$

Yes this is possible to implement with digital logic chips. The circuit requirements that you describe would require a state machine design that has four states, one for each of the LED on states and one for when they are all off. One possible design would use four D-type flip-flops designed to be connected into a chain to permit one flop to be set at a time whilst the others are cleared. Another design would require just two D-type flip-flops to count in binary as 00, 01, 10 and 11 cycling back to 00. Appropriate logic gates would then be used to decode states 01, 10, and 11 to turn on the three LEDs.

There are some specialized counter chips available that can make this digital design take less parts than a discrete gates and flip-flops design. One such chip is the 74HC4017. This specialized counter has ten outputs with only one active at a time. Clocking the part from a debounced transition of your switch would advance the active output to the next one. Since you only want four states as opposed to ten then you will have to arrange some additional circuitry such that when the counter has advanced to the fifth output active that wraps back to the master clear input to set the counter state back to the first state.

In the end this problem is easily solved with a microcontroller as you commented to in your question. The MCU can do much more that the discrete circuit in that you cam easily change the state sequence design of the LEDs if you so desire at a future time. It can also take care of debouncing the switch.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

It's quite easy to do. You need to debounce the pushbutton and use it to clock a counter/decoder that drives the LEDs, eg. HC4017. Wire it to reset after the last LED.

Two chips (eg.+ 74HC7002), maybe three if you want a bulletproof reset to a known state at power up. Use one ST Nor to debounce the pushbutton (with an RC and pullup and use the remaining 3 NORs to make an OR gate to allow MR to be actuated with an RC or with a proper reset chip or the 5th output (#4). Drive the LEDs with outputs 1,2,3. Output 0 drives nothing (it represents the 'off' state).

Or use an 8-pin microcontroller and virtually nothing else.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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