AD5222 Programming

Hello people!

My first post here on Arduino forums, sorry if I make any mistakes, hope to learn more from you all!

So I've recently purchased an AD5222 Dual channel 1M ohm digital potentiometer to use with my Arduino Uno. I only need to use one of the channels and so I've soldered and connected it accordingly.

I've been looking for examples with this chip however I've only found a more complex version of a digital potentiometer in the example sketches which makes use of SPI.

I was wondering if there's any other method to control the pot, other than using SPI.

Here's the data sheet for the digital pot that I'm using:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5222.pdf

Sorry if I left out anything!

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

You have done the main thing which was provide a link to the device you are inquiring about.

Can you tell us your electronics, programming, arduino, hardware experience?

Looking at the data, the IC only needs three signals;

  • One to select the pot,.
  • One to indicate if you want to count up or down.
  • One to clock the pot counter.

You don't necessarily need a library to control it.

Tom... :slight_smile:

Hello Tom!

Thank you so much for your reply!

I have basic experience in OOP, Arduino and electronics.

I've tried coding the Arduino to run through the resistance values with power put through to an LED, I'll post the codes and my schematics up in abit!

Here is my simple coding to test the potentiometer:

int clk = 11;
int var = 13;

void setup() {
// put your setup code here, to run once:
pinMode(clk, OUTPUT);
pinMode(var, OUTPUT);
//analogWrite(clk,64);
digitalWrite(clk,0);
Serial.begin(9600);
}

void loop() {
for (int i = 0; i < 127; i++){
digitalWrite(var, 1);
digitalWrite(clk, 1);
delay(100);
digitalWrite(clk,0);
delay(100);
Serial.println(i);
}

for (int i=128; i>0; i--){
digitalWrite(var, 0);
digitalWrite(clk, 1);
delay(100);
digitalWrite(clk,0);
delay(100);
Serial.println(i);
}
}

Is there an online program where I can connect the pins together and screenshot it?
Haha

I've cocked up! It seems to work now! Just gotta get some multimeter to measure the resistance to make sure it's working correctly! Thanks!

Hi,
Good stuff, I glad you put together some code to test the AD5222, better than someone supplying code.
And you learn more about the AD5222 as you go.

Tom.. :slight_smile: :slight_smile: :slight_smile: :slight_smile: 8)

Hey,

Did you have to change anything to get yours working or does your sample code work successfully?

It'd be great if you could make an update on this post about how you got it working and what others need to do for future reference!

Cheers
G