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
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU
![default](https://dbp-cdn.mikroe.com/catalog/mcus/resources/ATmega328P.jpeg)
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ 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
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
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