Go Down

Topic: Digital Pot Not Working (AD5207) (Read 683 times) previous topic - next topic

Harjit Singh

Feb 06, 2013, 02:15 am Last Edit: Feb 06, 2013, 02:22 am by Harjit Singh Reason: 1
Hello Everyone,

I need your help, I've created a circuit in which I need to use a two channel digital pot via SPI. I'm using the AD5207 from Analog Devices. The issue is that I am getting no feedback/response in either resistance or voltage on either of the two wiper channels (W1) and (W2). I may have made a mistake in the way I wired it, could you look over the attached schematic? It's connected to an ATMEGA328. The micro controller itself works, and is able to do all functions (read/write/PWM/etc). The AD5207 supports negative voltage from what I read, but, I don't believe it's required (optional), I'm using +5V to power it.

Link to datasheet is here: http://www.analog.com/static/imported-files/data_sheets/AD5207.pdf

Code I've tried to test this with is below, I've modified it from 6 channels to 2 from the example that comes with the Arduino software.

Code: [Select]

 Digital Pot Control
 This example controls an Analog Devices AD5206 digital potentiometer.
 The AD5206 has 6 potentiometer channels. Each channel's pins are labeled
 A - connect this to voltage
 W - this is the pot's wiper, which changes when you set it
 B - connect this to ground.

The AD5206 is SPI-compatible,and to command it, you send two bytes,
one with the channel number (0 - 5) and one with the resistance value for the
channel (0 - 255).  

The circuit:
 * All A pins  of AD5206 connected to +5V
 * All B pins of AD5206 connected to ground
 * An LED and a 220-ohm resisor in series connected from each W pin to ground
 * CS - to digital pin 10  (SS pin)
 * SDI - to digital pin 11 (MOSI pin)
 * CLK - to digital pin 13 (SCK pin)

created 10 Aug 2010
by Tom Igoe

Thanks to Heather Dewey-Hagborg for the original tutorial, 2005


// inslude the SPI library:
#include <SPI.h>

// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;

void setup() {
 // set the slaveSelectPin as an output:
 pinMode (slaveSelectPin, OUTPUT);
 // initialize SPI:

void loop() {
 // go through the six channels of the digital pot:
 for (int channel = 0; channel < 2; channel++) {
   // change the resistance on this channel from min to max:
   for (int level = 0; level < 255; level++) {
     digitalPotWrite(channel, level);
   // wait a second at the top:
   // change the resistance on this channel from max to min:
   for (int level = 0; level < 255; level++) {
     digitalPotWrite(channel, 255 - level);


int digitalPotWrite(int address, int value) {
 // take the SS pin low to select the chip:
 //  send in the address and value via SPI:
 // take the SS pin high to de-select the chip:

I'm using an SMD based ATMEGA328 (Digi-Key ATMEGA328P-15AZCT-ND): http://www.digikey.com/product-detail/en/ATMEGA328P-15AZ/ATMEGA328P-15AZCT-ND/2477177

For reference, here is a pin map of the chip:



Your schematic doesn't show anything connected to the AD5207 SHDN pin(6). 

According to the datasheet:
"The SHDN pin forces an
open circuit on the A Terminal and at the same time shorts the
wiper to the B Terminal, achieving a microwatt power shutdown
state. When SHDN is returned to logic high, the previous latch
settings put the wiper in the same resistance setting prior to

Basically stating that in order for potentiometer to work, SHDN must be HIGH.   In my application, I used a digital pin of the Arduino to control toggle this pin high or low. SHDN HIGH = potentiometer working as expected (on),  SHDN LOW = Wiper shorted to ground and the Signal terminal (A) open (no output signal at wiper).

Hope this helps,

Harjit Singh

Thank you! That resolved the issue.  :)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131