APPLICATION NOTE 4051

Using an Analog Voltage to Control a Digital Potentiometer

By:  Hrishikesh Shinde

Abstract: In some applications a digital potentiometer with an I²C interface must be controlled by a continuously varying analog signal. This application note addresses this requirement, and provides a simple design solution. The principle presented here is versatile and can be used in multiple applications.

A similar article appeared in the March 20, 2008 edition of EDN magazine.

Introduction

This application note describes a simple method that uses an external analog voltage to change the resistance of a digital potentiometer. The Microchip PIC12F683 microcontroller is used to make the conversion from an analog voltage to an I²C stream, which is then used to control the digital potentiometer. The DS1803 digital potentiometer serves as the example device and a minimum number of external components is used in this application. The ideas presented here can be applied to other control inputs and other digital potentiometers/resistors.

Hardware Configuration

Figure 1 shows the schematic for the control circuit that uses the PIC12F683. Four of the microcontroller's six GPIOs are used to control output signals on SDA, SCL, and a single LED, and to accept one analog input.

Output signals on SDA, SCL, and the LED are assigned to GP5, GP4, and GP0, respectively. SDA and SCL have 4.7kΩ pull-up resistors to VDD and connect directly to the DS1803's SDA and SCL pins. The microcontroller's GP1 IO is assigned as the analog input pin. Jumpers are provided for selecting address pins, separating the shared VCC (VDD), and isolating SDA and SCL.

Figure 1. Schematic illustrated analog voltage control of a digital potentiometer.
Figure 1. Schematic illustrated analog voltage control of a digital potentiometer.

Project Firmware

Firmware for this project was written in assembly language using the MPLAB IDE (version 7.40). This tool is currently available from Microchip at no cost. The entire program consists of fewer than 450 bytes in program space (Flash) and 8 bytes in data space (RAM).

The program first initializes the various configuration bits in the PIC, including the ADC and the internal oscillator. The program configures the ADC to accept input from GP1, and sets the conversion clock to use the internal oscillator at 125kHz.

The firmware runs in a loop with the ADC converting the voltage at the analog input continuously. Once a conversion is complete, the 8 MSBs of the 10-bit ADC output are used as the data byte to be sent over the I²C bus. This I²C signal is then used to control the DS1803. The program is set up to control both the potentiometers on the DS1803; by making a change in the firmware, however, the potentiometers can be controlled individually with two different analog inputs on the PIC12F683.

The firmware is available for download.

Versatile Functionality

The program allows the user to control the potentiometer by varying a voltage on the PIC12F683's GP1 input. A continuously varying input on GP1 will cause a corresponding change in the resistances of the potentiometers. The output resistance (ROUT) can be calculated as a function of the input voltage:

End-to-end resistance of the DS1803 used in the design: 50kΩ
VCC range allowable: 2.7V to 5V
Input voltage varies from 0V to VCC

Output resistance observed will be:

ROUT (kΩ) = (50 (kΩ)/VCC) × Input Voltage

While the ADC is running, the LED blinks constantly. The LED remains on in case an I²C error occurs. Once the error is corrected, the LED resumes normal function. The designer can troubleshoot the application by checking that the device address is correct and that the I²C bus is connected.

This design is quite versatile, and a similar approach can be used for a variety of applications. Some examples include:
  1. A nonlinear transfer function (e.g., gamma correction) can be implemented by using the DS3906 variable resistor with the correct transfer function implemented in the embedded lookup tables.
  2. A thermistor can be connected at the input to vary the output of an I²C-controlled current DAC when there are changes in the ambient temperature (DS4402/DS4404).

    Figure 2

Conclusion

This application note describes a simple and cost-effective mechanism for controlling a digital potentiometer by using an analog voltage. The application concept can be extended to use an analog voltage to control any device with an I²C interface.

Questions/comments/suggestions concerning this application note can be sent to: .

Related Parts
DS1803 Addressable Dual Digital Potentiometer Samples  
DS1805 Addressable Digital Potentiometer  
DS1807 Addressable Dual Audio Taper Potentiometer Samples  
DS1808 Dual Log Digital Potentiometer  
DS1844 Quad Digital Potentiometer  
DS1845 Dual NV Potentiometer and Memory Samples  
DS1846 NV Tri-Potentiometer, Memory and MicroMonitor  
DS1847 Dual Temperature-Controlled NV Variable Resistor Samples  
DS1848 Dual Temperature-Controlled NV Variable Resistor & Memory Samples  
DS1855 Dual Nonvolatile Digital Potentiometer and Secure Memory Samples  
DS1870 LDMOS RF Power-Amplifier Bias Controller  
DS1881 Dual NV Audio Taper Digital Potentiometer Samples  
DS1882 Dual Log Audio Digital Potentiometer Samples  
DS3902 Dual, NV, Variable Resistors with User EEPROM Samples  
DS3903 Triple 128-Position Nonvolatile Digital Potentiometer Samples  
DS3904 Triple, 128-Position, Nonvolatile, Variable, Digital Resistor/Switch Samples  
DS3905 Triple, 128-Position, Nonvolatile, Variable, Digital Resistor/Switch  
DS3906 Triple NV Low Step Size Variable Resistor Plus Memory Samples  
DS3930 Hex Nonvolatile Potentiometer with I/O and Memory Samples  
DS4302 2-Wire, 5-Bit DAC with Three Digital Outputs  
MAX5417 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5418 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5419 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5420 Digitally Programmable Precision Voltage Divider for PGAs Samples  
MAX5421 Digitally Programmable Precision Voltage Divider for PGAs Samples  
MAX5426 Precision Resistor Network for Programmable Instrumentation Amplifiers Samples  
MAX5427 32-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  
MAX5428 32-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  
MAX5429 32-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  
MAX5430 ±15V Digitally Programmable Precision Voltage-Dividers for PGAs Samples  
MAX5431 ±15V Digitally Programmable Precision Voltage-Dividers for PGAs Samples  
MAX5432 32-Tap, Nonvolatile, I²C, Linear, Digital Potentiometers Samples  
MAX5433 32-Tap, Nonvolatile, I²C, Linear, Digital Potentiometers Samples  
MAX5434 32-Tap, Nonvolatile, I²C, Linear, Digital Potentiometers Samples  
MAX5435 32-Tap, Nonvolatile, I²C, Linear, Digital Potentiometers Samples  
MAX5460 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5461 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5462 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5463 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5464 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5465 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5466 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5467 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5468 32-Tap FleaPoT™, 2-Wire Digital Potentiometers Samples  
MAX5477 Dual, 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5478 Dual, 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5479 Dual, 256-Tap, Nonvolatile, I²C-Interface, Digital Potentiometers Samples  
MAX5527 64-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  
MAX5528 64-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  
MAX5529 64-Tap, One-Time Programmable, Linear-Taper Digital Potentiometers Samples  


Next Steps
EE-Mail Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.
Download Download, PDF Format (67kB)  

© May 15, 2008, Maxim Integrated Products, Inc.
The content on this webpage is protected by copyright laws of the United States and of foreign countries. For requests to copy this content, contact us.

APP 4051: May 15, 2008
APPLICATION NOTE 4051, AN4051, AN 4051, APP4051, Appnote4051, Appnote 4051