Dallas/Maxim’s DS1801 is an audio volume potentiometer with a simple SPI interface. This chip has two channels of volume control that might be useful in a DIY audio project. We previously looked at the DS1807, a similar part with an I2C interface. This week we’ll show you how to use the SPI version.
DS1801 SPI digital audio volume potentiometer (Digikey search, Octopart search, $6.50). Datasheet (PDF).
Bus Pirate | DS1801 (pin #) |
GND | GND (1) |
AUX | RST (3) |
GND | ZCEN (4) |
GND | AGND (11) |
MOSI | D (12) |
Clock | CLK (13) |
+3.3volts | VCC (14) |
We connected the DS1801 to our Bus Pirate universal serial interface tool as shown in the table. We used the Bus Pirate to demonstrate this chip, but the same basic procedures apply to any microcontroller. The DS1801 power requirements are flexible, it works at either 3.3volts or 5volts, we used a 3.3volt supply.
The DS1801 has an SPI interface. The data output pin can be used to cascade multiple DS1801s. We used the Bus Pirate’s SPI mode with default options to interface this chip.
The DS1801 SPI protocol is described in figure (a) on page 4 of the datasheet (shown above). Note that the SPI enable signal, called RST on the DS1801, is actually opposite standard notation. Data input is active when RST is high, and inactive when it’s low.
Each DS1801 has two audio potentiometers with 64 steps of volume control. 0 is full volume, 63 is the lowest volume, position 64 is mute. Setting the volume is really simple; just raise the RST signal, clock in the volume level for each potentiometer, and lower RST to enact the new settings.
SPI>A 64 64 a
AUX HIGH <–RST pin high
WRITE: 0x40 <–mute setting channel 0
WRITE: 0x40 <–mute setting channel 1
AUX LOW <–RST pin low
SPI>
Here, we set both potentiometers to mute (64). First, raise the RST pin to 3.3volts (capital ‘A’, silly CSS). Next, write the mute setting for each (64 64). Finally, lower the RST pin to enact the new settings (small ‘a’).
SPI>A 0 0 a
AUX HIGH
WRITE: 0x00
WRITE: 0x00
AUX LOW
SPI>
Now we change both potentiometers to full volume by writing a 0 to each. The sets a resistance level of 0, or 100% of the input volume.
SPI>A 0 64 a
AUX HIGH
WRITE: 0x00
WRITE: 0x40
AUX LOW
SPI>
Finally, we set a different volume levels on each potentiometer. Pot 0 is at full volume (0), pot 1 is muted (64).
Like this post? Check out the parts posts you may have missed. Want to request a part post? Please leave your suggestions in the comments.
Could this chip be used to vary the inductive load if used to short a motor? I have been wondering about using plain DC motors as both drivers and restistive parts in a variably compliant joint for robots. Under load, the motor would help move the joint, but at certain points the motor would either be driven against the direction of motion or shorted in such a way as to provide resistance to further motion.
CS3310/PGA2311 etc are better in my opinion. Balanced, lower distortion, and bipolar to a high voltage level gives better sound.
The PGA2310/2311 are vastly superior parts, in terms of audio quality.