AD5171 Digital Potentiometer

This example shows how to control a Analog Devices AD5171 Digital Potentiometer which communicates via the I2C synchronous serial protocol. Using Arduino's I2C Wire Library, the digital pot will step through 64 levels of resistance, fading an LED.

The I2C protocol involves using two lines to send and receive data: a serial clock pin (SCL) that the Arduino Master board pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices. As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information - that will form in sequence the address of a specific device and a a command or data - is transferred from the board to the I2C device over the SDA line. When this information is sent - bit after bit -, the called upon device executes the request and transmits it's data back - if required - to the board over the same line using the clock signal still generated by the Master on SCL as timing.

Because the 12C protocol allows for each enabled device to have it's own unique address, and as both master and slave devices to take turns communicating over a single line, it is possible for your Arduino board to communicate (in turn) with many devices, or other boards, while using just two pins of your microcontroller.

Hardware Required

  • Arduino Board

  • AD5171 Digital Pot

  • LED

  • 680 ohm resistor

  • 2 4.7k ohm resistors

  • hook-up wires

  • breadboard

Circuit

Connect pins 3, 6, and 7 of the AD5171 to GND, and pins 2 and 8 to +5V.

Connect pin 4, the digital pot's clock pin (SCL), to analog pin 5 on the Arduino, and pin 5, the data line (SDA), to analog pin 4. On both the SCL and SDA lines, add 4.7K ohm pull up resistors, connecting both lines to +5 V.

Finally, wire an LED to pin 1, the AD5171's "wiper", with a 680 ohm LED in series.

AD5171 bb

image developed using Fritzing. For more circuit examples, see the Fritzing project page

When the AD5171's pin 6, ADO, is connected to ground, it's address is is 44. To add another digital pot to the same SDA bus, connect the second pot's ADO pin to +5V, changing it's address to 45.

You can only use two of these digital potentiometers simultaneously.

Schematic

AD5171 sch

AD5171 pinconfig

Code

See Also

Last revision 2018/05/17 by SM