Stepper 7 click
Stepper 7 click is a bipolar step motor driver. It features an H-bridge bipolar step motor driver, which supports full and half step control modes. Stepper 7 click also carries a port expander so that the communication can be done with a minimal number of pins, through the mikroBUS™ SPI bus.
click Product page
Click library
- Author : Stefan Filipovic
- Date : Feb 2024.
- Type : SPI type
Software Support
We provide a library for the Stepper 7 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 7 Click driver.
Standard key functions :
stepper7_cfg_setup
Config Object Initialization function.
void stepper7_cfg_setup(stepper7_cfg_t *cfg)
Stepper 7 configuration object setup function.
Stepper 7 Click configuration object.
Definition stepper7.h:217
stepper7_init
Initialization function.
err_t stepper7_init(stepper7_t *ctx, stepper7_cfg_t *cfg)
Stepper 7 initialization function.
Stepper 7 Click context object.
Definition stepper7.h:198
stepper7_default_cfg
Click Default Configuration function.
err_t stepper7_default_cfg(stepper7_t *ctx)
Stepper 7 default configuration function.
Example key functions :
stepper7_set_direction
This function sets the motor direction to clockwise or counter-clockwise in ctx->direction.
void stepper7_set_direction(stepper7_t *ctx, uint8_t dir)
Stepper 7 set direction function.
stepper7_set_step_mode
This function sets the step mode resolution settings in ctx->step_mode.
void stepper7_set_step_mode(stepper7_t *ctx, uint8_t mode)
Stepper 7 set step mode function.
stepper7_drive_motor
This function drives the motor for the specific number of steps at the selected speed.
err_t stepper7_drive_motor(stepper7_t *ctx, uint32_t steps, uint8_t speed)
Stepper 7 driver motor function.
Example Description
This example demonstrates the use of the Stepper 7 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.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR ==
stepper7_init( &stepper7, &stepper7_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define STEPPER7_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition stepper7.h:183
void application_init(void)
Definition main.c:30
@ STEPPER7_ERROR
Definition stepper7.h:241
Application Task
Drives the motor clockwise for 200 full steps and then counter-clockiwse for 200 half
steps and 800 1/8th steps with 2 seconds delay on driving mode change. All data is being logged on the USB UART where you can track the program flow.
{
log_printf ( &logger, " Move 200 full steps clockwise, speed: slow\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf ( &logger, " Move 200 half steps counter-clockwise, speed: medium\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf ( &logger, " Move 800 1/8th steps counter-clockwise, speed: fast\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define STEPPER7_MODE_FULL_STEP
Stepper 7 step resolution setting.
Definition stepper7.h:135
#define STEPPER7_SPEED_MEDIUM
Definition stepper7.h:145
#define STEPPER7_SPEED_FAST
Definition stepper7.h:146
#define STEPPER7_MODE_HALF_STEP
Definition stepper7.h:136
#define STEPPER7_DIR_CW
Stepper 7 direction setting.
Definition stepper7.h:121
#define STEPPER7_SPEED_SLOW
Definition stepper7.h:144
#define STEPPER7_MODE_1_OVER_8_STEP
Definition stepper7.h:137
#define STEPPER7_DIR_CCW
Definition stepper7.h:122
void application_task(void)
Definition main.c:66
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.Stepper7
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.