Design Idea

Analog voltage controls digital potentiometer

A microcontroller with an internal ADC controls a digital potentiometer via an I2C interface.

Hrishikesh Shinde, Maxim Integrated Products, Dallas, TX; Edited by Charles H Small and Fran Granville -- EDN, 3/20/2008

This Design Idea describes an analog voltage that controls a digital potentiometer through the device’s I2C interface. An ADC in the Microchip PIC12F683 microcontroller converts the analog voltage to the I2C stream that controls the Maxim DS1803 digital potentiometer (Figure 1) and (Reference 1). Of the microcontroller’s six general-purpose I/O pins, two control the SDA (system-data) and SCL (system-clock-line) output signals, one controls an LED, and one accepts the analog input. SDA and SCL connect directly to the digital potentiometer’s SDA and SCL pins with 4.7-kΩ pullup resistors to VDD. By adding or removing jumpers, you can separate the shared VC and VDD and isolate SDA and SCL.

The firmware is in assembly language, which was assembled using Version 7.40 of the MPLab IDE (integrated development environment), which is currently available free from Microchip. The program comprises fewer than 450 bytes in flash memory and 8 bytes in RAM. The program first initializes various configuration bits in the PIC, including the ADC and the internal oscillator. It configures the ADC to accept input from the analog input and sets the conversion clock to use the internal oscillator at 125 kHz.

The firmware runs in a loop, causing the 10-bit ADC to continuously convert the analog-input voltage. When a conversion is complete, the 8 MSBs form a data byte that transmits over the I2C bus, and this I2C-signal stream controls the digital potentiometer. The program controls both potentiometers in this dual device. With a change in firmware, however, you can independently control the potentiometers, using separate analog inputs on the PIC12F683. The program enables you to control the potentiometer by varying a voltage at the GP1 input of the PIC12F683. A change at GP1 causes a corresponding change in the potentiometer’s resistance: ROUT=((Input Voltage)/VCC)×50 kΩ, where the end-to-end resistance of the digital potentiometer is 50 kΩ, the allowable VCC range is 2.7 to 5V, and the input-voltage range is 0 to VCC. You can troubleshoot an application by checking that the device’s address is correct and that the I2C bus is connected. The LED blinks constantly while the ADC is running, but remains on when an I2C error occurs. After you correct the error, the LED resumes its normal function.

You can extend this design approach to other applications for which an analog voltage must control a device with an I2C interface. You can, for example, implement a nonlinear-transfer function, such as gamma correction, using the DS3906 variable resistor, and implement the transfer function in embedded look-up tables (Reference 2). Or, by connecting a thermistor at the input, you can vary the output of an I2C-controlled current DAC in response to changes in the ambient temperature.


References
  1. DS1803 Addressable Dual Digital Potentiometer,” Maxim, July 25, 2007.
  2. DS3906 Triple NV Low Step Size Variable Resistor Plus Memory,” Maxim, Aug 9, 2007.


EDN Resource Center

EDN Featured Vendor

Screaming Circuits

Screaming Circuits is an industry pioneer in the online quick-turn prototype pc board assembly market. Located in Canby, OR, the company offers assembly, prototype, pilot production and short-run production pc boards in as little as 24 hours for short runs. Screaming Circuits is a subsidiary of the Milwaukee Electronics Corporation, which offers full service contract manufacturing.
View More
View All Resources
ADVERTISEMENT

ADVERTISEMENT

Related Content

 

By This Author

There are no additional articles written by this author.


ADVERTISEMENT

Knowledge Center


Events

System Verilog Assertions (SVA) Language and Methodology Training Class
Dates: 12/4/2008 - 12/4/2008
Location: San Jose, CA

BIT Life Sciences' 2nd Annual World Congress of Gene 2008
Dates: 12/5/2008 - 12/7/2008
Location: Guangzhou, China

Transitioning to Lead-Free — Strategies for Implementation an IPC/JEDEC Conference
Dates: 12/8/2008 - 12/10/2008
Location: Dallas, TX

R&D-Product Development Innovation Summit
Dates: 12/9/2008 - 12/11/2008
Location: Norwood, Ma

MUSIC Silicon Valley
Dates: 4/2/2009 - 4/2/2009
Location: Santa Clara, CA

Submit an EventSubmit an Event




Technology Quick Links

EDN Marketplace


©1997-2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites

ADVERTISEMENT
You will be redirected to your destination in few seconds.