The digital volume control published in Elektor Electronics October 1997 can be used either with an RC5 remote control or with two pushbuttons (louder/softer). If for whatever reason you cannot do without the feeling of turning a real potentiometer, then with a little effort it is possible to add a shaft encoder to provide rotational control. The outputs of the circuit presented here can simply be connected in place of the two pushbuttons.
The shaft encoder produces two trains of pulses at PC1 and PC2, with a different relative phase depending on the direction of rotation. A complete revolution produces 15 pulses. In order to drive the two pushbutton inputs correctly, not only the number of pulses but also the direction information (clockwise = louder, anticlockwise = softer) must be taken account of.
First of all the pulses must be debounced using R4/C2 and R5/C2: the shaft encoder is after all just a mechanical rotary switch. R1…R3 are pull-up resistors. The JK flip-flop, connected as a D-type flip-flop, determines the direction of rotation. The clock input is connected to PC1 via inverter IC3.D, while the other output of the encoder drives the K input of the flip-flop via inverter IC3.C. IC3.B provides an inverted form of this signal at the J input to the flip-flop. When a pulse arrives at the clock input the flip-flop is set or cleared according to the direction of rotation.
The 4572 contains a variety of gates: three inverters, a NAND (IC3.F) and a NOR (IC3.E). These are used the produce pulses from the static signals. At one input to the two gates is the clock signal PC1, while at the other input we have the output of the flip-flop. The NAND gate passes the pulses to its output only when the second input is high; likewise, the NOR gate only propagates pulses when the second input is low. Thus only one of the gates can ever be propagating pulses at a time.
The signals thus generated have the disadvantage that in the quiescent state, when the encoder is not being turned, they can equally well be either high or low. A low level, however, will drive the volume control continuously, so winding the volume up to the maximum or down to the minimum. This is clearly not desirable: to rectify the situation we use a monostable to deliver a brief negative-going pulse. The pulse width is determined by R9-C4 and R10- C5.
The inverting input to monostable IC2.B is connected to the NOR gate, and the non-inverting input to logic one. For monostable IC2A the NAND gate is connected to the noninverting input, and the inverting input is tied low. The Reset inputs (pin 3/pin 13) must be tied high. On a positive going clock edge monostable IC2B produces a low-going pulse, and if the input stays high, no further pulses are produced. IC2A behaves in a similar way.
The outputs of the two monostable can be connected directly to the pushbutton inputs of the digital volume control. The supply voltage is +5 V, which is obtained from the potentiometer circuit via inductor L1 to avoid interference: you may find that the inductor can be dispensed with. The current consumption of the circuit is just 1 mA.
Now to the pushbutton function of the shaft encoder. The relevant connection is wired to PC3, buffered, and then not used. The pulse at PC8 could be used to switch another circuit (with a +5 V supply) on or off. Alternatively, the signal at PC10 can be used to drive the digital volume control directly by connecting PC10 and PC5. Here, an extra resistor (4.7 kΩ) is required to protect the monostable’s output, between the IC and PC5/10. Then, if the encoder is pressed, the audio signal will become gradually softer, providing a kind of mute function. Or alternately, connect PC10 with PC4 instead of PC5: then rather than softer, the audio signal will become louder.