Achieve digital control of electrical parameters through this cutting-edge digital potentiometer solution, simplifying system tuning and optimization
A
A
Hardware Overview
How does it work?
DIGI POT Click is based on the MCP4161, an 8-bit single SPI digital POT with non-volatile memory from Microchip. The MCP4161 has a resistance of 10kΩ and low wiper resistance, with a typical 75Ω. It can be used as a three-terminal potentiometer or a two-terminal rheostat while floating either of the terminals (A or B). DIGI POT Click has four screw terminals: PA and PB as analog terminals A and B of the MCP4161, a PW as a wiper terminal of the digital potentiometer, and one for ground. The PA and PB terminals do not have polarity restrictions; PA can be a higher voltage than PB and vice-versa.
The position of the wiper (PB) terminal is controlled by the value in the 8-bit wiper resistance register. There are two functional modes of this Click board™. When all three terminals are used, the MCP4161 generates a voltage divider, where the voltage divider at wiper-to-PA and wiper-to-PB is proportional to the input voltage at PA to PB. It operates in rheostat mode as a variable resistor when only two terminals are used. DIGI POT Click communicates with the host MCU using the 3-Wire SPI serial interface as a write-only. The SCK timing frequency maximum is 10MHz. It features a
WiperLock™ Technology for automatically recalling saved wiper settings from EEPROM. In addition to the SMD MCP4161, this Click board™ features 6 PTHs for the DIP variant of this chip. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this 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.
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
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
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for DIGI POT Click driver.
Key functions:
digipot_set_wiper_positions
- This function sets 8-bit wiper positions datadigipot_convert_output
- This function convert 10-bit ADC value to volatage reference
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 DigiPot Click example
*
* # Description
* The demo application changes the resistance using DIGIPOT Click.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes SPI and LOG modules.
*
* ## Application Task
* This is an example which demonstrates the use of DIGI POT Click board.
* Increments the wiper position by 10 positions every 5 seconds.
*
* @author Stefan Ilic
*
*/
#include "board.h"
#include "log.h"
#include "digipot.h"
static digipot_t digipot;
static log_t logger;
uint8_t wiper_pos;
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
digipot_cfg_t digipot_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.
digipot_cfg_setup( &digipot_cfg );
DIGIPOT_MAP_MIKROBUS( digipot_cfg, MIKROBUS_1 );
err_t init_flag = digipot_init( &digipot, &digipot_cfg );
if ( SPI_MASTER_ERROR == init_flag ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_printf( &logger, "----------------\r\n" );
log_printf( &logger, " DIGI POT Click\r\n" );
log_printf( &logger, "----------------\r\n" );
}
void application_task ( void ) {
for ( uint16_t n_cnt = 127; n_cnt < 255; n_cnt += 10 ) {
wiper_pos = ( uint8_t ) n_cnt;
digipot_set_wiper_positions( &digipot, wiper_pos );
Delay_ms( 5000 );
}
}
void main ( void ) {
application_init( );
for ( ; ; ) {
application_task( );
}
}
// ------------------------------------------------------------------------ END