Up/Down Johnson Counter

Thread Starter

GuruMat

Joined Dec 31, 2017
3
Hi.
I haven't done any electronics in almost 20 years, so I am very rusty.
I want to make what is essentially an up/down Johnson counter with two inputs (increase by 1, decrease by 1) and six LED outputs, no clock - up/down on the push of each of the two buttons. I have been looking through my old textbooks, Google, and Youtube but can't find something that does this.
Does anyone know a simple what to do this?
Thanks.
 

wayneh

Joined Sep 9, 2010
17,496
Does anyone know a simple what to do this?
I don't. Every counter I've seen counts in one direction. That may just be because I haven't seen much and I'm sure an expert will come along and educate us.

The other challenge is that switches usually need to be debounced to avoid multiple counts from firing as the contacts make and break. You might get away with a simple RC low-pass filter but I'm not sure.
 

ElectricSpidey

Joined Dec 2, 2017
2,757
4028 and 4029 combo using a flip flop to change the up/down line then a 555 set up in one shot mode to clock.

So…

When you push the button the flip flop changes the up/down state, then a moment later the 555 time ends and clocks the counter.

An idea to start with…

I’m not at my main computer so I can’t see how to actually set up the circuit, but that is what came to mind.
 

Reloadron

Joined Jan 15, 2015
7,501
I would look towards a counter chip which was programmable since you mention 6 LEDs. A programmable Up/Dn counter like a 74192 or similar.

Ron
 

sghioto

Joined Dec 31, 2017
5,376
GuruMat,
Just to be clear what are the LEDs for ? Does the counter only count to six which is represented by a LED ?
Steve G
 

ElectricSpidey

Joined Dec 2, 2017
2,757
I would look towards a counter chip which was programmable since you mention 6 LEDs. A programmable Up/Dn counter like a 74192 or similar.

Ron
Well, I guess it depends on what he wants to happen at the end of either sequence, reset or turn off the LEDs.


But I can see an advantage to using that chip either way because it clocks up/down depending on which clock input is used. So all you would need is de-bounce and two SPST push buttons. (and LED drivers...etc)


The 4028/4029 combo can be made to reset using the jam inputs…but only in one direction. (well….without getting really complicated)
 

WBahn

Joined Mar 31, 2012
29,976
Hi.
I haven't done any electronics in almost 20 years, so I am very rusty.
I want to make what is essentially an up/down Johnson counter with two inputs (increase by 1, decrease by 1) and six LED outputs, no clock - up/down on the push of each of the two buttons. I have been looking through my old textbooks, Google, and Youtube but can't find something that does this.
Does anyone know a simple what to do this?
Thanks.
What is the purpose of doing this? To get a specific behavior for some task without regard to how it is implemented? Or to learn how to design and implement that behavior from a low level?

Assuming the later, the first thing to do is to clearly define the state sequence you want in response to each of the inputs. Since you mentioned six LED outputs, is it safe to assume you want a six-bit Johnson counter?

Getting reliable up/down behavior without a clock but just with two push buttons will be a bit tricky, but doable. The problem is that you need a glitch-free clock signal AND control logic coming from the same action and need to satisfy set-up and hold time requirements. There are a couple of ways to do it. Probably the easiest is to use 555 timers to create and hold the logic and the delay for the clock signal so that it happens in the middle of the logic assertion. At the other end of the spectrum is to use fully asynchronous logic. Midway between these is to use a small amount of asynchronous logic to produce the signals for the main synchronous part of the design.
 

AnalogKid

Joined Aug 1, 2013
10,986
Internally, a Johnson counter is a shift register plus lots of decoding gates. You can start with the internal schematic of a CD4017 and use a bidirectional shift register, or use a standard up/down binary counter followed by a 3 line-8 line decoder.

ak
 

MrChips

Joined Oct 2, 2009
30,706
As AK suggests, 74HC193 up/down binary counter followed 74HC138 3-line to 8-line decoder.
(Or use 74LS193 and 74LS138 combo.)
 

Thread Starter

GuruMat

Joined Dec 31, 2017
3
Thanks for all the responses.
The purpose of the counter is to keep track of an in-game mechanic in an RPG game - mostly for the making part rather than learnings. The LED set-up should look like those in this video:
)
but instead of being driven by an analogue input the push buttons increase/decrease the state by one.
When it gets past six, it can either turn off of do nothing - not concerned about that. I'm mostly concerned about being able increase and decrease the state by one each time.
I'll take a look at the options suggested and revert if I have any further questions.
Thanks.
 

GopherT

Joined Nov 23, 2012
8,009
Hi.
I haven't done any electronics in almost 20 years, so I am very rusty.
I want to make what is essentially an up/down Johnson counter with two inputs (increase by 1, decrease by 1) and six LED outputs, no clock - up/down on the push of each of the two buttons. I have been looking through my old textbooks, Google, and Youtube but can't find something that does this.
Does anyone know a simple what to do this?
Thanks.
It depends where you are going with your hobby...

Do you want to get back into Electronics?
What is your goal?

You can play 40 questions here and do it with logic chips, or,
Buy an Arduino and send a few lines of code from your computer to the Arduino and the arduino will do what you want (light the lamps, sense the push buttons and pick your nose. If you have time to wait, you can get one from eBay-China for $6 or you can order one for a bit more from the US. They come on a board that has room to solder the LEDs and push buttons.
 

Reloadron

Joined Jan 15, 2015
7,501
The effect of the LED lighting in the video was likely more a result of using a LM 3914 type of chip. The LEDs light in a "bar" type fashion rather than a dot type display which you will get with a counter. Now if you are sure you want a progressive incrementing or decrementing LED display with only one LED at a time illuminated then I suggest a counter like the 74192 I suggested earlier which is a programmable Up/Dn counter with preset since you only want to count to 6 in decimal. You can also manipulate the count up or down using a quad AND gate or however you wish.

Ron
 

AnalogKid

Joined Aug 1, 2013
10,986
Having the lower stage lights stay on as the count advances is a *major* difference from the initial requirements in post #1. What you now describe is not a Johnson counter, or any other kind of counter, just a simple bi-directional shift register with a 1 on one input and a 0 on the other input. If you use a part that can sink 10 mA or so, you might get away with no separate LED drivers.

While the effect looks similar to the output of an LM3914 or 3915 in bar graph mode, making that part step precisely in both directions is a much more complicated circuit than a digital solution.

Creating this circuit on a proto-board would take about 15 minutes. Once you have it behaving the way you want, wiring it up on perf-board so it is smaller and can be put into something else would take about an hour or two. If you start with an arduino, wiring up the lights and switches on an arduino prototype board will take about the same amount of time - PLUS - 1-2 months of learning how to write and compile a program, learn the programming language, translate your concept into program function blocks, and write and debug the code. Note - there is no statement or function call in C++ called "bi-directional shift register"

ak
 
Last edited:

WBahn

Joined Mar 31, 2012
29,976
Having the lower stage lights stay on as the count advances is a *major* difference from the initial requirements in post #1. What you now describe is not a Johnson counter, or any other kind of counter, just a simple bi-directional shift register with a 1 on one input and a 0 on the other input. If you use a part that can sink 10 mA or so, you might get away with no separate LED drivers.
I think it is a 6-bit Johnson counter operated as he described but just not allowed to count up past state 16 (all 1s). A bidirectional shift register is another -- and probably better -- way to get the desired effect, as long as the part has separate shift-left and shift-right strobe inputs it would be easy to implement. If there's a single shift input and a left/right enable, then it is a bit trickier but still doable.
 

Thread Starter

GuruMat

Joined Dec 31, 2017
3
Thanks for the help. I'm going to try the 74192 and play around to see if I can get what I want with it. I'll post here my results or further questions.
 

eetech00

Joined Jun 8, 2013
3,857
Thanks for the help. I'm going to try the 74192 and play around to see if I can get what I want with it. I'll post here my results or further questions.
Hi

The circuit is going be a lot more complicated if you use a 74192. The 74192 is a BCD counter so is more suited for a circuit to drive a 7 segment LED display. A bidirectional shift register would be better if the circuit needs to drive individual LEDs.

eT
 
Hi

The circuit is going be a lot more complicated if you use a 74192. The 74192 is a BCD counter so is more suited for a circuit to drive a 7 segment LED display. A bidirectional shift register would be better if the circuit needs to drive individual LEDs.

eT
The first entry that I got when I googled Johnson Counter showed one with three flip-flops and no debounce.
 
Top