Post Go back to editing

Different Resistance Values for AD5293

Thread Summary

The user is experiencing erratic resistance values when cycling through bit settings on an AD5293 digital potentiometer. The final answer suggests disabling the default write protection on the RDAC register by setting bit C1 to 1. However, the user reported that this did not resolve the issue, and the resistance values still show unexpected jumps, suggesting a possible bit offset problem.
AI Generated Content
Category: Hardware
Product Number: AD5293

Hello, I have the following problem:

I am testing two AD5293 digital potentiometers, and when cycling through all bit values to set the resistance, one of them behaves strangely. At some points, it shows out-of-range values, such as 180kΩ (which I assume is an open circuit). Then, it starts working normally, varying between approximately 50kΩ and 100Ω.

However, when I try to set values manually, the readings are inconsistent. For example, at a setting of 0, it measures 166Ω; at 512, it measures 30kΩ; and at 1023, it measures 220Ω.

Meanwhile, the other potentiometer, which behaves more consistently, gives these values at 0, it measures 37.3kΩ; At 512, it measures 20.5kΩ; At 1023, it measures 180Ω.

Does anyone know what might be causing this? Is there a way to calibrate it, or could the potentiometer be damaged?

This is the code i'm using:|

#include <SPI.h>

const int slaveSelectPin = 5;  // CS
const int CLK = 18;
const int SDO = 19;
const int DIN = 23;


void setup()
{
  pinMode(slaveSelectPin, OUTPUT);
  SPI.begin();
  SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));
  Serial.begin(115200);

  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(0x18);
  SPI.transfer(0x00); // Performance Mode
  digitalWrite(slaveSelectPin, HIGH);
  SPI.endTransaction();

  init_digiPot();
}

void loop()
{
  /*
  digitalPotWrite(0);
  delay(4000);
  digitalPotWrite(512);
  delay(4000);
  digitalPotWrite(1023);
  delay(4000);
  */
  unsigned int val;
  for (val = 0; val <= 1023; val++) {
    digitalPotWrite(val);
    delay(100);
  }
  for (val = 1023; val > 0; val--) {
    digitalPotWrite(val);
    delay(100);
  }
}

void init_digiPot()
{
  SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));
  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(0x18);
  SPI.transfer(0x02); // Wiper update
  digitalWrite(slaveSelectPin, HIGH);
  Serial.print("Setup: ");
  Serial.println();
  SPI.endTransaction();
}

void digitalPotWrite(unsigned int val) {
  SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));
  digitalWrite(slaveSelectPin, LOW);
  byte highbyte = (val >> 8) + 0x04;  //high wiper byte + command wiper update
  byte lowbyte = val & 0xFF;
  SPI.transfer(highbyte);  //send wiper data high byte
  SPI.transfer(lowbyte);   //send wiper data low byte
  Serial.print("Val: ");
  Serial.println(val);
  digitalWrite(slaveSelectPin, HIGH);
  SPI.endTransaction();
}