Inc/dec binary sequence using a potentiometer

Thread Starter

mikerodi

Joined Jul 6, 2009
34
Hello, I’m a hobbyist and by no means a professional electronic engineer.
I was wondering if there was a way to implement a counter that will count up or down using a potentiometer. I’m aware this can be achieved using a rotary encoder or a pic, but the idea was to try achieve this by using cmos chips and a potentiometer. Is there a dedicated chip for this function or is it only possible with op amp ladders and a priority encoder?
I would like to use it to send midi controller messages.
 

MrChips

Joined Oct 2, 2009
30,714
Doable and you shouldn't need a special chip.
Describe your concept and mode of operation in more detail please.

A colleague of mine designed and built a continuously rotatable control knob using two capacitive encoder wheels.
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
hi mike,
Welcome to AAC.
Do you want the pot to vary the frequency as well as the up/down.?
E
Thank you for replying so quickly. In simple terms, I would like to increment or decrement a counter from zero to 128 using a potentiometer. It’s really just to be able to achieve this using cmos chips as using a pic would take all the fun out of it....
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
Doable and you shouldn't need a special chip.
Describe your concept and mode of operation in more detail please.

A colleague of mine designed and built a continuously rotatable control knob using two capacitive encoder wheels.
Thank you for replying so quickly. In simple terms, I would like to increment or decrement a counter from zero to 128 using a potentiometer. It’s really just to be able to achieve this using cmos chips as using a pic would take all the fun out of it....
 

schmitt trigger

Joined Jul 12, 2010
872
Let’s see if I am getting your concept.
-If the pot is at 12 O’clock, nothing should happen.
-If the pot is between 1 and 5, it should increase the count, at 1 slowly and fast at 5.
-If the pot is between 11 and 7, it should decrease the count, slowly at 11 and fast at 7.

Am I understanding it correctly?
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
Let’s see if I am getting your concept.
-If the pot is at 12 O’clock, nothing should happen.
-If the pot is between 1 and 5, it should increase the count, at 1 slowly and fast at 5.
-If the pot is between 11 and 7, it should decrease the count, slowly at 11 and fast at 7.

Am I understanding it correctly?
No, if the pot is at 1 it’s zero. Turning the pot would clock the counter. In other words, every time you turn the pot it would have to send clock signals, so if I were to turn it from 1 to 10, it would have to send 128 clock signals... or unless there’s a dedicated chip for this. I’m not sure if I have expressed myself clearly. It would have to do what a rotary encoder does, but by varying the voltage with the pot.
 

LesJones

Joined Jan 8, 2017
4,174
You could connect a D to A converter to the output of the counter and use a comparator to compare the output of the D to A with the voltage from the slider of the pot.. The comparator output would control some logic that incremented the counter if the voltage from the pot was higher than the voltage from the D to A. If the difference was the other way round you would decrement the counter. You would need some extra logic that detected if the difference was less than the value of voltage that represented 1 count. It would then not increment or decrement the counter.

Les.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,285
Why not just use an 8-bit A/D converter (looking at the 7 most significant bits).
The converter would measure the analog voltage and generate a 0 to 128 count at the output, going from 0V to full-scale of the A/D.
 

jpanhalt

Joined Jan 18, 2008
11,087
I think what you are looking for is a rotary encoder, absolute, with parallel output.

Here are 2 examples, but they look expensive:

https://www.posital.com/media/posit...eries/bit_parallel/E58_04_Bit_Parallel_MT.pdf
https://www.baumer.com/medias/__secure__/Baumer_GXP1W_DS_EN.pdf?mediaPK=8801083129886

As a cheap alternative, you could get a rotary switch and either remove or weaken the detent mechanism. Then feed that into a counter, like a 74HC595. Of course, those mechanical contacts will need to be debounced. That is simple to do.
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
You could connect a D to A converter to the output of the counter and use a comparator to compare the output of the D to A with the voltage from the slider of the pot.. The comparator output would control some logic that incremented the counter if the voltage from the pot was higher than the voltage from the D to A. If the difference was the other way round you would decrement the counter. You would need some extra logic that detected if the difference was less than the value of voltage that represented 1 count. It would then not increment or decrement the counter.

Les.
Hi Les... yes I had thought of this, or similarly, two op amps as voltage followers, but where one of the outputs lags the other through an RC circuit. This would be connected to a differentiator (I think) that would go hi every time there was a voltage difference on the inputs, in other words, every time you turn the pot.
This would be only for generating the clock signals...
Of course, this is all in the name of messing around with an idea. I realize it would be an enormously dispendious circuit...
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
Why not just use an 8-bit A/D converter (looking at the 7 most significant bits).
The converter would measure the analog voltage and generate a 0 to 128 count at the output, going from 0V to full-scale of the A/D.
Exactly what I was looking for... any specific 4000 series chip that could do that?
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
I think what you are looking for is a rotary encoder, absolute, with parallel output.

Here are 2 examples, but they look expensive:

https://www.posital.com/media/posit...eries/bit_parallel/E58_04_Bit_Parallel_MT.pdf
https://www.baumer.com/medias/__secure__/Baumer_GXP1W_DS_EN.pdf?mediaPK=8801083129886

As a cheap alternative, you could get a rotary switch and either remove or weaken the detent mechanism. Then feed that into a counter, like a 74HC595. Of course, those mechanical contacts will need to be debounced. That is simple to do.
The problem is that it would have to count to 128 in just on turn. Maybe a simple A/D converter is much simpler....
 

MrChips

Joined Oct 2, 2009
30,714
Ignore for the time being what chips, encoders,counters, MCU, A/D, etc. are needed to implement the function.
Don't attempt to provide a solution.
Firstly we need to know exactly what function a rotating knob has to perform. This is still not clear to me.

For example, I have a knob resting undisturbed. Is its current position meaningful? Does the knob have to be returned to to 12 o'clock position?
What is supposed to happen when the knob is turned clockwise, 5, 10, 30, 45, 90, 180, 360, 720°?
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
Ignore for the time being what chips, encoders,counters, MCU, A/D, etc. are needed to implement the function.
Don't attempt to provide a solution.
Firstly we need to know exactly what function a rotating knob has to perform. This is still not clear to me.

For example, I have a knob resting undisturbed. Is its current position meaningful? Does the knob have to be returned to to 12 o'clock position?
What is supposed to happen when the knob is turned clockwise, 5, 10, 30, 45, 90, 180, 360, 720°?
Pot 0 degrees = 0
50 degrees = 64
100 degrees = 127
 

ApacheKid

Joined Jan 12, 2015
1,533
You want a digital counter to count at a rate controlled by a potentiometer?

You do not want the potentiometer to set the max value that the counter will reach, only the rate at which it counts yes?

If so this is probably almost trivial, binary or decimal counter chips are readily available and will count at whatever frequency their clock input is running at, a crude oscillator with a frequency set by the pot is all you'll need here really.
 

ericgibbs

Joined Jan 29, 2010
18,766
hi Mike,
A 8 Bit ADC requires supporting logic.
Do you want a parallel or serial 8 Bit.?
A serial type will need a Clock and Enable etc...

Post a sketch on how you see this being connected.
E
 

MrChips

Joined Oct 2, 2009
30,714
Pot 0 degrees = 0
50 degrees = 64
100 degrees = 127
Ok. Let's see if we can summarize this.
If the knob is stationary, nothing happens.
If the knob is rotated by x-degrees in a clock-wise direction, a circuit sends out nx-clock pulses to a counter to count UP.
If the knob is rotated by x-degrees in a counter-clock-wise direction, a circuit sends out nx-clock pulses to count DOWN.

(If it is a potentiometer, you have to specify what happens if the limit of the rotational travel is reached.)
 

Thread Starter

mikerodi

Joined Jul 6, 2009
34
You want a digital counter to count at a rate controlled by a potentiometer?

You do not want the potentiometer to set the max value that the counter will reach, only the rate at which it counts yes?

If so this is probably almost trivial, binary or decimal counter chips are readily available and will count at whatever frequency their clock input is running at, a crude oscillator with a frequency set by the pot is all you'll need here really.
I had mentioned counter initially because I didn’t know an A/D converter does that job. If the pot is at zero, the output value is zero. Turning the pot would increment the binary values, but the pot must keep moving. The position of the pot equals a binary value, so for example, if you are at 12 o clock, the output value is 64. If the pot is still, nothing happens.
 
Last edited:
Top