AD5175BRMZ-10 Digital POT

Hello, Im trying to do make this digital pot to sweep from 0 ohms to 10k ohms. When I power it up it starts at 5k and it wont move from there no matter what I’ve done. Here is what i have so far. If you have a better way of doing this please let me know.

// I2C Digital Potentiometer
// by Nicholas Zambetti http://www.zambetti.com
// and Shawn Bonkowski http://people.interaction-ivrea.it/s.bonkowski/

// Demonstrates use of the Wire library
// Controls AD5171 digital potentiometer via I2C/TWI

// Created 31 March 2006

// This example code is in the public domain.

// This example code is in the public domain.

#include <Wire.h>

void setup()
{
Wire.beginTransmission(44);
Wire.write(0x01); // Disable write protect on RDAC
Wire.write(0xC1); //
Wire.endTransmission();

Wire.beginTransmission(44);
Wire.write(0x05); // Write 0x0100 to RDAC
Wire.write(0x00); //
Wire.endTransmission();
}

byte val = 0;

void loop()
{
Wire.beginTransmission(44); // transmit to device #47
// device address is specified in datasheet
Wire.write(byte(0x00)); // sends instruction byte
Wire.write((val / 256) | 0x04); // Take top byte of val and OR with 0x04 to set command value
Wire.write(val % 256); // Send bottom byte of val
Wire.endTransmission(); // stop transmitting

val++; // increment value
if(val == 1024) // if reached 1024th position (max)
{
val = 0; // start over from lowest value
}
delay(100);
}

Are you sure of the address? Have you installed the required pullup resistors (4.7K) on SDA and SCL? The internal pullups may be enabled by the library, but may be too weak.

Here is Nick Gammon’s I2C scanner. Run this to confirm the address and confirm communication. Note the baud rate is set to 115200, make sure serial monitor matches.

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

A "byte val" can never reach 1024. Make it an int and try again.
For safety reasons check for val>=1024, in case 1024 is skipped for some reason.

Here is the address read out

I2C scanner. Scanning ...
Found address: 44 (0x2C)
Done.
Found 1 device(s).

Yes i am using a 4.7k pullup resistoron SDA and SCL.

Then you know that the bus sees it and your address is right. Have you tried DrDiettrich's suggestion?.

i tried replacing val with int but it keeps giving me errors

error: expected ‘)’ before ‘int’
expected unqualified-id before ‘=’ token

sketch_aug25h.ino (900 Bytes)

Do not cross-post. Other thread removed.

byte int = 0;

Should be

int val = 0;

And please post code in code tags so we don't have to download it.

This code still wont change the resistor value, it will go from 0 to 1024 in the serial monitor. The digital resistor is stuck at 5k.

Hey does anyone have ans suggestions on how to make to digital pot move?
thanks, here is what i have so far.

/

/ I2C Digital Potentiometer
// by Nicholas Zambetti <http://www.zambetti.com>
// and Shawn Bonkowski <http://people.interaction-ivrea.it/s.bonkowski/>

// Demonstrates use of the Wire library
// Controls AD5171 digital potentiometer via I2C/TWI




#include <Wire.h>

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin (115200);
  int val;
}

int val = 0;

void loop()
{
  Wire.beginTransmission(44); // transmit to device #44 (0x2c)
                              // device address is specified in datasheet
  Wire.write(byte(0xC0));     // sends instruction byte  
  Wire.write(val);            // sends potentiometer value byte  
  Wire.endTransmission();     // stop transmitting

  val++;                      // increment value
  if(val == 1024)             // if reached 1024th position (max)
  {
    Serial.print ("DONE");    // start over from lowest value
  }
  if (val < 1024)
  {
    Serial.print (val);
  }
  delay(100);
}