Digital Volume Control Options: Remote, Pushbuttons, or Shaft Encoder
The digital volume control feature, originally featured in Elektor Electronics in October 1997, offers versatility in its usage. It can be operated either through an RC5 remote control or with two pushbuttons, one for increasing and another for decreasing the volume. If you prefer the tactile sensation of rotating a physical potentiometer, you can integrate a shaft encoder into the system with minimal effort. This addition allows for rotational control, mimicking the feel of turning a real potentiometer. The circuit’s outputs can directly replace the connections for the two pushbuttons, enabling seamless integration of the shaft encoder.
Shaft Encoder Functionality: Pulse Trains and Direction Indicators
The shaft encoder generates two sets of pulses at PC1 and PC2, with their relative phase differing based on the rotation direction. A complete revolution generates 15 pulses. To ensure accurate control over the two pushbutton inputs, it’s imperative to consider not just the pulse count but also the directional information. This directional data is crucial: clockwise rotation corresponds to increasing volume, while anticlockwise rotation results in decreasing the volume.
Debouncing and Direction Determination with Shaft Encoder
To ensure accurate operation, the encoder’s pulses are first debounced using R4/C2 and R5/C2, a necessity due to the mechanical nature of the rotary switch. Pull-up resistors R1 to R3 are incorporated. The JK flip-flop, configured as a D-type flip-flop, plays a vital role in determining the rotation direction. Its clock input links to PC1 through inverter IC3.D, while the K input is driven by the encoder’s other output via inverter IC3.C. Inverter IC3.B generates an inverted version of this signal, serving as the J input to the flip-flop. When a pulse arrives at the clock input, the flip-flop is set or cleared, depending on the rotation direction.
Pulse Generation Using 4572 Gates
Utilizing the 4572’s gates, including inverters, a NAND (IC3.F), and a NOR (IC3.E), pulses are generated from the static signals. The clock signal PC1 and the flip-flop’s output form the inputs to these gates. The NAND gate produces pulses only when the second input is high, while the NOR gate propagates pulses when the second input is low. Consequently, only one of the gates can transmit pulses at any given time.
Addressing Quiescent State Issues with Monostables
In the quiescent state, when the encoder isn’t turned, signals can be high or low. However, a continuous low level would undesirably adjust the volume continuously. To rectify this, a monostable circuit delivers a brief negative-going pulse. The pulse duration is determined by R9-C4 and R10-C5.
Utilizing Monostables for Signal Control
Monostable IC2.B has its inverting input linked to the NOR gate, and the non-inverting input set to logic one. For IC2A, the NAND gate is connected to the non-inverting input, with the inverting input grounded. The Reset inputs (pin 3/pin 13) must be set high. On a positive clock edge, IC2B produces a low-going pulse. If the input stays high, no further pulses are generated, a behavior replicated by IC2A.
Connecting Outputs and Shaft Encoder Functions
The outputs of the monostables can directly connect to the digital volume control’s pushbutton inputs. The circuit operates on +5 V obtained from the potentiometer circuit through inductor L1 to prevent interference. The inductor might be dispensable in some cases. The circuit has a low current consumption of 1 mA.
Utilizing Pushbutton Function of Shaft Encoder
For the pushbutton function, the relevant connection is linked to PC3, buffered, and left unused. The pulse at PC8 could control another circuit (with +5 V supply) on/off. Alternatively, connecting PC10 and PC5 directly enables driving the digital volume control. For this setup, an additional resistor (4.7 kΩ) is necessary to safeguard the monostable’s output between the IC and PC5/10. Pressing the encoder makes the audio signal gradually softer, creating a mute function. Alternatively, connecting PC10 to PC4 (instead of PC5) makes the audio signal louder when the encoder is pressed.