From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

i2C Digital Potentiometer

Solved!
Go to solution

Hi All,

 

I'm trying to setup a simple VI on a myRIO-1900 to use a digital potentiometer as a variable resistor. I have preciously used an SPI dpot with success however I am having issues when switching to an i2C controlled dpot.

AD5241 pinout.PNG

Following the datasheet found here ( http://www.analog.com/media/en/technical-documentation/data-sheets/AD5241_5242.pdf ) I have made the following connections.

 

[1] A1 -> 5V
[2] W1 -> Analog Input
[3] B1 -> DGND
[4] Vdd -> 5V
[5] SHDN -> Vdd (5V)
[6] SCL -> [32] I2C SCL
[7] SDA -> [34] I2C SDA
 
[8] AD0 -> 0V analog output
[9] AD1 -> 0V analog output
[10] DGND -> DGND
[11] Vss -> DGND
[12-14] -> No connections
 
When I make these connections and run the following VI with the i2C express VI set to write, I end up reading a constant voltage which does not change with variation of the 8bit vertical point slide input. Furthermore, I am experiencing some chip overheating if the VI runs for too long which shouldn't be occuring. 
 
i2c dpot.PNG
There are several areas which I think the error may be arising from:
 
1. Pinout connections outlined above are incorrect.
2. The slave address is incorrect. I am unsure whether I should be sending analog or digital outputs to the AD pins to define the slave address. the datasheet states " Package pin programmable address bits. Must be matched with the logic states at Pin AD1 and Pin AD0." I hav e set both to a logic low (I think) and therefore assume that AD0 and AD1 are 00. So the slave address bit is 01011 then 00 whch is 255. I have also tried setting both to boolean false with a digital output but I expereince the same problems.
3. Incorrect soldering. The chip is a SOIC chip and I have hand soldered it onto an adaptor board (winslow w9502RC) so that I can sit it into my breadboard.
 
Does anyone have an idea what the problem/s might be?
 
Cheers,
Ben

 

Message 1 of 11
(7,416 Views)

From page 5 of your manual, it looks like the communications is accepted in the format of slave address, instruction byte, data byte. From what I'm seeing of your code, it appears that you are missing the instruction byte. The input to "Bytes to Write" should be in the format of a 1D array, so you should be able to feed a 2-element array in with the instruction byte as the first element and the data as the second.

 

In addition, it looks like your address might be wrong. It should be 01011000 (the last digit is 0 because write enables at low; page 5 of manual), which should be 88 and not 255 as you have it.

 

This is what I can see so far. Hopefully this helps!

0 Kudos
Message 2 of 11
(7,378 Views)

You might be onto something with regards to the instruction byte. According to the datasheet I'm assuming I do not ned to select an RDAC as I am using the AD5241 with one potentiometer, I have no need for a midscale reset and SD is active high so I would want this to be low therefore for the instruction byte I can send a 00000000 byte then use the build array function to subsequently add the 8 bit data for the "data byte"? Or should I be using a different method of sending these two elements?

0 Kudos
Message 3 of 11
(7,347 Views)
Solution
Accepted by bsia5466

My assumption was a 1D array of two elements, the first being the instruction byte and the second being the data byte. However, that's just my educated guess; if you're looking for more information, I might ask the makers of the AD5242 for more information.

0 Kudos
Message 4 of 11
(7,316 Views)

Thankyou TheXiadow, a 1D array of two elements was the solution. Also, I had damaged two of my chips through overheating so a new chip + correct instruction and data bytes was teh trick.

0 Kudos
Message 5 of 11
(7,264 Views)

Great! Glad we were able to figure that out.

 

Cheers!

0 Kudos
Message 6 of 11
(7,241 Views)

Hi,

  I am having problem in I2C communication with AD5241. The slave device address is 0x58 (for write) and 0x59 (for read).

The problem i am facing is when i am sending the slave address, the device is sending ACK but when i send the instruction byte(0x00) the device is sending NACK.

I am able to read the RDAC value in read mode. But i am unable to write any value to RDAC. What might be the instruction byte should i send.? Please help me with the issue. Thanks.

0 Kudos
Message 7 of 11
(6,748 Views)

What instruction byte are you sending? Specifically, I might suggest looking into what values you have set for the output logic pin values, and if what you are setting them as is what you expect. There's a little more information on those two pins on page 3.

0 Kudos
Message 8 of 11
(6,721 Views)

It also looks like you're posting on an older post that has been resolved -- more people might see it if you start a new post!

0 Kudos
Message 9 of 11
(6,720 Views)

the instruction byte that i am sending is 0x00 and sometimes 0x40 if i want midscale reset. The Output logic pins are grounded and voltage levels are as expected only..

0 Kudos
Message 10 of 11
(6,700 Views)