3 state push-button toggle circuit?

Started by merlinb, August 30, 2013, 04:36:43 AM

Previous topic - Next topic

merlinb

Can someone tell me how to get a momentary push button to toggle through three states? I have three LEDs and I want to cycle through them one at a time. Only one LED lit at any time.
i.e.:
press once, LED1 comes on,
press again, LED2 comes on instead,
press again, LED3 comes on instead,
press again, LED1 comes on instead (back to the start).

I'm sure it can be done with a couple of CD4013s, but I am failing to see how at the moment.

(I know you could also do it with a CD4017 decade counter, but I don't have any of those!)  :icon_rolleyes:

samhay

I have something on the breadboard that does this (well 5 states), but it uses an 8 pin PIC. Are you willing to go down that road?
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

merlinb

Quote from: samhay on August 30, 2013, 05:06:21 AM
I have something on the breadboard that does this (well 5 states), but it uses an 8 pin PIC. Are you willing to go down that road?
No, this is strictly a glue logic problem!

psychedelicfish

If at first you don't succeed... use bigger transistors!

deadastronaut

https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

merlinb

Quote from: psychedelicfish on August 30, 2013, 05:42:43 AM
Something like this?
Unfortunately that uses a 4017! I was really hoping to do this with a 4013 (SR / D flip-flops)...

merlinb

#6
Aha, here's the answer I was looking for!

http://www.physics.mcmaster.ca/phy4d6/Lecture/note7a.htm

R.G.

One of the early lessons I had in practical design with MSI was that it's often a better product solution to use a fancier device and minimize the number of IC packages.

Your three-state solution with 4013's uses two packages. A 4017, which is otherwise overkill, uses one, and saves not only the package but the board space. Unless you have already used up half a 4013 and have half to spare, I'd say the 4017 is the better solution.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

merlinb

Quote from: R.G. on August 30, 2013, 10:34:18 AM
One of the early lessons I had in practical design with MSI was that it's often a better product solution to use a fancier device and minimize the number of IC packages.
Your three-state solution with 4013's uses two packages. A 4017, which is otherwise overkill, uses one, and saves not only the package but the board space. Unless you have already used up half a 4013 and have half to spare, I'd say the 4017 is the better solution.

That would be true if it wasn't so bloody difficult to introduce a new part in the inventory! In fact I wanted to use a 4017 in the first place. But you have to go through the whole process of indentifying a minimum of two suppliers, get quotes from them and possibly guarentees to supply for a number of years, get samples and certification (OK probably not in this case), then get stores to agree to order them and put them on the archaic inventory system, then design the symbols and footprint for the PCB software...
It ends up not being worth the extra 20p, especially for batch production.

R.G.

In my PCB book, I talked a little about designing to objectives and identifying the costs of the objectives. I'd say that your comments on costs are one facet of this - the indirect costs of an objective.

Identifying the objectives is always a big deal. Exactly those issues - qualifying a new part, new multiple vendors, new part numbers and the cost of maintenance of such in the inventory system, etc. were things that were brought up to me and others back when I was designing power supplies for TIC*.

You must be doing some work for your day job for a big concern (possibly even military contracts) to make those considerations be issues. For small-scale pedal work, even in lots of thousands, those issues can be dispensed with.

I sympathize. It makes your work harder if you have to live under such restrictions. What our bureaucrats didn't recognize is that by enforcing all those unseen restrictions on their design force, they forced the designers to design for minimum personal effort in designs, where no one would EVER put in a new part, so the designs got less and less and less competitive over time. TIC eventually had big problems with that, and the component qualification system collapsed, although it was called "synergistic reorganization" when it happened. It would have been sad - if anyone other than the people in the qualification and records systems that were laid off cared.

The real answer is, of course, an eight-pin uC which takes in switch closures on one side and puts out either decoded or encoded outputs on the other. Going to uCs means stocking only one part for zillions of applications, potentially.

* Three Initial Corporation
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Ice-9

Ahh ! You have to love digital electronics. Flow charts, Gates and flipflops. It really brings back memories of late 80's study at college.
www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

Processaurus

If your momentary switch was a SPDT, you could use the remaining flip flop for the debounce, by connecting the two throws of the switch to the set and reset pins, and the common to VCC. Only matters if you need the switch to reliably only advance one step each press.

Quote from: merlinb on August 30, 2013, 08:02:57 AM
Aha, here's the answer I was looking for!

http://www.physics.mcmaster.ca/phy4d6/Lecture/note7a.htm