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.



Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ 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

Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

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
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @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