Email
Preamp Home Page
Ordering
Photos/Downloads
Links


Design Philosophy
How do I build one?
Dual Input Card
Motherboard
Dual Output Card
Power Supply
Processing Card
Control Systems
FAQ
 

Control Systems

 

Introduction

Users will want to control audio systems constructed from the designs and PCBs available on this website. It is intended to provide a number of options in the future, with PCBs available.

Currently, the only design available is to drive the volume control ic which will be used on the Dual Output Card PCB. This can also be used by anyone wishing to control a Texas PGA2310 or Crystal CS3310 volume control ic from a rotary shaft encoder. The design information and assembly language software are provided below.


Volume Control Design

The key features of this software are:

  • Uses an 8pin PIC12CE519 microcontroller to drive a Texas PGA2310 or Crystal CS3310 volume control ic
  • Multi-function rotary encoder for Volume, Balance and Preset Volume settings
  • Mode push button switch to select Volume, Balance, Preset Volume, and soft Mute
  • Power-up soft un-mute (volume ramps up to Preset Volume setting)
  • Soft Mute - push on, push off
  • Volume ramp up/down routines are tailored to sound natural with audio
  • Single LED to indicate current mode and mute status
  • All contacts debounced in software, so few components needed
  • Intuitive to use!

 

Use

The operational use of this design is detailed below, together with a diagram of the rotary shaft encoder (and its waveforms).



Volume

The rotary encoder will control the volume setting (Left and Right channels track together, with any Balance offset) after power up. The LED is off in Volume mode. When the control is turned slowly, the volume will change by 1dB per detent (or "click"), but in 0.5dB steps following the waveform edges from the rotary encoder outputs (see the diagram) to make the transitions appear smoother if the control is turned very slowly. As this control increases the gain in Decibels linearly relative to the rotational angle (a standard potentiometer does not do this!), the software also measures the speed of rotation of the rotary shaft encoder. When the control is turned quickly the volume will start to increase at faster rates, which allows the user to turn the volume up/down quickly if necessary...!

When the volume setting reaches the maximum value (either Left or Right channel equals 255 +31.5dB gain) the LED will flash once for a duration of 0.5 seconds. If the volume is turned down, and reaches the minimum value (both Left and Right channels equal 0 mute), then the software switches into its Mute mode and the LED lights continuously to show this.


  Mute

The software has a Mute mode, where the gain setting of zero is sent to the volume control ic. (Note that the hardware mute pin of the volume control ic is not used by this software - it is designed for power-up mute applications, and is not totally silent.) The user can mute the audio in two ways:

  • If the push button is pressed once (in the Volume mode) then the volume setting is ramped down smoothly to mute in approximately 1 to 2 seconds (depending on Volume level), or
  • As mentioned in the Volume section above, if the rotary encoder is used to reduce the volume to minimum, then the Mute mode is entered.

The LED lights continuously in Mute mode.

To exit from Mute mode, the user can:

  • press the push-button once and the volume will ramp up quickly to its previous setting (note that if the Mute mode was entered by using the rotary encoder, then the volume will ramp up to the last known "valid" value - which will either be the value at the last time the push-button mute was used, or the Preset Volume setting), or
  • rotate the rotary encoder clockwise and the software will switch back to Volume mode and then track the rotary encoder as normal.

  Balance

The software allows the Balance to be preset, which is then stored in the EEPROM memory. To set the Balance (from the Volume mode), press and hold the push-button for at least 2 seconds - the LED will flash twice per second to show the rotary encoder will now control the Balance. Turning the rotary encoder shaft anticlockwise will reduce the gain on the Right channel (so moving the stereo image to the left) - a clockwise rotation will reduce the gain on the Left channel.

In Balance mode, the gain changes only 0.5dB per detent (half the rate for Volume mode) to allow for accurate setting. When both channels have equal gain (so the stereo image is central) the LED flashing inverts, such that the LED switches off twice per second.

The gain range in Balance mode, starting with a central stereo image is as follows:

  • Rotated Anticlockwise from a central image: Right channel reduced 0dB to -15.0dB, in 0.5dB steps (relative to Left channel)
  • Anticlockwise "maximum": Right channel muted
  • Rotated Clockwise from a central image: Left channel reduced 0dB to -15.0dB, in 0.5dB steps (relative to Right channel)
  • Clockwise "maximum": Left channel muted

To return to Volume mode after adjusting the Balance, press the push-button once. The Balance setting will then be stored in the EEPROM memory.


  Preset Volume

The software stores a Preset Volume setting in the EEPROM memory - the volume will be ramped up to this value after power-up. To set the Preset Volume (from Volume mode) press and hold the push-button for at least 10 seconds. The LED will flash four times per second to show that the rotary encoder will now change the Preset Volume setting.

The rotary encoder will adjust the volume (as in the Volume mode) allowing the user to hear the chosen setting. Note that a value of 0 (ie. mute) can be stored, so that the audio will remain muted after power-up. When in Preset Volume mode, the LED will not indicate maximum or minimum volume. To return to Volume mode, press the push-button once - the Preset Volume setting will be stored in the EEPROM.


 

Circuit Diagram


The circuit diagram above shows the connections between the PIC microcontroller, the volume control ic, and a rotary encoder/push-button. This design uses an ALPS EC11B15242 (Farnell 733-726) rotary shaft encoder, which has an integrated push button switch. Other types of rotary encoder and push button switches can be used - do confirm that the output waveforms, debounce times etc are compatible (these settings can be changed by editing the PIC software code...but it may be easier to use a compatible part).

The rotary encoder outputs and the push button switch contacts are debounced in software. External pull-up resistors are used on the rotary encoder (these affect the response speed) - an internal pull-up resistor is used for the mute switch. The PIC micro uses its internal 4MHz oscillator and reset circuit. The assembly language software lists the PIC configuration settings needed when programming the chip.

Note that the mode LED is connected to the same PIC output as the Volume Control ic's Serial Data In (SDI) line, to allow an 8 pin microcontroller to be used! The Chip Select (CS) line is disabled when the LED is used (this means that users may see the LED flash very briefly when volume data is loaded into the ic).

The components around the volume control ic follow the manufacturers data sheets. Remember to use ±5Volt supplies if you are using the CS3310 or PGA2311 ic's - only the PGA2310 will accept audio supply rails of ±15Volts.


 

PIC Software

Assembly language software for the PIC12CE519 microcontroller can be downloaded (or viewed) by clicking on the link below. This software code may be used free of charge for home constructor projects. The code contains comments and uses relevant variable names, to allow users to modify the code for different applications.

Volume Control PIC Software V1.0

Please contact errock.co.uk if you wish to use this software for commercial applications. The software routines used to write/read the EEPROM memory are based on the Microchip library routines.

If you do not have access to a PIC programmer, preprogrammed ic's are available, when PCBs are ordered. Details are on the Ordering page.



Preamp Home Page | Ordering | Photos/Downloads | Links

Email | Copyright 1996 - 2004 errock.co.uk - audio design