This is only a preview of the December 2022 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Circuit Surgery
Regular clinic by Ian Bell
Electronically controlled resistance – Part 4
of steps (resistance values or
wiper positions, often referred
A
A
to as ‘taps’) is usually a power
Control input
Control input
of two related to the number
(R value)
(wiper position)
Wiper
R
R
of bits in the digital control
circuit, with the range of steps
being typically from 32 (5-bit)
B
B
to 1024 (10-bit) but fewer steps
Single resistor (rheostat)
Potentiometer
(4 and 16) and 100-step devices
are also available.
Fig.1. Basic digipot types: representing the electroThe stepped nature of digipot
mechanical rheostat and potentiometer.
adjustment is different from
the theoretically continuous variation
available from a film-based mechanical
or the previous three months potentiometer or JFET electronically
controlled resistors. Real mechanical
we have been discussing electronipotentiometers are not perfect so do
cally controlled resistance, focusing
not have an infinite effective number
mainly on the use of JFETs (junction fieldof steps. Their effective resolution and
effect transistors) as voltage-controlled
repeatability (the accuracy with which
resistors. This series was instigated by
the same value can be set after moving
a post on the EEWeb forum about elecaway) may be about 0.5% to 1%. Multitronically controlling resistance, but not
turn mechanical potentiometers provide
specifically about JFETs. Although JFETs
better resolution (finer adjustment) at
(and sometimes other FETs) are comhigher cost. Wirewound mechanical
monly used as electronically controlled
potentiometer have lower resolutions
resistors, and have significant historical
because the wire turns effectively create
significance, they are not the most widely
mechanical steps in the resistance value.
used approach in modern systems. So, this
The resolution of an N-step digipot is
month we will look at ‘digipots’ – digital potentiometers – which are
integrated circuits providing a
similar function to mechanical
potentiometers and trimmers.
Digipots are available
in both rheostat and
potentiometer versions (see
Control logic
Fig.1). Potentiometer versions
can usually also be used in
rheostat mode by using the
Control signals
resistance between the wiper
or standard bus
and one of the ends (A or B).
Digital
Resistance
Switch
The resistance (rheostat) or
interface
register
logic
wiper position (potentiometer)
is controlled with a digital
i n t e r f a c e . Ty p i c a l l y ,
digipots are controlled by a
microcontroller, often via a
serial bus such as SPI or I2C,
but simpler interfaces which
allow the resistance or position
to be stepped up or down, as
well as parallel digital inputs
are also available. The number Fig.2. Circuit concept for implementation of a digipot.
100/N %. For example, with an 8-bit control
word this is 100/28 = 100/256 = 0.4%.
54
Practical Electronics | December | 2022
F
Digipot circuit
Before discussing digipot devices or
parameters further it is useful to look at
a basic digipot circuit, as this provides
insights to their characteristics. Fig.2 shows
a digipot implementation concept diagram
– it is not intended to represent a specific
device. The potentiometer comprises a set
of resistors connected in series between A
and B – this arrangement is often referred
to as a resistor ladder. The total resistance
between A and B is fixed and is referred to
as the end-to-end resistance, or simply the
resistance of the digipot. This resistance
varies widely for available devices – for
example, from 1kΩ to 1MΩ – but devices
with 5kΩ to 100kΩ resistance are more
common. Often, a given IC will be available
in a few different resistance values.
The wiper is implemented using a set of
electronic switches. One of the switches
will be on to determine the wiper position,
all the other switches are off. The A, B and
wiper (W) connections correspond with the
standard potentiometer symbol shown in
Fig.1. The wiper switches connect to all
A
SN
RN–1
SN
RN–2
SN–1
SN–2
SN-1
SN–2
RN–3
Wiper (W)
S1
S0
R1
R0
S1
S0
B
the points between the resistors in the ladder, so they are often
referred to as ‘taps’. The switches are typically implemented
using MOSFETs (transmission gates using an N and P transistor
in parallel).
Which switch is on is determined by the control logic. In the
circuit in Fig.2 the resistance register holds a binary number
controlling the wiper position. This is decoded by the switch
logic to determine which single switch is on. The register value
is set to the required wiper position value by the user via the
interface logic. The interface can take a number of forms, as
already noted, and standard serial buses and up/down controls
are common. Digipot ICs may have multiple potentiometers on
a chip (typically 2, 4 or 6).
Resolution and variations
The number of resistors between A and B (Fig.2) determines
the resolution of the potentiometer and hence the number
of bits required in the resistance register. If all the resistors
have the same value, called the step resistance (RS), then the
resistance from the A or B to the wiper (RAW or RBW) will have
a linear relationship with the resistance register value – this
is called a ‘linear taper’.
It is also possible to scale the resistor values so that the
resistance from the A or B terminals to the wiper varies
logarithmically with the resistance register value (called a ‘log
taper’). The linear and log taper options directly correspond with
linear and logarithmic mechanical potentiometers. Logarithmic
potentiometers are frequently used in audio equipment as
volume controls because of the logarithmic response of the
human ear to the loudness of sound. Using a volume / gain
control with a logarithmic taper digital pot will change the
signal level in constant decibel steps (eg, 1 dB per step).
There are variations possible in the number of resistors and
wiper taps for digipots with a similar resolution. If we have a
7-bit resistance register then there are 27 = 128 possible values,
which means that 128 switches can be controlled. Fig.2 shows
N+1 switches (labelled S0 to SN) for N resistors (labelled R0
to RN–1) in order allow the wiper to be connected directly to
both the A and B terminals – this corresponds to what would
usually be the case for a mechanical potentiometer where the
wiper is connected directly to the terminals which are at the
extremes of the shaft movement. Thus, a 7-bit register would
control a ladder of 127 resistors.
Taking terminal B as a reference, if S0 is on we have a nominally
zero resistance from B to the wiper (RBW) – this is referred to as
the zero-scale setting. With SN on we have the maximum RBW
equal to N × RS for a linear taper. This is the full-scale setting.
Designers may prefer to have a ladder with 128 rather than
127 resistors. This can be achieved either by using an 8-bit
register (the digital wiper position binary value ranges from
00000000 to 10000000), or by still using 7 bits and removing
one of the switches (to terminal A or B) shown in Fig.2. The
latter option means that the wiper cannot connect directly to
one of the terminals – the wiper-to-terminal resistance (RAW or
RBW) at that end cannot be set to a nominal zero value. These
general arguments apply to other resolutions, for example 8 or
9 bit register and 255 or 256 resistors. Which of these options
applies will depend on the digipot device and designers should
be aware of this and the implications for their design in terms
of resistance/wiper control range, step value and software
requirements related to the number of bits used.
Memory
If a mechanical potentiometer is set to a particular value and the
circuit is switched off, then its setting will be the same when
the circuit is next switched on. The mechanical potentiometer
‘remembers’ its setting, unless of course someone moves it
deliberately or inadvertently while the circuit is off (easily done
Practical Electronics | December | 2022
with a front-panel control knob). The same applies to mechanical
trimmers, with less likelihood of inadvertent adjustment as they
are usually less accessible and less easy to knock out of position.
A basic digipot will forget its wiper position setting when
power is removed. Typically, the circuit might have a power-on
reset which determines a specific initial setting (for example,
resets the resistance register to zero). This may not provide
optimal conditions at start up – for example, a volume control
which is always set to zero at power on may not provide the
best user experience.
For systems where the digipots wiper settings are controlled
using a microcontroller (a common scenario) the wiper positions
could be stored by the processor in non-volatile memory
(memory that retains data when power is removed) and restored
at system power-up. The problem with this approach is that it
takes time for the software to configure the system, particularly
if there are several digipots and other initialisation routines
to deal with. This means that the digipots will be temporarily
in a default setting before being adjusted to the required
value. The default values may be inappropriate, particularly
where the digipots are used as trimmers to set adjustments,
such as bias voltage, offsets and gain settings. In some cases,
the inappropriate initial values, or dramatic changes during
initialisation, may cause instability, glitches or even system
malfunction. The problem does not occur with mechanical
trimmers because they will have the correct value at power-up.
The solution to the problem of a digipot having the wrong value
at power up it to use non-volatile memory on the IC itself and a
number of devices provide this facility. The digipot retains the
wiper setting it had at power-off and restores this immediately at
power-on. Some devices provide a one-time programmable (OTP)
memory so that a specific wiper position can be set during initial
system configuration. The OTP value may set the wiper position
always used at power-up, or it may provide a permanent setting
so that the wiper position cannot be changed. This is typically
used for circuits requiring a one-off calibration.
The AD5243 digipot
As mentioned above there are various control interfaces available
for digipots. We will look at three example devices to provide
some idea of the various options. Fig.3 shows a block diagram of
the AD5243 series of I2C digipots from Analogue Devices (typical
price is around £3.25 from Mouser or DigiKey). The AD5243 is a
10-pin device that contains two 256-position potentiometers and
is available with end-to-end resistance values of 2.5kΩ, 10kΩ,
50kΩ, and 100kΩ. it is aimed at replacing mechanical trimmers
for functions such as level setting, bias and offset adjustment,
sensor adjustment and gain control. The control interface is
an I2C serial bus, which only requires two wires – clock (SCL)
A1
W1
B1
A2
W2
B2
VDD
Wiper register 1
Wiper register 2
GND
AD5243
SDA
SCL
PC interface
Fig.3. AD5243 block diagram, an I2C-controlled dual
256-position potentiometer.
55
the digipot (between the L and H pins) after receiving an input
to change the wiper position. The wiper is changed when zero
crossing is detected or after 50ms if one does not occur in that time.
The wiper position of the MAX5407 is controlled by an updown counter. The value in the counter is changed via the U/D
and CS pins. The direction of counting (up or down) is set by the
value on U/D (one for up, zero for down) when the CS pin changes
from zero to one (positive edge on CS). After this, while the CS
pin remains high, the counter can be incremented or decremented
using the U/D pin. Each zero-to-one transition (positive edge) on
U/D will change the count value and hence wiper position by
one step up or down depending on the direction set by the CS
transition. When CS is low, changing the wiper is disabled and
it maintains its position.
H
Maxim
MAX5407
VDD
GND
CS
U/D
ZCEN
W
Up/down
counter
32-position
decoder
L
Fig.4. MAX5407 block diagram, a 32-tap logarithmic taper
digipot with 1dB steps.
and data (SDA). A similar device, the AD5248 (similar price)
provides two rheostats and has address pins allowing multiple
devices to share the same I2C bus. Usually, the I2C bus would
be connected to a microcontroller and software running on
that device would control the potentiometer wiper positions.
The wiper positions for the AD5243 are set by writing an 8-bit
value via the I2C along with a single address bit indicating which
potentiometer is being controlled. The current wiper position
can also be read from the device via the bus. The potentiometer
can be put into a shutdown mode via a control bit. This sets an
open circuit at terminal A and shorts the wiper to terminal B.
The AD5243 does not have a non-volatile memory but has very
low power consumption (1.3μA supply current) so could be kept
powered up when the rest of the system is off in order to retain the
wiper setting (this approach is discussed in the device datasheet).
The MAX5407 digipot
The DS1809 digipot
Fig.5 shows a block diagram of the DS1809 ‘Dallastat’ digital
potentiometer, also from Maxim/Analogue Devices, typical price
is around £10 from Mouser or DigiKey. Note that despite being
costlier, unlike the other two devices mentioned above, which
are strictly surface-mound devices, the DS109 is available in
an 8-pin through-hole package. The DS1809 is a 64-position
linear digipot, available with end-to-end resistance values of
10kΩ, 50kΩ, and 100kΩ. It is aimed at replacing mechanical
potentiometers in general applications. The DS1809 has an onchip non-volatile memory for the wiper position.
The control interface to the DS1809 is designed to facilitate
simple pushbutton control of wiper position – so it does not
require a microcontroller or any software development. However,
the interface can be easily controlled by a processor if desired.
For pushbutton operation the input pins UC (up control) and DC
(down control) are connected to the switches, as shown in Fig.5.
External switch debounce circuitry is not required for correct
operation. The DC and UC pins are pulled up (by resistors in the
device), so pushing the switches creates a low pulse on the input.
A pulse on one of the inputs (DC or UC) which is longer than
1ms but less than 0.5s will cause the wiper position to increment
(UC) or decrement (DC) by one position. Repetitive pulses (to zero)
must be separated by 1ms (high input) or they will be ignored.
A low input longer than 0.5s is interpreted as a ‘push and hold’
and will cause the wiper to change position by one step every
100ms to facilitate quick adjustment over a larger range. Once
the wiper has been moved to one end it will stay there if further
inputs for the same direction are received.
For the DS1809 to store the wiper position in its non-volatile
memory at power-down an external capacitor and Schottky diode
are required, wired as shown in Fig.6. If the DS1809 is controlled by
a processor, then wiper
position storage can be
instigated via the STR
Schottky diode
pin without the external
diode and capacitor.
Fig.3 shows a block diagram of the MAX5407 from Maxim
Integrated (now a subsidiary of Analog Devices, typical price
is around £2.50 from Mouser or DigiKey). The MAX5407 is a
logarithmic taper single digipot potentiometer with 32 tap points
configured to have 1dB steps between taps. It has an end-to-end
resistance of 20kΩ. The MAX5407 is aimed at replacing mechanical
potentiometers in audio applications, for
controls such as volume and balancing. At
RH
power on the device resets to the lowest tap
position (wiper switch closest to L pin on),
RW
it does not store its previous setting in nonvolatile memory.
RL
A problem that can occur with digipots in
audio applications is an audible click when
NV memory
STR
the wiper position is changed. To address this
UC
issue the MAX5407 features a zero-crossing
Control logic
UD
detector. Changing the wiper at the point
the audio waveform is crossing through 0V
prevents sudden signal level changes which
can be heard as clicks. When this is enabled
by taking the ZCEN pin low the MAX5407 Fig.5. Block diagram of the 64-position linear
waits for up to 50ms for zero voltage across digipot DS1809.
56
1
Vcc
7
2
3
10µF
+
4
8
STR
6
5
Fig.6. DS1809 block diagram
showing the addition of an external
capacitor and Schottky diode to store
the wiper position in its non-volatile
memory at power-down.
Practical Electronics | December | 2022
|