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.
|Bus Pirate||DS1801 (pin #)|
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: 0×40 <–mute setting channel 0
WRITE: 0×40 <–mute setting channel 1
AUX LOW <–RST pin low
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
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
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.