I am trying to program a digital resistor and set it's wiper resistance. The general circuit looks a little like this where "pot" represents the Maxim DS1801 digital resistor and DUE is, of-course the 3.3v Arduino DUE.

POT       DUE
CLk ----> SCK
D    ----> MOSI
RST ----> CS (ChipSelect) (PIN10)

Now so far, I have sucessfully been able to interface with the DS1801, but I am having issues determining how to properly set the wiper resistance values. The DS1801 datasheet says the it accepts a 16bit input and from application example online it looks like the values range from 0 to 64. Here is my code:

// include the SPI library:
#include <SPI.h>

// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;
int mute = 64;
int loud = 63;
int soft = 0;

void setup() {
  // set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
  // initialize SPI:
   digitalPotWrite(mute, mute);

void loop() {

  // Raise the volume from off to loud
for(int i = 0; i <= 63; i++){
  digitalPotWrite(i, i);

void digitalPotWrite(int left, int right) {
  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, HIGH);
  //  send in the address and value via SPI:
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, LOW);

I THINK my issue lies with setting the clock rate for the DS1801. The data sheet say the chip runs at 10MHz which is why I wrote


to divide the 84MHz default speed down to 10MHz.

Anyone have suggestions on why my code is not working??? At the moment, I have LED's connected to chip with series resistors to limit current below 2mA. The resistors just blink randomly with the code posted above.

enter image description here

enter image description here

  • 10MHz is too high to have flapping around in the breeze. Show your circuit setup. Apr 22, 2015 at 22:56
  • I'm not exactly sure what you mean by that? lol ... Okay, I'll go snap a picture of the circuit and update my post. Why would 10MHz be too high if that's what it says in the datasheet? I don't doubt you, I'm just wondering thats all! :) Apr 23, 2015 at 3:21
  • Poor wiring can turn a 10MHz signal into a dog's breakfast, so extra care must be taken when routing such. Apr 23, 2015 at 3:33
  • Alright, I threw up some pictures, hopefully you can make that out.... essentially, blue is the bit line (D - MOSI), white is the 10MHz clock, and green is Chip Select (or RESET as the datasheet calls it) Apr 23, 2015 at 3:45

2 Answers 2


There is no way in hell you're going to get a 10MHz signal down that line. Shorten it to 3 inches total maximum and reduce the clock rate to 2MHz or lower. It is possible to get a 10MHz signal through, but you'd need to switch to twisted pair wiring and proper termination to even begin to have a chance to get it to work.


Well, it turns out that apparently my issue was not having the AGND pin hooked up. In addition to that, I was trying to switch the wiper resistance value too quickly. By putting at least a 10ms delay between calls, it works much better.

Also, it does seem to work even at 10MHz just fine...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.