Controlling Digital Potentiometer AD5235

I'm not officially lost!

Ive got a AD5235(http://www.analog.com/static/imported-files/data_sheets/AD5235.pdf) for replacing the volume dial in my audio amplifier.

I've got the thing wired up and coded as per this tut - http://www.arduino.cc/en/Tutorial/SPIDigitalPot#.UwdMqHna7wN - but it doesn't work. I see no change on the wiper reading.

I've tried using this one as well - http://www.reigndesign.com/blog/controlling-a-10-bit-digital-potentiometer-via-spi-with-arduino/

And, I've also tried this replicating this once - http://forum.arduino.cc/index.php/topic,85837.0.html

All to no avail.

This is all part of a home cinema project, and everything else is working bar this last bit.

Can someone offer me some support?

Thanks

Martin

  • pin 10 , SS defined OUTPUT ??
  • all connection cables OK ?
  • spi-mode ? , msb/lsb first ?
  • pullups needed ?

* no mods in transfer speed

When examples for that chip fail, its closest to mind to check all cables once more.

(remove power, disconnect all, make connections over again, (remenber 5V/GND)

if it still doesnt work. hardware has faults. use scope to check signals

Im just going to get the breadboard back out and try it again.

Ive got a Pro Mini, could you quickly run up the config you would use for the rest of the pin configuration.

I’v seen the datasheet. Not sure, but from what I can see(read) I hope somethine near this can do.
Uncertain if info have to be stored in chip…

/* interfacing AD5235, digital pot
  Arduino pin  AD5235
  D10 (CS)     CS  (pin 15)
  D11 (MOsi)   Din (pin 2)
  D12 (MIso)   Do  (pin 3)
  D13 (Clk)    Clk (pin 1)
  GND          GND (pin 4),Vss (pin 5) 
  5V           Vdd (pin 12),wp(13),pr(14)  
  --------------
  Wiper1: pins  6, 7, 8
  Wiper2: pins 11,10, 9
  no connect RDY pin 16 
  ADDR (wiper1) = 0
  ADDR (wiper2) = 1
*/
 
#include <SPI.h> 

byte cs = 10;
byte wip1=0;

void setup() 
{
  SPI.begin();
  SPI.setBitOrder(MSBFIRST); //We know this from the Data Sheet 
  // 24bits must be sent 
  pinMode(cs,OUTPUT); 
  digitalWrite(cs,HIGH);
}

void loop() 
{
  // test: set incr. position 0..1020 step 15 
  for (int i=0; i<1024; i+=15)
  { 
    setvol(0,i); //wiper,volume
    delay(100);
  } 
}

void setvol(byte wiper, int value) // wiper MUST be 0 or 1
{
  digitalWrite(cs, LOW); //select potmeter
  byte command = 0xB0 || wiper; 
  byte hibyte = highByte(value); 
  byte lowbyte = lowByte(value); 
  SPI.transfer(command); 
  SPI.transfer(byte1);
  SPI.transfer(byte0);
  digitalWrite(cs, HIGH); 
  // may remove nxt 5 lines: (stores this setting to eeprom)
  digitalWrite(cs, LOW); //select potmeter
  SPI.transfer(0x20 || wiper); 
  SPI.transfer(0);
  SPI.transfer(0);
  digitalWrite(cs, HIGH); 
}