10 min

Enhance your projects to unprecedented levels of precision and control with DRV8825 and PIC18F4610

Beyond spin and turn: Redefine motion control with us

Stepper 21 Click with Curiosity HPC

Published Nov 01, 2023

Click board™

Stepper 21 Click

Development board

Curiosity HPC


NECTO Studio



Transform your projects with our high-performance stepper motor driver, offering unparalleled precision and ease of integration.



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.

Stepper 21 Click hardware overview image

Features overview

Development board

Curiosity HPC, standing for Curiosity High Pin Count (HPC) development board, supports 28- and 40-pin 8-bit PIC MCUs specially designed by Microchip for the needs of rapid development of embedded applications. This board has two unique PDIP sockets, surrounded by dual-row expansion headers, allowing connectivity to all pins on the populated PIC MCUs. It also contains a powerful onboard PICkit™ (PKOB), eliminating the need for an external programming/debugging tool, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, a set of indicator LEDs, push button switches and a variable potentiometer. All

these features allow you to combine the strength of Microchip and Mikroe and create custom electronic solutions more efficiently than ever. Each part of the Curiosity HPC development board contains the components necessary for the most efficient operation of the same board. An integrated onboard PICkit™ (PKOB) allows low-voltage programming and in-circuit debugging for all supported devices. When used with the MPLAB® X Integrated Development Environment (IDE, version 3.0 or higher) or MPLAB® Xpress IDE, in-circuit debugging allows users to run, modify, and troubleshoot their custom software and hardware

quickly without the need for additional debugging tools. Besides, it includes a clean and regulated power supply block for the development board via the USB Micro-B connector, alongside all communication methods that mikroBUS™ itself supports. Curiosity HPC development board allows you to create a new application in just a few steps. Natively supported by Microchip software tools, it covers many aspects of prototyping thanks to many number of different Click boards™ (over a thousand boards), the number of which is growing daily.

Curiosity HPC double image

Microcontroller Overview

MCU Card / MCU




MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


You complete me!


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, while the pull-in torque is 300 This motor makes a reliable and efficient choice for your stepper motor needs.

Stepper 21 Click accessories image

Used MCU Pins

mikroBUS™ mapper

Stepper Direction
Power Supply
Stepper Indexer
I2C Clock
I2C Data
Power Supply

Take a closer look


Stepper 21 Click Schematic schematic

Step by step

Project assembly

Curiosity HPC front no-mcu image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity HPC as your development board.

Curiosity HPC front no-mcu image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity HPC Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware 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

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

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

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

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 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

Additional Support