Skip to main content

AD5204 Digital Potentiometer Breakout Board

·267 words·2 mins

board-pic

The AD5204 is a Digital Potentiometer with four internal 10kΩ, 50kΩ or 100kΩ potentiometers. It’s a 8 bits chip which means it has 2^8 = 256 steps from 0Ω to 100kΩ. It can be easily controlled by any microcontroller as it uses a Serial Peripheral Interface Bus (SPI).

I was working on a project where I needed to use some of those AD5204, so I developed a tiny breakout board in order to be able to prototype it using a SMD chip on the breadboard.

Now I’m sharing the Eagle Cad files, so whenever you need to use this chip, you can make some breakout boards with OSH PARK and use it with your projects.

Below you can find an Arduino code example along with useful links.
Hope this can be useful for you!

Any question just let me know!

Ressources #

Git Repository
Digikey Part
Datasheet

Arduino Pins #

GND -> GND
CS  -> Pin 10
VDD -> 5V Supply
SDI -> Pin 11
CLK -> Pin 13
SDO -> Pin 12

Example Code for Arduino #

/*
  AD5204 - Arduino Example
  www.danielandrade.net - daniel spillere andrade
  https://github.com/dansku/ad5204
  June 2014
*/

#include "SPI.h"    // SPI Library

const int CS = 10;    // Chip Select For the AD5204

//----[Setup]------------------------

void setup()
{
  pinMode(CS,OUTPUT);
  digitalWrite(CS,HIGH);
  SPI.begin(); // start SPI bus.
  SPI.setBitOrder(MSBFIRST);
}

//----[Loop]--------------------------

void loop()
{
  //Set resistance from 0% to 100% in all output
  for(int i=0;i<4;i++){
    for(int j=0;j<255;j++){
      setPot(i,j);
      delay(100);
    }
  }
}

//----[Functions]--------------------

// POT value: 0 -> 3
// LEVEL valeu: 0 -> 254 (8 bits)

void setPot(int POT, int LEVEL){
  digitalWrite(CS, LOW);
  SPI.transfer(POT);
  SPI.transfer(LEVEL);
  digitalWrite(CS, HIGH);
}