0
\$\begingroup\$

I am trying to use the AD5231 Digital potentiometer in a school project. However, I am having a lot of trouble with it. It's supposed to be connected to raspberry pi (model 2 B+) and I've trying to speak to it via SPI

I was wondering if anyone can help me with this. This is the following code I am using to try and speak to the device (I'm using Python)

spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 10000
spi.writebytes([0xC0, 0x00, 0x00])

However, no matter what I do, I am constantly reading 75kohms from terminal A to terminal B, where B is grounded and A is a NC. I'm not sure whether I should be feeding any voltage to the wiper resistance. The rest of the hardware should be set up properly as I have redone it a few times to make sure.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ at every step, check whether you have an error. I don't know your SpiDev library, so it's hard to tell you how to do that. Also, make sure you've configured the SPI bus correctly. SPI has something called polarity, which defines clock edge and signal polarity. Try out whether the pins you're using are actually the pins used to send your SPI commands. \$\endgroup\$ Dec 31, 2019 at 23:40
  • \$\begingroup\$ Depending on the AD5231 version, you should read 10K, 50K or 100K between the A and B terminals - they are the ends of the resistance element. The resistance between terminal W (the wiper/moving contact) and terminal A or terminal B should vary depending on the values you write to the device. The resistance between B and W should be near Zero when you write Zero to the device. \$\endgroup\$ Jan 1, 2020 at 0:13
  • \$\begingroup\$ Thanks for the replies. I had connected the spi ends to an oscilloscope and everything looked fine. I was able to see the data and read it on the scope. I tried to measure the resistance from W to b, again it remains constant. \$\endgroup\$
    – George
    Jan 1, 2020 at 1:10
  • \$\begingroup\$ Im not sure if there’s a something that’s blocking inside the IC, or if I should place resistors before supplying the power source or not. I’m really lost to be honest and it’s very frustrating. Not much examples online only the data sheet really. \$\endgroup\$
    – George
    Jan 1, 2020 at 1:13
  • \$\begingroup\$ According to the datasheet, the command you are using C0 will left shift the RDAC data by 1 position (increasing the resistance). but if you are using a 10k device, 7.5k will already have the msb set and little will occur. Try using code B0 to actually set an arbitrary value. You could also try command 01 which will restore the EEMEM contents which (if unchanged from factory) will set it up for midscale. \$\endgroup\$ Jan 1, 2020 at 11:29

1 Answer 1

0
\$\begingroup\$

Setting the mode helped us properly communicate to the digipots. Thanks Peter Smith for your answer.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.