How does it work?
DIGI POT 12 Click is based on the AD5142A, a dual-channel, 256-position nonvolatile digital potentiometer from Analog Devices. The resistor wiper position is determined by the RDAC register contents, that act as a scratchpad register, allowing unlimited changes of resistance settings. The scratchpad register can be programmed with any position setting using the standard I2C interface by loading the 16-bit data word. The nominal resistance of the RDAC between terminals A and terminals B (RAB) is 10KΩ with 8-bit RDAC latch data decoded to select one of the 256 possible wiper settings. When a desired position is found, this value can be stored in the onboard EEPROM memory; thus, the wiper position is always restored for subsequent power-ups. The EEPROM data can be read back, written independently, and protected by software.
This Click board™ communicates with MCU through a standard 2-Wire I2C interface and operates at Standard (100KHz) and Fast (400KHz) data transfer modes. The I2C address can be selected via the ADDR SEL jumpers with 0 selected by default. There is an RST pin for resetting the digital potentiometers RDAC registers from EEPROM, with active LOW logic. In addition, this Click board™ comes with the INDEP SEL jumper that allows you to choose between the potentiometer and the linear gain setting mode, with the potentiometer mode set by default (0).
The linear gain setting mode of operation can control the potentiometer as two independent rheostats connected at a single point. Once the jumper is set, it can not be disabled by software. In addition, there is a burst mode in which multiple data bytes can be sent to the host MCU. The Shutdown mode places the RDAC in a zero power consumption while the data in EEPROM remains. There is no polarity constraint between the B, W, and A on both terminals, but they can not be higher than the VCC (5V maximum) nor lower than the VSS (0V).
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Digital potentiometer
Applications
Can be used for the development of mechanical potentiometer replacements, voltage-to-current conversions, gain and offset adjustment, and many other applications
On-board modules
AD5142A – digital potentiometer from Analog Devices
Key Features
Dual-channel, 256-position resolution, 10kΩ nominal resistance, I2C-compatible interface, nonvolatile memory stores wiper settings, 50 years of typical data retention, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on DIGI POT 12 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Power/Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | INDEP SEL | Left | Operating Mode Selection 0/1: Left position 0, Right position 1 |
JP3-JP4 | ADDR SEL | Left | I2C Address Selection 0/1: Left position 0, Right position 1 |
DIGI POT 12 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Nominal Resistance | – | 10 | – | kΩ |
Number of Taps | – | – | 256 | – |
Resolution | 8 | – | – | bits |
Software Support
We provide a library for the DIGI POT 12 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for DIGI POT 12 Click driver.
Key functions
-
digipot12_set_resistance
DIGI POT 12 set the resistance function. -
digipot12_get_resistance
DIGI POT 12 get the resistance function.
Example Description
This library contains API for DIGI POT 12 Click driver. The demo application uses a digital potentiometer to change the resistance values of both channels.
void application_task ( void )
{
static float res_kohm;
for ( uint8_t n_cnt = DIGIPOT12_RES_0_KOHM; n_cnt <= DIGIPOT12_RES_10_KOHM; n_cnt++ )
{
if ( DIGIPOT12_OK == digipot12_set_resistance( &digipot12, DIGIPOT12_WIPER_SEL_1, ( float ) n_cnt ) )
{
if ( DIGIPOT12_OK == digipot12_get_resistance( &digipot12, DIGIPOT12_WIPER_SEL_1, &res_kohm ) )
{
log_printf( &logger, " Rwb1 : %.2f kOhmrn", res_kohm );
Delay_ms( 100 );
}
}
if ( DIGIPOT12_OK == digipot12_set_resistance( &digipot12, DIGIPOT12_WIPER_SEL_2, ( float ) ( DIGIPOT12_RES_10_KOHM - n_cnt ) ) )
{
if ( DIGIPOT12_OK == digipot12_get_resistance( &digipot12, DIGIPOT12_WIPER_SEL_2, &res_kohm ) )
{
log_printf( &logger, " Rwb2 : %.2f kOhmrn", res_kohm );
Delay_ms( 100 );
}
}
log_printf( &logger, " ----------------------------rn" );
Delay_ms( 5000 );
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.DIGIPOT12
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE Software Development Kit, that needs to be downloaded from the LibStock and installed for the compiler you are using to ensure proper operation of mikroSDK compliant Click board™ demo applications.
For more information about mikroSDK, visit the official page.