Stepper 19 click
Stepper 19 Click is a compact add-on board for precise control over stepper motors. This board features the DRV8424, a stepper motor driver from Texas Instruments designed to drive both industrial and consumer stepper motors. The DRV8424 has dual N-channel power MOSFET H-bridge drivers, a microstepping indexer, and integrated current sensing, eliminating the need for external power sense resistors. Operating on a 5V to 30V external power supply, the DRV8424 can deliver up to 2.5A of full-scale output current, with an internal PWM current regulation scheme that includes smart tune, slow, and mixed decay options to optimize performance. Ideal for applications in multichannel system monitoring, robotics, precision positioning, and automated manufacturing processes, this Click boardâ„¢ appears as a versatile solution for sophisticated stepper motor control.
click Product page
Click library
- Author : Nenad Filipovic
- Date : Nov 2023.
- Type : I2C type
Software Support
We provide a library for the Stepper 19 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Stepper 19 Click driver.
Standard key functions :
stepper19_cfg_setup
Config Object Initialization function.
void stepper19_cfg_setup(stepper19_cfg_t *cfg)
Stepper 19 configuration object setup function.
Stepper 19 Click configuration object.
Definition stepper19.h:252
stepper19_init
Initialization function.
err_t stepper19_init(stepper19_t *ctx, stepper19_cfg_t *cfg)
Stepper 19 initialization function.
Stepper 19 Click context object.
Definition stepper19.h:225
stepper19_default_cfg
Click Default Configuration function.
err_t stepper19_default_cfg(stepper19_t *ctx)
Stepper 19 default configuration function.
Example key functions :
stepper19_rotate_by_angle
This function rotates the shaft through a desired step speed and angle.
err_t stepper19_rotate_by_angle(stepper19_t *ctx, uint8_t step_speed, float angle, uint16_t res_360)
Stepper 19 rotates the shaft through a desired angle function.
stepper19_rotate_by_step
This function rotates the shaft through for the specific number of steps at the selected speed.
err_t stepper19_rotate_by_step(stepper19_t *ctx, uint8_t step_speed, uint16_t steps)
Stepper 19 rotates the shaft through a desired step function.
stepper19_set_direction
This function sets the desired direction of motor movement: clockwise or counterclockwise.
err_t stepper19_set_direction(stepper19_t *ctx, uint8_t dir)
Stepper 19 sets the direction function.
Example Description
This example demonstrates the use of Stepper 19 Click board by driving the motor in both directions for a desired rotation angle.
The demo application is composed of two sections :
Application Init
The initialization of I2C module and log UART. After driver initialization, the app sets the default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
stepper19_init( &stepper19, &stepper19_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, "-----------------------------\r\n" );
}
#define STEPPER19_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition stepper19.h:209
void application_init(void)
Definition main.c:39
@ STEPPER19_ERROR
Definition stepper19.h:273
Application Task
The application task represents an example that demonstrates the use of the Stepper 19 Click board with which the user can sequentially move the motor. The first part of the sequence executes the clockwise/counterclockwise motor movement for an angle of 90 degrees with a step speed of 50%, all the way to the last sequence of the same movement routine of 360 degree angle with a step speed of 90%. Results are being sent to the UART Terminal, where you can track their changes.
{
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 90 degrees\r\n" );
log_printf( &logger, " Step speed : 50 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
log_printf( &logger, " Counterclockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 180 deg\r\n" );
log_printf( &logger, " Step speed : 50 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 270 deg\r\n" );
log_printf( &logger, " Step speed : 90 %% \r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
log_printf( &logger, " Counterclockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 360 deg\r\n" );
log_printf( &logger, " Step speed : 90 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 360 deg\r\n" );
log_printf( &logger, " Step speed : 90 %% \r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
#define STEPPER19_DIR_CLOCKWISE
Stepper 19 step/direction driver mode.
Definition stepper19.h:101
#define STEPPER19_DIR_COUNTERCLOCKWISE
Definition stepper19.h:102
void application_task(void)
Definition main.c:76
#define STEPPER19_STEP_RES_200
Definition main.c:34
@ STEPPER19_OK
Definition stepper19.h:272
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Stepper19
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.