Electronic replacement for mechanical potentiometer
A
A
Hardware Overview
How does it work?
DIGI POT 11 Click is based on a double pack of the MAX5387, a dual volatile, low-voltage linear taper digital potentiometer from Analog Devices. This Click board™ provides four digitally controlled potentiometers realized with an end-to-end resistance value of 50kΩ. The potentiometers have 255 fixed resistors in series between appropriate H and L terminals, providing a low 35ppm/ºC end-to-end temperature coefficient. The potentiometer wiper (W) terminals are programmable to access any one of the 256 tap points on the resistor string. This Click board™ communicates with the host MCU using
the standard I2C 2-Wire interface with a maximum clock frequency of 400kHz. The potentiometers are programmable independently of each other. The MAX5387 has a 7-bit slave address with the first five MSBs fixed to 01010. The address pins A0 and A1 of both potentiometers are programmed by the user and determine the value of the last three LSBs of the slave address, which can be selected by positioning onboard SMD jumpers labeled as ADDR SEL, in U1 or U2 part, to an appropriate position marked as 0 or 1. The I2C interface contains a shift register that decodes the command and addresses bytes, routing the data
to the appropriate control registers. Data written to a control register immediately updates the wiper position. In the beginning, wipers A and B always power up in mid-position. This Click board™ can only be operated from a 3.3V logic voltage level. Therefore, the board must perform appropriate logic voltage conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
![DIGI POT 11 Click top side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb23a7-2d48-670a-ae7a-0242ac120005/01-digi-pot-11-click-front.png)
![DIGI POT 11 Click lateral side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb23a8-1d33-6bac-9b51-0242ac120005/02-digi-pot-11-click-side.png)
![DIGI POT 11 Click bottom side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb23a8-f64c-6ce0-bfce-0242ac120005/03-digi-pot-11-click-back.png)
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.
Microcontroller Overview
MCU Card / MCU
![default](https://s3.us-west-2.amazonaws.com/dbp-cdn.mikroe.com/catalog/mcu-cards/resources/1ed98a6e-a061-68d2-acd3-0242ac13000b/mcu-card-13-for-stm32-stm32l4s5zi.png)
Type
8th Generation
Architecture
ARM Cortex-M3
MCU Memory (KB)
512
Silicon Vendor
STMicroelectronics
Pin count
144
RAM (Bytes)
81920
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![DIGI POT 11 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee790bb-1660-603c-93e7-0242ac120009/schematic.webp)
Step by step
Project 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](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed554e-d80f-6694-8cb9-02420a000272/AP-Step1.jpg)
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](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-3c0f-6800-a19f-02420a000272/AP-Step3.jpg)
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](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-d4d0-6b20-a348-02420a000272/AP-Step4.jpg)
Software Support
Library Description
This library contains API for DIGI POT 11 Click driver.
Key functions:
digipot11_set_u1_wiper
This function sets the position of the selected wiper of U1 device by using I2C serial interface.digipot11_set_u2_wiper
This function sets the position of the selected wiper of U2 device by using I2C serial interface.
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 main.c
* @brief DIGI POT 11 Click example
*
* # Description
* This example demonstrates the use of DIGI POT 11 click board by changing
* the wipers position of both U1 and U2 devices.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger.
*
* ## Application Task
* Iterates through the entire wiper range and sets the wipers position of
* both U1 and U2 devices once per second. The current wiper position will
* be displayed on the USB UART.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "digipot11.h"
static digipot11_t digipot11;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
digipot11_cfg_t digipot11_cfg; /**< Click config object. */
/**
* 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.
digipot11_cfg_setup( &digipot11_cfg );
DIGIPOT11_MAP_MIKROBUS( digipot11_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == digipot11_init( &digipot11, &digipot11_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
for ( uint16_t wiper_pos = DIGIPOT11_WIPER_ZERO_SCALE; wiper_pos <= DIGIPOT11_WIPER_FULL_SCALE; wiper_pos += 5 )
{
if ( DIGIPOT11_OK == digipot11_set_u1_wiper ( &digipot11, DIGIPOT11_WIPER_SEL_BOTH, ( uint8_t ) wiper_pos ) )
{
log_printf( &logger, " U1 wipers position: %u\r\n", wiper_pos );
}
if ( DIGIPOT11_OK == digipot11_set_u2_wiper ( &digipot11, DIGIPOT11_WIPER_SEL_BOTH,
( uint8_t ) ( DIGIPOT11_WIPER_FULL_SCALE - wiper_pos ) ) )
{
log_printf( &logger, " U2 wipers position: %u\r\n\n", ( DIGIPOT11_WIPER_FULL_SCALE - wiper_pos ) );
}
Delay_ms( 1000 );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END