Transform your projects with our high-performance stepper motor driver, offering unparalleled precision and ease of integration.
A
A
Hardware Overview
How does it work?
Stepper 21 Click is based on the DRV8825, a stepper motor controller integral circuit from Texas Instruments. By integrating two NMOS H-bridges, current sense, and a STEP/DIR interface, the DRV8825 allows easy interfacing with the controller circuit. The STEP/DIR interface provides a simple method for advancing through the indexer table, with the direction determined by the DIR input pin and the indexer traveling for each rising edge on the STEP input pin. It uses three decay modes of operation, fast, slow, and mixed decay, as a highly configurable current regulation. Additional features are overcurrent protection, thermal shutdown, supply voltage undervoltage lockout, and fault condition indication. The host MCU can control the direction and steps of the stepper driver directly through the DIR and STP pins of the mikroBUS™ socket. As a feature of its own, the Stepper 21 Click comes with a VREF potentiometer to set a reference
voltage for winding current on both A and B bridges. The Stepper 21 Click also uses the PCA9538A, a low-voltage 8-bit I/O port expander from NXP Semiconductors, and its standard 2-Wire interface to communicate with the host MCU and control some of the features of the stepper driver. The PCA9538A provides a flexible set of GPIOs, contains an 8-bit register set, and is necessary for interfacing the DRV8825 control pins to the host MUC over the pins-limited mikroBUS™ socket. Besides the standard 2-Wire interface, the host MCU has access to the expander's reset and interrupt lines over the RST and INT pins of the mikroBUS™ socket. The interrupt output is activated when any input state differs from its corresponding input port register state. The I2C address of the expander can be selected over the ADDR SEL jumper with 0 set by default. The expander can also control other features like Sleep mode, home position indication, decay mode
selection, fault indicator triggered by over-temperature and over-current protection, or allow you to turn the stepper driver on or off. Last but not least, the expander controls micro-step modes combination (Mode 0-2), thus allowing the selection of full, 1/2, 1/4, 1/8, 1/16, and 1/32 steps. The Stepper 21 Click supports an external power supply for the DRV8825, which can be connected to the input terminal labeled as INPUT VM and should be within the range of 8.2V to 45V (2.5A), while the stepper motor coils can be connected to the terminals labeled as B+, B-, A-, and A+. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC 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 for further development.
Features overview
Development board
Flip&Click PIC32MZ 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 comes with an onboard 32-bit PIC32MZ microcontroller, the PIC32MZ2048EFH100 from Microchip, four mikroBUS™ sockets for Click board™ connectivity, two USB connectors, LED indicators, buttons, debugger/programmer connectors, and two headers compatible with Arduino-UNO pinout. Thanks to innovative manufacturing technology,
it allows you to build gadgets with unique functionalities and features quickly. Each part of the Flip&Click PIC32MZ development kit contains the components necessary for the most efficient operation of the same board. In addition, there is the possibility of choosing the Flip&Click PIC32MZ programming method, using the chipKIT bootloader (Arduino-style development environment) or our USB HID bootloader using mikroC, mikroBasic, and mikroPascal for PIC32. This kit includes a clean and regulated power supply block through the USB Type-C (USB-C) connector. All communication
methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, user-configurable buttons, and LED indicators. Flip&Click PIC32MZ development kit allows 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)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
You complete me!
Accessories
The 28BYJ-48 is an adaptable 5VDC stepper motor with a compact design, ideal for various applications. It features four phases, a speed variation ratio of 1/64, and a stride angle of 5.625°/64 steps, allowing precise control. The motor operates at a frequency of 100Hz and has a DC resistance of 50Ω ±7% at 25°C. It boasts an idle in-traction frequency greater than 600Hz and an idle out-traction frequency exceeding 1000Hz, ensuring reliability in different scenarios. With a self-positioning torque and in-traction torque both exceeding 34.3mN.m at 120Hz, the 28BYJ-48 offers robust performance. Its friction torque ranges from 600 to 1200 gf.cm, while the pull-in torque is 300 gf.cm. This motor makes a reliable and efficient choice for your stepper motor needs.
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 Stepper 21 Click driver.
Key functions:
stepper21_set_step_mode
- This function sets the step mode resolution settings.stepper21_set_direction
- This function sets the motor direction by setting the DIR pin logic state.stepper21_drive_motor
- This function drives the motor for the specific number of steps at the selected speed.
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 Stepper 21 Click example
*
* # Description
* This example demonstrates the use of the Stepper 21 click board by driving the
* motor in both directions for a desired number of steps.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Drives the motor clockwise for 200 full steps and then counter-clockiwse for 400 quarter
* steps with 2 seconds delay before changing the direction. All data is being logged on
* the USB UART where you can track the program flow.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "stepper21.h"
static stepper21_t stepper21;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
stepper21_cfg_t stepper21_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.
stepper21_cfg_setup( &stepper21_cfg );
STEPPER21_MAP_MIKROBUS( stepper21_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == stepper21_init( &stepper21, &stepper21_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( STEPPER21_ERROR == stepper21_default_cfg ( &stepper21 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
log_printf ( &logger, " Move 200 full steps clockwise \r\n\n" );
stepper21_set_step_mode ( &stepper21, STEPPER21_MODE_FULL_STEP );
stepper21_set_direction ( &stepper21, STEPPER21_DIR_CW );
stepper21_drive_motor ( &stepper21, 200, STEPPER21_SPEED_FAST );
Delay_ms ( 2000 );
log_printf ( &logger, " Move 400 quarter steps counter-clockwise \r\n\n" );
stepper21_set_step_mode ( &stepper21, STEPPER21_MODE_QUARTER_STEP );
stepper21_set_direction ( &stepper21, STEPPER21_DIR_CCW );
stepper21_drive_motor ( &stepper21, 400, STEPPER21_SPEED_VERY_FAST );
Delay_ms ( 2000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END