30 min

Maximize efficiency in circuit calibration and tuning with AD5231 and STM32F765ZI

Calibration at the speed of light

DIGI POT 3 Click with UNI Clicker

Published Aug 21, 2023

Click board™

DIGI POT 3 Click

Development board

UNI Clicker


NECTO Studio



Replace traditional analog counterparts with our digital potentiometer, ensuring longevity, reliability, and adaptability for evolving applications



Hardware Overview

How does it work?

DIGI POT 3 Click is based on the AD5231, a 1024-position (10bit) digital potentiometer with a non-volatile memory (EEMEM) from Analog Devices. As mentioned, this digital potentiometer has many features, making it a superior choice over classic mechanical potentiometers. It offers solid state reliability, high precision, additional storage of non-volatile (NV) memory cells, and, most importantly - it can be digitally controlled by an MCU via the high-speed SPI interface, with its pins routed to the mikroBUS™. Analog Devices Inc. offers several sub-types of the same IC, but the DIGI POT 3 click uses the one labeled AD5231BRUZ10, meaning it has 10KΩ of resistance between the potentiometer endpoints. One of its distinctive features is to refresh its wiper register (called RDAC in the device datasheet) after the power is on, making it possible to restore the wiper position on power-up, just like the mechanical counterpart. The wiper position register (RDAC) is not automatically written to the EEMEM because this type of memory has a limited number of write cycles, which is the limitation of the technology itself. For this reason, once the position has been established, it can be stored in EEMEM by a command (Command 0x2 - Store RDAC setting to EEMEM). The AD5231 IC is factory pre-programmed to set the wiper at the middle position after the power-on, but this can be overwritten by storing a custom position with the command mentioned above. Besides storing the RDAC register to the EEMEM, it is possible to store 14 more words, each 16 bits long. This EEMEM area can be used for any purpose - lookup tables, data for other components, or system identification information. Writing to EEMEM takes some time, and the AD5231 IC is non-

responsive. This time is about 25ms, and the end of this operation is signaled by the RDY pin of the AD5231 IC, routed to the INT pin of the mikroBUS™ - labeled as the RDY. When the read-to or write from the EEMEM cycle is done, this pin pulses to a LOW logic level. It is otherwise pulled to a HIGH logic level by an onboard pull-up resistor. For the complete list of commands and addresses, please refer to the AD5231 datasheet. However, MikroElektronika provides a library containing functions compatible with the MIKROE compilers, which can be used for simplified DIGI POT 3 Click programming. The library also contains an example application that demonstrates its use. This example application can be used as a reference for custom designs. The Click board™ is equipped with edge screw terminals, which connect the Click board™ to the external electrical circuit. They offer a secure connection to the external electrical circuit. A small print of a potentiometer electrical symbol illustrates how to connect these terminals properly: Inputs labeled as A and B are the endpoints of the digital potentiometer, while W is the wiper. Lastly, the GND symbol connects the circuit's ground where the potentiometer will be used. DIGI POT 3 Click allows using of both unipolar and bipolar signals. The potential across the positive and the negative power supply pins define the boundary conditions for a proper digital potentiometer operation. The internal forward-biased diodes clamp supply signals on the A, B, and W terminals that exceed this range. Since this Click board™ is intended to be used on the mikroBUS™, the power supply voltage of the AD5231 is +3.3V or +5V, selectable by an onboard SMD jumper labeled as VCC SEL. This makes working with the voltage range between 0

and VCC possible. By utilizing additional circuitry, it is also possible to work with the bipolar signals, which can be useful for interfacing the digit to an audio source. Since no negative power supplies are available on the mikroBUS™, the Click board™ uses the MCP6022, a rail-to-rail, 10 MHz onboard operational amplifier from Microchip, to support operation with bipolar signals. It is a non-inverting amplifier with a unity gain - a buffer. Several onboard SMD jumpers are used to route the signal so it passes through the buffer instead of being fed directly to the AD5231 IC. A group of SMD jumpers labeled as SIGNAL POLARITY is used to patch the signal to a proper route: setting all these jumpers to the LEFT position will connect the terminal inputs directly to the AD5231 IC, allowing unipolar signals ranging from 0 to VCC to be connected. Moving all these jumpers to the RIGHT position will route the input signal through the decoupling capacitor and the buffer, allowing bipolar signals to be used and introducing an offset of VCC/2. This allows the signal to swing between VCC/2 and GND for the negative half-cycle and between VCC/2 and VCC for the positive half-cycle. The offset is then removed by a decoupling capacitor at the W terminal. The SMD jumpers should be moved to the LEFT or the RIGHT position, as leaving some of them in the opposite position may render the device unresponsive. The AN pin can be used as an auxiliary wiper output if routing of the wiper back to the mikroBUS™ is required. This pin can be completely disconnected from the mikroBUS™ by moving the appropriate SMD jumper labeled as AN to the RIGHT position. This will not affect the presence of the wiper output on the output terminal.

DIGI POT 3 Click hardware overview image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU



8th Generation


ARM Cortex-M7

MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Wiper Output
SPI Chip Select
SPI Clock
Power supply
Data Ready
Power supply

Take a closer look


DIGI POT 3 Click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
UNI Clicker Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for DIGI POT 3 Click driver.

Key functions:

  • digipot3_store_eemem - This function stores 16-bit data to the desired EEMEM (non volatile) memory location

  • digipot3_send_command - This function executes the desired command

  • digipot3_write_dac - This function writes 10-bit value to DAC register and determines the wiper position

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

 * \file 
 * \brief DigiPot3 Click example
 * # Description
 * This app get value from digital potentiometer and stored to the EEMEM memory.
 * The demo application is composed of two sections :
 * ## Application Init 
 * Initializes device.
 * ## Application Task  
 * Increments the wiper position by 6dB every 2 seconds. When wiper position
 * reaches the desired value (0x0200), then the wiper position be decremented by 6dB every 2 seconds, until position 
 * value reaches the new desired value (0x0002). After that the new position value will be stored to the EEMEM memory,
 * if that value does not already exist in the EEMEM memory.
 * \author MikroE Team
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "digipot3.h"

// ------------------------------------------------------------------ VARIABLES

static digipot3_t digipot3;
static log_t logger;

uint16_t digital_value;
uint16_t eemem_value;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
    log_cfg_t log_cfg;
    digipot3_cfg_t cfg;

     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    digipot3_cfg_setup( &cfg );
    digipot3_init( &digipot3, &cfg );

    Delay_ms( 200 );
    digipot3_read_dac(  &digipot3, &digital_value );
    digipot3_read_eemem( &digipot3, DIGIPOT3_RDAC_EEMEM_LOC, &eemem_value );
    if ( eemem_value != digital_value )
        digipot3_send_command( &digipot3, DIGIPOT3_RESTORE_EEMEM_TO_RDAC_COMM );

    log_printf( &logger, "DIGI POT 3 is initialized \r\n" );
    Delay_ms( 200 );

void application_task ( void )
    while ( digital_value < 0x0200 )
        digipot3_send_command( &digipot3, DIGIPOT3_INCREMENT_RDAC_6DB_COMM );
        digipot3_read_dac( &digipot3, &digital_value );
        log_printf( &logger, "DAC value is: %u \r\n", digital_value );
        Delay_ms( 2000 );

    while ( digital_value > 0x0002 )
        digipot3_send_command( &digipot3, DIGIPOT3_DECREMENT_RDAC_6DB_COMM );
        digipot3_read_dac( &digipot3, &digital_value );
        log_printf( &logger, "DAC value is: %u \r\n", digital_value );
        Delay_ms( 2000 );

    if ( eemem_value != digital_value )
        digipot3_send_command( &digipot3, DIGIPOT3_STORE_RDAC_TO_EEMEM_COMM );
        eemem_value = digital_value;

void main ( void )
    application_init( );

    for ( ; ; )
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support