This is only a preview of the March 2024 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
Articles in this series:
Articles in this series:
|
Digital Volume Control
POTENTIOMETER
By Phil Prosser
We got tired of volume control potentiometers going scratchy after
just a few years, and very poor balance at low volumes. This drop-in
replacement uses a digital IC, so it tracks exceptionally well and will give
top performance for decades. The SMD version fits in the space occupied
by most regular pots, while the through-hole version does a similar job but
is a bit easier to build.
W
e have had to replace
volume controls in our
prized equipment too often
due to them going ‘noisy’. Recently,
a reader wrote in with that exact
same problem; so we know it affects
many people.
In one spectacularly loud failure, a
ground tab on the volume pot for my
work stereo failed, resulting in that
channel running flat-out all night,
to greet co-workers at full blast the
next morning!
The gauntlet was thrown down
recently when building a remote
volume control. The motorised pot
literally failed out of the box, the
crimped-on tabs were loose (we
know others have experienced this
failure mode).
There must be a better solution!
Why aren’t there pot-sized volume
digital controls that use some of the
excellent electronic volume control
ICs with a digital rotary encoder?
Well, now there are!
The original concept for this project was a straight-out replacement for
a volume pot. I was asked the innocent question: ‘If you have a PIC in
there to control the volume IC, why
not have IR remote control as well?’.
As it turned out, that was not too difficult to provide.
The resulting SMD design is a very
modest size at just 25mm wide by
36mm deep. It’s just a little larger
than a typical dual-gang log pot, as
shown in the photos.
While this small size is clearly a
boon in many situations, we knew
that some readers would be apprehensive about building it. Although
the board is quite packed, none of
the parts are especially small. Still, it
wasn’t too much work to come up with
a through-hole equivalent design, so
that is what I did, which means we
have two options for you.
18
I checked its performance and
found it to be close enough to the
SMD version that nobody would
notice an audible difference. So if
you have room to fit a larger board,
it is certainly an option. Its circuit is
identical; it simply uses physically
larger components on a different
Features
☑ Based on the PGA2311UA stereo
digital volume control IC
☑ Two independent channels
(expandable up to four, six or more)
☑ Automatically remembers the last
volume setting
☑ Volume adjusted by a rotary
☑
☑
☑
☑
☑
☑
control on the front panel or
universal IR remote control
Mute function (remote control only)
Soft start at power-up
‘Clickless’ design
Controlled by a PIC16F15214
microcontroller and TSOP4136
IR receiver
Operates from a preamp power
supply from ±8V to ±30V
Optional LED indicator showing
IR and volume change activity
The SMD version of the Digital
Potentiometer is a little larger than a
coin and just wide enough for the rotary
encoder and IR receiver to fit. And for
those who don’t want to squint while
building it, there’s the larger throughhole version shown below.
Specifications
☑ Gain and attenuation range: +31.5dB
to –95.5dB in 0.5dB steps
☑ Channel gain match typically
within ±0.05dB
☑ 0.0002% distortion
☑
☑
☑
☑
☑
at 1kHz (using the
-UA version of the
IC) – see Fig.1
Frequency response:
essentially flat from 20Hz
to 20kHz
Able to drive 600W
W loads
Input resistance: 10kW
W
Signal handling: 2.5V RMS maximum
input level
Output level: up to 2.5V RMS (7.5V
peak-to-peak)
This prototype used a
TSOP2136, instead of the
recommended TSOP4136,
which is why the IR receiver is
shown mounted on the outer set of
pads. (Refer to the text.)
Practical Electronics | March | 2024
to run up to +31.5dB, but be warned
that this is an awful lot of gain.
Fig.1: THD and THD+N vs frequency plots for the Digital Pot for both channels –
nothing to see here, folks! Move along! You’ll get similar or better performance
from this design compared to a regular, passive potentiometer.
Fig.2: this shows what is inside the PGA2311 (and PGA2310, PGA2320) ICs.
The switched resistive attenuator and switched feedback in the output amplifier
allow for a wide range of gain and attenuation settings.
board that measures just 79mm wide
and 57mm deep.
Performance and IC choice
The specifications panel and Fig.1
show the performance of the prototypes. There’s so little noise and
distortion that it certainly won’t be
audible and will not affect the audio
quality of even the best amplifiers.
We measured the distortion of
five prototypes, and all were in the
0.0002-0.0003% distortion region,
which is close to the measurement
limit of our test equipment.
The heart of the project is the
PGA2311 Volume Control IC from
Texas Instruments. The PGA2320 or
PGA2310 can also be used with identical performance, but those versions
are much more expensive for reasons
we cannot explain, other than they
can operate from higher ±15V supply rails compared to ±5V.
You need to use one of the
PGA2311 chips with a UA suffix to
get the specified performance. The
Practical Electronics | March | 2024
obsolete CS3310 will also work just
fine, and they are still reasonably
easy to find on the grey market (eBay
or AliExpress).
Still, all of those options will give
acceptable performance. In short,
we are confident that you will find
one volume IC or another to fit on
your board, even in these times of
IC shortages.
The PGA2311 contains a resistor
network and analogue switch along
with switched resistors in the feedback network of the output buffer
amplifier, as shown in Fig.2. This
allows the device not only to attenuate but also to provide up to 31.5dB
gain. Pay attention to this; turning it
up too high when you don’t have an
input signal leads to a loud surprise!
This IC is very quiet, so do not
expect to hear hiss or noise to warn
you that the volume level is high.
While these ICs can provide up
to 31.5dB gain, we limited the Electronic Volume Control gain to +10dB.
An alternative firmware allows you
Circuit details
The Digital Pot circuit is shown in
Fig.3; there is not much to it. There are
a couple of things on the board beyond
IC2 (the PGA2311 or equivalent):
the PIC microcontroller (IC1), rotary
encoder (RE1), IR receiver (IRR1) and
some power supply components.
The audio performance of this
project is almost entirely determined by the PGA2311, as there is
nothing else in the signal path. The
left channel signal is fed in via pin
1 of CON2. It goes straight into IC2’s
input pin 16, exits from its output pin
14 to pin 2 of CON2, for feeding to
the amplifier (or whatever is downstream). The other channel is routed
similarly, via CON1.
We have included input protection
with a BAT54S dual schottky diode
(or a pair of BAT85s on the throughhole version) from each input pin
to the supply rails. This way, if the
input is over-driven, the diodes
will conduct and help to protect the
PGA2311 from damage.
We decided not to include DC-
blocking capacitors on either the
input or output. The reason is that
four bipolar capacitors would have
added probably 20% to the PCB size.
We expect these will be in your signal chain already (after all, if you’re
replacing a mechanical pot, you
won’t be applying DC to it) and the
output offset voltage of the PGA2311
is only 0.25mV at 0dB gain.
If you have DC in your signal
chain, you will need to include a
blocking capacitor in series with
the Digital Pot – we recommend a
10μF 25V bipolar electrolytic capacitor. You can also use two regular
10μF 25V electrolytics connected
in series, negative-to-
n egative or
positive-to-positive. Both options
will have no noticeable effect on
the audio.
With the outputs, we are assuming
that the Digital Pot will drive short
cables to your amplifier or follow on
circuitry. The PGA2311 can drive
600W loads and has a short-circuit
current of 50mA, so it is unlikely
to misbehave if presented with an
unusual load.
Still, if you intend to drive long
cables with this, add a 100W resistor
in series with each output. A convenient place for this would be at your
output socket.
Controller
If the PGA2311 is the heart of this
design, the 8-pin PIC16F15214 is the
19
brain. The main job of the software
running on this PIC is to monitor the
rotary encoder and, if it is turned,
send a signal to IC2 to adjust the volume appropriately.
It also looks for signals from the
infrared receiver and, if it receives
a valid signal from a remote control,
also figures out what command to
send to IC2 in response. We’ll have
more details on how the software
works later.
Power supply
IC2 operates from ±5V supply rails.
To allow a wide variety of amplifier/
preamplifier supply rails to be used
to run this board, we have onboard
78(L)05 or 79(L)05 regulators.
This means you can power the Digital Pot from split supply rails from
±8V to ±30V, which should suit most
applications. A typical preamp will
have such rails available, and some
smaller amplifiers without preamps
might too.
In keeping with the design concept, the power supply is very simple. The PGA2311 has a typical
power supply rejection ratio (PSRR)
of 100dB at 250Hz, so any noise
that the basic linear regulators let
through will not realistically affect
performance. Of course, you could
‘roll your own’ low-noise ±5V DC
supply and delete the regulators as
an upgrade.
Suppose you want to fit the Digital Pot into a power amplifier with
only split supply rails above ±30V.
In that case, you could connect 5W
zener diodes in series with the two
supply rails to drop them into the
Digital Pot’s acceptable range. It only
draws a few tens of milliamps, so that
should work for just about any amplifier. Just ensure the zener polarities
are correct (anode to pin 1 of CON3;
other cathode to pin 3).
If you use the PGA2310 or PGA2320
devices, you also have the option of
increasing the analogue supply rails
to as high as ±15V. This will make
no difference in the vast majority of
applications, but the choice is there.
The simplest way of doing this is to
drop in 78(L)15 and 79(L)15 regulators for REG2 and REG3, respectively.
Don’t change REG1 to a higher voltage type.
Firmware
The source code and HEX file for this
project are available for download from
the March 2024 page of the PE website:
https://bit.ly/pe-downloads
Fig.3: the complete circuit for the Digital Pot; this applies to
both the SMD and through-hole versions. Just note that D1a/D1b
and D2a/D2b are two dual diodes in the SMD version or four
individual diodes in the other. The only extra part not shown
here is the optional LED indicator that plugs into CON4.
Digital Stereo Volume Control
20
Practical Electronics | March | 2024
On boot-up, the software configures several registers to set the processor clock speed to 4MHz, much
lower than the maximum, and starts
a timer for measuring IR signals. It
then loads the saved volume level
and remote control configuration
from flash memory, checks to see if
the user wants to change the remote
code and, if not, ramps the volume
from zero to the last used value over
a couple of seconds.
It then monitors the rotary encoder
and IR input ports for action, and
if anything happens, decides if the
rotary encoder is being turned up or
down or reads the IR stream to see
what code was transmitted.
The software writes a new volume level value to the PGA2311
IC if required. Then, if there are
no changes for about 10 seconds, it
saves the new volume level to the
flash memory.
Modulated infrared signals are
received by the TSOP4136, which
includes an IR detector, 36kHz
bandpass filter and output driver.
The result is a digital serial stream
including intentional signals from
your remote control and also ambient light noise.
Noise will include ‘signals’ from
lights, the sun and other IR remotes
in the room. The IR receiver’s internal bandpass filter is not 100% effective at blocking this noise, but it
helps a lot by reducing it to a manageable level.
While a little old now, Philips RC-5
IR codes are prevalent, and virtually
all universal remote controls can generate them. RC-5 IR transmissions
each contain 14 bits of data. That’s
broken down into five address bits
(32 possible values for TV, VCR, DVD,
receiver and so on) and six command
bits (64 possible values).
The stream commences with two
start bits and a ‘toggle’ bit that inverts
with each subsequent command.
The data is ‘Manchester encoded’,
a clever way of sending a string of
ones and zeros on a serial line while
embedding a clock signal into it. Our
PIC reverses this scheme to decode
the serial stream of data from the
TSOP4136; more detail on this is
provided in the ‘IR Signal Decoding’ panel.
The PIC microcontroller untangles
all this to extract commands from
the remote and change the volume
or toggle the mute status.
PCB design method
We thought it might be interesting to
show what we do when designing such
a tightly packed board and how we are
Practical Electronics | March | 2024
sure it will all fit. Fig.6 is a 3D rendering of the PCB from Altium during
the design phase. Compare this to the
actual prototype; it’s pretty close.
This depends on us entering the
right models for every component,
but you only need to do this once.
After that, we can run interference
IR Signal Decoding
With Manchester encoding, a logic one is transmitted as a high-to-low transition, while a ‘0’ is a low-to-high transition – see Fig.4. As transmission starts
with a one bit, we know that there is a high level, then a low level, at the start
of every transmission.
Fig.4: the Manchester Encoding scheme used by the RC-5 remote control scheme. This
encoding results in no DC component, a well-defined frequency range, and the ability
of a receiver to work out the clock rate from the serial data stream.
The decoder described here works well and is a good example of a simple state
machine. Let’s start by listing what we know:
● A one is encoded as a period of no IR signal for 890μs (nominally), followed
by an IR signal for the same time; zero is the reverse. We need to allow for
some variation in the transmitter’s clock and thus periods (say ±10%).
● The IR level will never remain the same for much less than the nominally
890μs period, or much more than 1780μs if a zero follows a one or a one
follows a zero.
● We are looking for 14 bits of data.
The state machine states, shown in Fig.5, are as follows.
A Clear any stored value and wait for an IR signal to be present. Set the first bit
to one (we know this is true if it is a valid signal) and go to state B.
B We are receiving a one. Measure the time until the IR signal stops. If this was
too short (say, less than 890μs minus 10%), this is noise; go to state A.
if the time was short (closer to 890μs than 1780μs), we have just received
another one. Store this and go to state C.
if the time was long (closer to 1780μs than 890μs), then we are receiving a
zero. Store this and go to state D.
if the time was far too long (more than 1780μs plus 10%), this is noise, so
go to state A.
C We just received an IR pulse starting with a one after having already received
a one (there is no IR signal just now). Measure the time until we see an IR
signal again.
if we see it too soon, this is noise; go to state A.
if the time was short, that is to be expected; store the bit and go to state B.
if the time was longer than that, this is noise; go to state A.
D We just received a zero; there is no IR signal now. Wait until the IR signal
starts again.
if we see no IR for too short a time, this is noise; go to state A.
if we see no IR for a short time, we have just received another zero. Store
this and go to state E.
if we see no IR for a long time, we are receiving a one. Store this and go to
state C.
if there was no IR for longer than that, this is noise; go to state A.
E We just received an IR pulse for a zero after a zero (there is an IR signal present now). Measure the time until we see no IR signal again.
if this is less than a short pulse, this is noise; go to state A.
if we see no IR for a short time, that is to be expected; go to state D.
if we see no IR for longer than that, this is noise; go to state A.
If the software receives all 14 valid bits using the above method, it is considered a valid command and processed, then it returns to state A, ready to receive
another command. Otherwise, it throws the data away as it is considered noise.
Fig.5 overleaf shows this as a ‘state diagram’.
↪
↪
↪
↪
↪
↪
↪
↪
↪
↪
↪
↪
↪
21
Fig.5: the IR decoder state machine built into the software. This demonstrates how
complex logic can be decomposed into a (relatively) simple flow chart and then
implemented in logic or software. Writing software can become difficult without
breaking the logic down like this.
checks and even get a rendering of
what it will look like once assembled. We can spin it around to ensure
there are no component collisions
(and Altium can warn us if there are).
Construction
First, you need to choose which
board you want to build. The SMD
version is suitable for relative beginners as it has a handful of surface
mount parts but no really fine pitch
components. That said, if you have
room for the full-size board, it might
save you some squinting to build that
version. This especially applies to
those of us with a few extra ‘miles
on the clock’.
SMD version
The SMD version is built on a double-
sided PCB coded 01101231 that measures 25.5 × 36.5mm abd which is
availabel from th PE PCB Service. It is
shown with the components placed
in Fig.7. Components are mounted
on both sides to keep the final result
compact. You might want to use a
small vice or some Blu-Tack to stop
the PCB from slipping around on the
bench while you work on it.
Start by soldering the 10kW resistor on the back of the board. Next,
fit the 100nF capacitors. Four are
on the board’s back, and two are on
the front.
Next, fit the PGA2311 IC (or similar) and the PIC16F15124 microcontroller. In both cases, ensure you
have identified pin 1 and oriented it
as shown in Fig.7 and the PCB silkscreen before tacking one pin. Then
check the alignment of the other pins
before soldering them. If they are off,
remelt the first solder joint and gently
nudge the IC into position.
Adding a bit of flux paste along the
rows of pins before applying solder
is recommended, as it makes the solder flow much better, to form good
Note: the headers are
swapped in the final
version compared to the
photos to make it easier to
use shielded cable for
the audio.
Enlarged views of the SMD version
of the Digital Volume Control
Potentiometer. Note the different IR
receiver, as we tested a few common types.
22
Fig.6: this is the 3D rendering we
produced using Altium to verify that
everything was going to fit. The final
result looks remarkably similar.
joints. With flux paste on the pins,
you just need to load a little solder
on your iron and then touch it to the
junction of the pin and pad, and it
should flow onto them and form a
good joint.
With practice, you can even drag
the iron down the pins to solder them
in rapid succession.
After soldering, check carefully
to ensure all the joints are good and
no pins are bridged to adjacent pins
with solder. If they are, add a bit more
flux paste and then apply some solder wick to suck up the excess solder and clear the bridge.
Now flip the board and solder the
two dual BAT54S schottky diodes.
These are SOT-23 package devices
and the smallest parts you will need
to deal with, but luckily, the pins
are relatively widely spaced. Once
you have these on the board, it is all
downhill from there.
Next, fit all five 10µF 35V SMD
electrolytic capacitors (or, even better, 10µF 35V/50V SMD ceramics).
If using electrolytics, orient them
as shown; the base has a chamfer
at the positive end. You can use a
small amount of solder to wet one
pad and tack the capacitor lead to
hold it in place before properly soldering both pins.
Leave that fine tip on your soldering iron, as while the remaining
parts are through-hole types, many
of these parts use smaller pads to fit
the tracks onto the PCB. Solder in
the three voltage regulators next. Be
careful to get the 78(L)05 and 79(L)05
devices in the right spots.
Next, mount the power and output
connectors. We have chosen different
types for these to make it less likely
that the power will be inadvertently
Practical Electronics | March | 2024
Fig.7: the SMD version is very compact but is identical in performance and function to the larger through-hole version.
If using 10μF ceramic capacitors instead of electrolytic (which we would recommend), they will fit on the same pads
but are not polarised. You can use the same type of connector for CON3 as CON1 and CON2 but then there is a risk of
accidentally plugging the power cable into the wrong header and doing damage.
Choosing an infrared remote control
We tested several remotes during development, including the Altronics A1012A.
We programmed this for TV codes 0088, 0154, 0169 and others and AUX codes
0734, 0846, 0727 and others. We also tested a ‘One For All’ remote and found
it worked with TV code 0556 and RCVR/AMP code 1269.
The easiest way to set this up for your remote is to plug the IR activity LED
into the program port and watch for the LED lighting when you press buttons
on the remote. Flashing indicates that valid IR codes are being received. It’s
then just a matter of trying different codes (starting with Philips TVs) until
you find one that works. You only need the volume up/down and mute button
codes to be correct.
definitely make for easier assembly
and maintenance.
A two-pin header is used as a
jumper to isolate the IR receiver in
case IC1 needs to be reprogrammed.
If you need to program your PIC,
install this header but
do not fit the jumper
until after the PIC is
programmed. If you
are using a pre-programmed PIC, you can
insert the jumper before
or immediately after
soldering it.
The final part to
install is the IR receiver.
There are many similar
types on the market, but
they have annoying pinout differences. Some
have the + and – power
supply pins swapped!
Check the ones you
buy carefully; the specified TSOP4136 devices
Fig.8: the through-hole PCB is electrically identical to have GND on the midthe SMD version but somewhat larger. For both IC1
dle pin and fit the inner
and IC2, you can fit a part in a DIP (through-hole) or set of holes on the PCB.
SOIC SMD package. Be careful which way around
TSOP2136 devices have
plugged into the audio connector. It
is possible to solder wires directly
to the PCB, but connectors provide a more professional finish and
you install the regulators and ICs, and note the
extra pad next to CON4 so that multiple units can be
‘ganged up’ for four or more channels.
Fig.9: this circuit shows how to add
an IR activity LED. We piggyback
off the CS line for the PG2311 IC,
which itself re-purposes the incircuit serial programming data
line. It can be a 3-, 4- or 5-pin
header as long as it’s plugged into
CON4 so the correct connections
are made; you can adjust the
resistor value to suit the LED used.
Practical Electronics | March | 2024
GND on an outer pin, matching the
pads nearest the PCB edge.
Through-hole version
The through-hole version is built
on a double-sided PCB that’s coded
01101232 and measures 78.5 × 57mm
(also from PE PCB Service). The parts
layout on this board is shown in Fig.8.
This board allows the use of all
through-hole parts or, alternatively,
you can use the surface-mounting
versions of the PIC microcontroller and/or PGA2311 IC. This makes
sourcing parts easier. All the remaining through-hole parts are very common, so we do not envisage any difficulties in sourcing them.
The assembly order is essentially
the same as for the SMD version,
listed above, with a few minor differences besides the different component packages. The main one is
that the two dual SMD diodes are
replaced with four individual leaded
diodes. Also note that the throughhole electrolytics have their positive
sides indicated using longer leads,
which go towards the + symbols on
the board.
For multi-channel use, a
‘slave’ version of either the
through-hole or SMD version
can be built using less components.
See the panel overleaf for more details.
23
For the regulators, you might as
well use the same 78L05 and 79L05
devices as used on the SMD version; orient them as per the smaller
semi-cylindrical footprints shown in
Fig.8. However, you can also use the
7805/7905 or equivalent TO-220 regulators if you happen to have them
on hand; the required orientation of
those devices is also shown in Fig.8.
Otherwise, follow the same order
of assembly as the SMD version, referring to the section above. After that,
you can install the four ‘feet’ comprising tapped spacers held into the
corner mounting holes with machine
screws. These are not only handy
during testing; you can use them to
mount the more hefty through-hole
board to the chassis later.
Activity LED
An activity LED is a useful thing to
have; one that flashes at power-up,
when valid infrared commands are
received and when the encoder is
rotated. To provide for this, the firmware stretches the length of the CS
‘chip select’ signal to the PGA2311
IC. By connecting our LED and resistor between this line and the 5V rail,
it will light up whenever commands
are sent to that IC.
This is a bit cheeky, as we are
using the chip select line for two
purposes: while the CS line is low to
enable the PGA2311’s digital interface, it also drives current through
the activity LED to light it. To make
the flash visible, we need to extend
these pulses from what is required
(just a few microseconds) to tens of
milliseconds.
The wiring for the optional activity LED is shown in Fig.9. It is done
by soldering the light-duty figure-up
cable to two pins on a female header
with three to five pins. You can cut
this from a longer header strip. It then
plugs onto CON4 and allows you to
mount the LED in a visible location,
eg, on the front panel of your amplifier using a bezel. Try to keep this
lead to a modest length (~10cm), as
it helps to prevent noise getting on
the CS line.
Programming IC1
If yo are using a blank microcontroller, you will have to program it in-circuit for the SMD version (unless you
have an SOIC programming socket).
With the through-hole version, you
can program it in-circuit or off-board
before fitting it (or even afterwards if
you’re using an IC socket).
For programming it in-circuit,
remove JP1 and plug a programmer
like a PICkit 4 or Snap programmer
24
into CON4 with its pin 1 in the correct position. With the PICkit 4, you
can get the programmer to deliver
power during programming. For the
Snap programmer, it’s probably easiest to apply 12V DC between the
+VE and GND pins of power header
CON3 during programming.
Parts List – Digital Volume Control ‘Potentiometer’
1 universal remote control [Altronics A1012A]
1 rotary encoder (RE1) [Altronics S3350 or EN11-VNM1BF15 (Mouser)]
2 3-pin vertical polarised headers, 2.54mm pitch (CON1, CON2)
[Altronics P5493]
2 3-way polarised header plugs with pins (for audio signals via CON1, CON2)
[Altronics P5473 + 3 x P5470A]
1 3-pin JST style header, 2.54mm pitch (CON3) [Altronics P5743]
1 3-pin JST style plug, 2.54mm pitch (for power via CON3)
[2 x Altronics P5743 + 6 x Altronics P5750]
1 2-pin vertical header, 2.54mm pitch, plus jumper shunt (JP1)
1 TSOP4136 or similar IR receiver, SIL-3 (IRR1)
[Altronics Z1611A, Jaycar ZD1953, Mouser 782-TSOP4136]
Additional components for the SMD version
1 double-sided PCB coded 01101231, 25.5 × 36.5mm from the PE PCB Service
1 6-pin SMD vertical header, 2.54mm pitch (CON4) (optional; for ICSP,
activity LED and/or multi-channel use) [Altronics P5435]
1 PIC16F15214-I/SN 8-bit microcontroller programmed with 0110123A.HEX,
SOIC-8 (IC1)
1 PGA2311, PGA2310, PGA2320 or CS3310 digital volume control IC,
wide SOIC-16 (IC2)
2 78L05 +5V 100mA linear regulators, TO-92 (REG1, REG2)
1 79L05 -5V 100mA linear regulator, TO-92 (REG3)
2 BAT54S 25V 200mA dual series SMD schottky diodes, SOT-23 (D1, D2)
[Altronics Y0075]
5 10μF 35V SMD electrolytic capacitors, 5.3×5.3mm [Altronics R9442] OR
5 10μF 35V/50V SMD ceramic capacitors, X5R or X7R, M3216/1206 size
6 100nF 50V X7R SMD ceramic capacitors, M3216 size [Altronics R9935]
1 10kW SMD resistor, M2012/0805 size [Altronics R1148]
Additional components for the through-hole version
1 double-sided PCB coded 01101232, 78.5 × 57mm from the PE PCB Service
1 6-pin vertical header, 2.54mm pitch (CON4)
(optional; for ICSP, activity LED and/or multi-channel use)
1 8-pin DIL IC socket (optional; for IC1 if DIP version used)
1 PIC16F15214 8-bit microcontroller programmed with 0110123A.HEX,
DIP-8 or SOIC-8 (IC1)
1 PGA2311, PGA2310, PGA2320 or CS3310 digital volume control IC,
DIP-16 or wide SOIC-16 (IC2)
2 78L05 or 7805 +5V 100mA/1A linear regulators, TO-92 or TO-220
(REG1, REG2)
1 79L05 or 7905 -5V 100mA/1A linear regulator, TO-92 or TO-220 (REG3)
4 BAT85 30V 200mA schottky diodes (D1a/b, D2a/b) [Altronics Z0044]
5 10μF 50V low-ESR radial electrolytic capacitors, 5mm diameter
[Altronics R6067]
6 100nF 50V X7R multi-layer ceramic capacitors, 5mm pitch
[Altronics R2931]
1 10kW ¼W resistor
4 M3-tapped spacers (for mounting PCB)
8 M3 × 6mm panhead machine screws (for mounting PCB)
4 M3 shakeproof washers (for mounting PCB)
Optional parts for activity LED (suits either version)
1 LED with bezel and series current-limiting resistor
1 length of light-duty figure-8 wire, to suit installation
1 3-pin, 4-pin or 5-pin female header, 2.54mm pitch
Most SMD headers, including Altronics Cat P5435, have the pins staggered
on either side of the header. The PCB requires the pins to all be on one side.
This can generally be achieved by snapping or cutting off a 5-pin or 6-pin
length of the header and rotating the even-numbered pins by 180°.
Practical Electronics | March | 2024
Using MPLAB IPE, select the correct device (PIC16F15214), load the
HEX file (available for download from
the March 2024 page of the PE website: https://bit.ly/pe-downloads), enable
power from the programmer if necessary, then connect to the chip and
press the program button. It should
only take a couple of seconds to load
the firmware, and you will see a success message (or an error message if
something goes wrong).
Remember to re-fit the shorting
block to JP1 after disconnecting the
programmer.
Changing remote control code
The software can decode RC5 signals with any valid TV or ‘Receiver’
address. The software defaults to
the TV on first power-up, and if you
do not need to change this, there is
nothing to do.
If you have another Philips TV
remote in the room and need to use
an alternative code, here is how to
set the Digital Pot to use the Philips
Receiver codes.
To set the remote using a TV code:
1 Remove power from the Digital Pot.
2 Short pins 3 and 5 of CON4.
3 Apply power to the Digital Pot.
4 Wait a couple of seconds
5 Remove power from the Digital Pot.
6 Remove the short between pins 3
and 5 of CON4.
To set it to accept a Philips Receiver
remote control code, just go through
the steps listed above but instead,
put the jumper between pins 3 and
4 of CON4.
This procedure is the same for the
through-hole or SMD versions, but
if you haven’t fitted CON4, you will
need to do so. Note that pin 1 of this
header on the SMD board is nearest
to the PIC microcontroller.
Troubleshooting
If it isn’t working as expected, check
the following:
1
Is there 5V DC ±0.25V on the
+5VD (IC2 pins 1, 4 and 8) and
+5VA (IC2 pin 12) rails?
If not, check for any parts getting hot.
Verify that you are providing a
minimum of 7V DC to the PCB
positive input.
Do you have the right parts for
REG1 and REG2, in the correct
orientations?
2 Are IC1 and IC2 soldered properly? Take a close-up photo if
your phone has this function; it
is surprising how zoomed-in you
can get with some phones.
3 Is there activity on the encoder
lines (pins 2 and 3 of IC1)?
If you have a ‘scope, probe pins
2 and 3 of IC1 and see if they are
at more than 3V, pulsing low as
↪
you rotate the encoder. If not,
check that you have used a suitable encoder – there are a bewildering variety of rotary encoders;
the recommended Altronics and
Ganging up multiple boards for more than two channels
One really useful feature of this Digital Pot design is that it is easy to run one
as a master and one or more as slaves. This allows one volume control or
remote to set the level on four, six or more channels.
This is great if you are making a home theatre system and want to use your
own amplifiers. It is also handy if you want to control multiple channel levels
in a multi-room system or need to adjust the level of multiple channels from
one control.
You can use either the through-hole or SMD versions to do this. The master
is fitted with all the parts, while the slave(s) have the microcontroller, rotary
encoder, infrared receiver, REG1 and associated parts left off.
You need to have the programming header fitted to all the boards, and importantly, it must have six pins rather than five. The extra pin goes into or onto a
pad labelled SCLK, right at the end of the programming header, allowing you
to extend it by an extra pin.
You then run a cable to join all the six-pin programming headers in parallel.
That’s all you have to do! But remember to leave off the PIC microcontroller,
REG1, IR receiver and encoder on each slave board. Otherwise, they will interfere with the master.
To make a six-way ribbon cable that can join the boards, you can use two
Altronics P5380 header sockets (or cut two 6-pin sections from a P5390 or
similar strip). Wire pins 1-1 through 6-6 together using ribbon cable and insulate the soldered connections using 3mm diameter heatshrink tubing. Mark
pin 1 at each end so you don’t accidentally swap them! That could cause damage to one or more boards.
We tested this using 200mm of ribbon cable with no problems. This interface
does not have fast data, so we expect you can stretch this a little if needed.
You could also use a 12-way ribbon cable with IDC connectors as long as
you were careful to plug the six-pin header into the same subset of the 12 pins
on each connector. That might be easier since crimping IDC headers onto a
ribbon cable only takes a few seconds with the right tool.
Note that you still need to provide power to all boards (master and slave)
since only the 5V digital power rail is carried on the connecting cable. They
will generate independent split analogue supplies.
With the power connections made and the programming headers joined,
you just need to connect the audio inputs and outputs to your various channels, ensure JP1 is fitted only on the master board, then power it up and go
through the regular testing procedure.
Note that the SCLK pin is at opposite ends of programming header CON4
on the SMD and through-hole boards, so you can’t mix the different board
types (at least not without re-routing that signal between them). Also note
that if you want to connect an IR activity LED to multiple ganged Digital Pots,
you will need to split out those two wires from the harness to go to the LED
and series resistor.
↪
↪
↪
Practical Electronics | March | 2024
This simple cable allows the master and slave Digital Pot boards to be ganged up
to make a four-channel volume control. It can be extended to three boards for six
channels and so on.
25
Mouser parts have been tested
to work.
4 Power up the board and monitor
the CS line with an oscilloscope
(IC1 pin 7). On power-up, the
micro writes data to the PGA2311
for a couple of seconds to ramp
the volume.
If this signal is present, the PIC is
running and programmed correctly.
If you don’t have an oscilloscope,
watch the LED very closely in
a darkened room on power-up.
After power is applied, you
should see the LED light dimly
for a second or two.
If there is no activity on the CS
line, go back and check power
and check that your micro is programmed. You can also monitor
the SDI and SCLK lines (IC1 pins
5 and 6) for activity. These should
be active for the first second or
so after power-up and when the
encoder is rotated.
5 I f the IR remote does not work:
Have you installed the shunt on
JP1?
Have you put the TSOP4136 in
the right location?
Check the signal on JP1 or pin 2
of the TSOP4136 with an oscilloscope; there should be clear
↪
↪
↪
↪
↪
↪
↪
GET T
LATES HE
T COP
Y
OF
TEACH OUR
-IN SE
RIES
AVAILA
BL
NOW! E
activity when the remote buttons
are pressed.
Have you programmed the remote
with the right code? If using a
universal remote, you will likely
need to try a few of the configuration numbers for your remote to
get it working. Install the activity LED and watch for the LED
to flash; this will tell you that
the remote is transmitting codes
that work.
↪ Note that if you need to program
your PIC on the board, you will
need to remove the shunt from
JP1. Many TSOP4136 devices otherwise stop the PIC from being
programmed. Remember to reinstall the shunt after programming.
Reproduced by arrangement with
SILICON CHIP magazine 2024.
www.siliconchip.com.au
Are AliExpress PGA2311 ICs any good?
We bought some PGA2311 chips from AliExpress (www.aliexpress.com/
item/1005003043805799.html). We built and measured the performance of
a Digital Pot using one of these, and it worked just fine – see Fig.10. At £11.63
for five ICs, this is a rather attractive option!
Fig.10: despite costing just over $4 each, the board built with the PGA2311UAs we got
from AliExpress gave extremely low THD readings, just like the boards built with chips
from more reputable vendors.
Order direct from
Electron Publishing
PRICE £8.99
(includes P&P to UK if ordered direct from us)
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 9
£8.99
FROM THE PUBLISHERS OF
GET TESTING!
Electronic test equipment and measuring
techniques, plus eight projects to build
FREE
CD-ROM
TWO TEACH
-INs
FOR THE PRICE
OF ONE
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
• AC Millivoltmeters with a range extender
• Digital measurements plus a logic probe
• Frequency measurements and a signal generator
• Component measurements plus a semiconductor
junction tester
PIC n’ Mix
Including Practical Digital Signal Processing
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
Teach-In 9 – Get Testing!
Teach-In 9
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Get Testing
Three Microchip
PICkit 4 Debugger
Guides
Files for:
PIC n’ Mix
PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format
This series of articles provides a broad-based introduction to choosing and using a wide range
of test gear, how to get the best out of each item and the pitfalls to avoid. It provides hints
and tips on using, and – just as importantly – interpreting the results that you get. The series
deals with familiar test gear as well as equipment designed for more specialised applications.
The articles have been designed to have the broadest possible appeal and are applicable to all branches of electronics.
The series crosses the boundaries of analogue and digital electronics with applications that span the full range of
electronics – from a single-stage transistor amplifier to the most sophisticated microcontroller system. There really is
something for everyone!
Each part includes a simple but useful practical test gear project that will build into a handy gadget that will either
extend the features, ranges and usability of an existing item of test equipment or that will serve as a stand-alone
instrument. We’ve kept the cost of these projects as low as possible, and most of them can be built for less than £10
(including components, enclosure and circuit board).
© 2018 Wimborne Publishing Ltd.
www.epemag.com
Teach In 9 Cover.indd 1
01/08/2018 19:56
PLUS! You will receive the software for the PIC n’ Mix series of articles and the full Teach-In 2 book – Using PIC
Microcontrollers – A practical introduction – in PDF format. Also included are Microchip’s MPLAB ICD 4 In-Circuit Debugger User’s Guide; MPLAB PICkit 4 In-Circuit Debugger Quick Start Guide; and MPLAB PICkit4 Debugger User’s Guide.
ORDER YOUR COPY TODAY: www.electronpublishing.com
26
Practical Electronics | March | 2024
|