AD5292 Digital Pot Help needed

Hi everyone

I am new to using arduino and i need to make a project that provides a variable load that can be controlled using the Software. I tried using digital pots and they worked great. But i needed to have very low tolerance so that is how i came across the AD5292. But as i began trying to work with them i realizes that the AD5292 does not have a CS pin which is what i used for the last Digitalpot. I was wondering how i can work around this. Any help would be greatly appreciated.

Kind regards

You realise that the maximum current through the controlled resistance is only 2mA (or 3mA for the 20k version) ?

Unless you have more than 1 slave on the SPI bus, it doesn't matter - you just don't use the CS line from the Master.

1 Like

From the data sheet

When SYNC goes low, it enables the shift register and data is transferred in on the falling edges of the following clocks. The selected register is updated on the rising edge of SYNC.

it looks like this is the equivalent of /CS on the SPI bus.

The datasheet claims SPI compatibility, it would be odd for there to not be something like /CS.

a7

2 Likes

Hi awneil

Thank you for responding. I am aware of the current capabilities i plan to use the digital pot values of for 4K and above so it is below the max current of 3mA. Thanks again for responding

Hi Alto777

I would like to thank you for your help. After reading you post and looking at the datasheet i see that you are correct. I am now using SYNC. However i am still unable to get the wiper to move.

Here is a list of the connections from the ad5292 digital pot to the arduino and the power supply:

And here is the arduino code i have been using:

#include <SPI.h>

const int SYNCPin = 10;

void setup() {
Serial.begin(9600); // Initialize Serial communication for debugging
SPI.begin();
pinMode(SYNCPin, OUTPUT);
digitalWrite(SYNCPin, HIGH); // Deselect the AD5292 initially
}

void loop() {
for (int resistanceValue = 0; resistanceValue <= 1023; resistanceValue++) {

digitalWrite(SYNCPin, LOW);

// Send the command and data
SPI.transfer(B01000000); // Write data to the RDAC register
SPI.transfer(highByte(resistanceValue)); // Send the high byte of the 10-bit resistance value
SPI.transfer(lowByte(resistanceValue));  // Send the low byte


digitalWrite(SYNCPin, HIGH);

// Print debugging information
Serial.print("Set resistance value to: ");
Serial.println(resistanceValue);

delay(10); // Delay for 10 milliseconds (adjust as needed)

}
}

If anyone can see a problem or mistake with my code or wiring i would be very gratefully.

Thanks again

Unfortunately I am not familiar with the AD5292, but I found this library

https://github.com/That8BitMan/AD5292/tree/master

on github.

Maybe it could be helpful to study the code (or use the lib)?

It's from 2017 and does not seem to be in a full working condition but it still may be worth to look into it (or contact the developer?) ...

Good luck!

1 Like

A schematic is preferred. A picture that is not 90 rotated is better. And please learn how to post code.

And read the datasheet. You need to supply your Vcc to the VLogic pin.

I checked nothing else.

a7

2 Likes

:+1:

Hand-drawn is fine.

Some suggestions for free online schematic tools here:

See also: 'How to get the best out of this forum'

2 Likes

A couple more free drawing sites:

2 Likes

FWIW hand drawn is often easiest and fastest, and can be entirely adequate.

I like schematic drawing programs, but just as word processors do not teach you how to write, CAD doesn't teach you how to draw a schematic.

And like reading makes you a better writer, looking at schematics will help you now how they should be drawn.

You can go a long time with pencil and paper, and nothing you learn doing it that way will be wasted when you step up or into schematic drawings tools.

The first important thing is to show every component, with clear markings on the pins, and all the connections between them.

In this area of work, particular attention should be paid to the sources of power and how power get to the parts that need it, like servos and sensors and stuff.

HTH

a7

2 Likes

Hello everyone

I am fairly new to working with Arduino and would appreciate it if someone could help me with this project. I am working with an AD5292 digital potentiometer, I aim to be able to change the wiper position using SPI communication the Arduino. When the AD5292 is wired and powered the wiper resistance is on 20K but when i run the Arduino code and try and change the wiper resistance nothing changes. Here is the code i am using

#include <SPI.h>

// Define the AD5292 control pins
const int CS_PIN = 10; // Chip select (CS) pin



void setWiperPosition(uint16_t position) {
  // Command 1 for writing data to RDAC
  uint8_t command = 0b00000001;

  // The data word to set the wiper position to step 100
  uint16_t dataWord = position & 0x03FF; // Make sure it's within 10 bits

  // Start communication
  digitalWrite(CS_PIN, LOW);

  // Send the command
  SPI.transfer(command);

  // Send the data word
  SPI.transfer(highByte(dataWord));
  SPI.transfer(lowByte(dataWord));

  // End communication
  digitalWrite(CS_PIN, HIGH);
}

void setup() {
  // Initialize SPI communication
  SPI.begin();
  SPI.setDataMode(SPI_MODE0); // Set data mode to Mode 0
  SPI.setClockDivider(SPI_CLOCK_DIV16); // You may need to adjust the clock speed

  // Set the Slave Select (SS) pin as an output
  pinMode(CS_PIN, OUTPUT);
}

void loop() {
  // Set the wiper position to step 100
  setWiperPosition(100);
  delay(1000); // Delay for testing (you can adjust this)
}

The datasheet for ad5292 page 23 talk about sending a 16 bit message which contains the command and the value you want to send. I believe my code preforms this but again my wiper is not changing.

If anyone can help i would be very grateful.

Thanks again.

Someone found a library here:

1 Like

Hi awneil

Thanks for responding. I am use to working with GitHub but it seems that the code used in that library is for I2C communication which does not help because i am using SPI.

Thanks again

I have asked the moderators to combine your threads on this matter. Ppl are gonna ask all the same questions again.

Read the data sheet.

You may have overlooked tying the reset line on the chip HIGH…

which is why we wanted a schematic.

a7

Sorry, I missed the point with the different interfaces...

However, there is a library for the AD5293 using SPI which might be of interest for you (provided that the differences are not too big)

https://github.com/GregorioW/AD5293

Good luck!

@paulmurph, please do not cross-post. Threads merged.

Unless you have to replace an existing actual pot there are almost always better and simpler ways to achieve your result. More research needed,

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.