TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139060 times)
  2. FAT32 Library (71592 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Stepper 15 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.15

mikroSDK Library: 2.0.0.0

Category: Stepper

Downloaded: 258 times

Not followed.

License: MIT license  

Stepper 15 Click is a compact add-on board that contains a bipolar stepper motor driver. This board features the DRV8889A, an automotive stepper driver with integrated current sense and stall detection from Texas Instruments.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Stepper 15 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Stepper 15 Click" changes.

Do you want to report abuse regarding "Stepper 15 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Stepper 15 Click

Stepper 15 Click is a compact add-on board that contains a bipolar stepper motor driver. This board features the DRV8889A, an automotive stepper driver with integrated current sense and stall detection from Texas Instruments.

stepper_15_click.png

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Mar 2021.
  • Type : I2C/SPI type

Software Support

We provide a library for the Stepper15 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 Stepper15 Click driver.

Standard key functions :

  • stepper15_cfg_setup Config Object Initialization function.

    void stepper15_cfg_setup ( stepper15_cfg_t *cfg );
  • stepper15_init Initialization function.

    STEPPER15_RETVAL stepper15_init ( stepper15_t *ctx, stepper15_cfg_t *cfg );
  • stepper15_default_cfg Click Default Configuration function.

    void stepper15_default_cfg ( stepper15_t *ctx );

Example key functions :

  • stepper15_make_one_step Stepper 15 make one step function.

    err_t stepper15_make_one_step ( stepper15_t *ctx, uint8_t step_speed );
  • stepper15_set_direction Stepper 15 set direction function.

    err_t stepper15_set_direction ( stepper15_t *ctx, uint8_t direction );
  • stepper15_step_by_angle Stepper 15 step by angle function.

    err_t stepper15_step_by_angle ( stepper15_t *ctx, uint8_t step_speed, float angle, uint16_t step_360 );

Example Description

This library contains API for the Stepper 15 Click driver. The library contains drivers for work control of the Stepper Motor.

The demo application is composed of two sections :

Application Init

Initializes I2C and SPI driver and set default configuration, enable the device and enable outputs mode.


void application_init ( void ) {
    log_cfg_t log_cfg;              /**< Logger config object. */
    stepper15_cfg_t stepper15_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.

    stepper15_cfg_setup( &stepper15_cfg );
    STEPPER15_MAP_MIKROBUS( stepper15_cfg, MIKROBUS_1 );
    err_t init_flag  = stepper15_init( &stepper15, &stepper15_cfg );
    if ( ( init_flag == I2C_MASTER_ERROR ) || ( init_flag == SPI_MASTER_ERROR ) ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    stepper15_default_cfg ( &stepper15 );
    log_info( &logger, " Application Task " );
    log_printf( &logger, "---------------------------------\r\n" );

    stepper15_set_work_mode( &stepper15, STEPPER15_WORK_MODE_ENABLE_DEVICE );
    Delay_ms ( 100 );
    stepper15_set_output_mode( &stepper15, STEPPER15_OUTPUT_MODE_OUTPUTS_ENABLE );
    Delay_ms ( 100 );

    if ( stepper15_get_fault_condition( &stepper15 ) == STEPPER15_FAULT_CONDITION ) {
        log_printf( &logger, "         Fault condition         \r\n" );   
    } else {
        log_printf( &logger, "        Correct condition        \r\n" );
    }

    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "      Stop the stepper motor     \r\n" );
    stepper15_motor_stop( &stepper15 );
    Delay_ms ( 1000 );
}

Application Task

The application task represents an example that demonstrates the use of the Stepper 15 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 85/100%, all the way to the last sequence of the same movement routine of 360-degree angle with a step speed of 85/100%. Results are sent to the USART Terminal, where you can track their changes.


void application_task ( void ) {
    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "        Clockwise motion         \r\n" );
    log_printf( &logger, " Angle of rotation :  90 degrees \r\n" );
    log_printf( &logger, " Step speed        :  85 %%      \r\n" );
    stepper15_set_direction ( &stepper15, STEPPER15_DIRECTION_CLOCKWISE );
    stepper15_step_by_angle( &stepper15, step_speed - 15, 90, step_360 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "     Counterclockwise motion     \r\n" );
    log_printf( &logger, " Angle of rotation : 180 degrees \r\n" );
    log_printf( &logger, " Step speed        :  85 %%      \r\n" );
    stepper15_set_direction ( &stepper15, STEPPER15_DIRECTION_COUNTERCLOCKWISE );
    stepper15_step_by_angle( &stepper15, step_speed - 15, 180, step_360 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "        Clockwise motion         \r\n" );
    log_printf( &logger, " Angle of rotation : 270 degrees \r\n" );
    log_printf( &logger, " Step speed        :  90 %%      \r\n" );
    stepper15_set_direction ( &stepper15, STEPPER15_DIRECTION_CLOCKWISE );
    stepper15_step_by_angle( &stepper15, step_speed - 10, 270, step_360 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "     Counterclockwise motion     \r\n" );
    log_printf( &logger, " Angle of rotation : 360 degrees \r\n" );
    log_printf( &logger, " Step speed        : 100 %%      \r\n" );
    stepper15_set_direction ( &stepper15, STEPPER15_DIRECTION_COUNTERCLOCKWISE );
    stepper15_step_by_angle( &stepper15, step_speed, 360, step_360 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------------------\r\n" );
    log_printf( &logger, "        Clockwise motion         \r\n" );
    log_printf( &logger, " Angle of rotation : 360 degrees \r\n" );
    log_printf( &logger, " Step speed        : 100 %%      \r\n" );
    stepper15_set_direction ( &stepper15, STEPPER15_DIRECTION_CLOCKWISE );
    stepper15_step_by_angle( &stepper15, step_speed, 360, step_360 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

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

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.


ALSO FROM THIS AUTHOR

ROTARY R Click

0

Rotary Click carries a 15-pulse incremental rotary encoder with detents, surrounded by a ring of 16 red LEDs. It’s a perfect solution for adding a precision input knob to your design. The encoder outputs A and B signals (out of phase to each other); the knob also acts as a push-button which sends an interrupt to the target board MCU. The LED ring is controlled through SPI lines (CS, SCK, MISO, MOSI). Rotary Click can be used with either a 3.3V or 5V power supply.

[Learn More]

Stepper 4 click

0

Stepper 4 click carries a TB67S269FTG - a two-phase bipolar stepping motor driver using a PWM chopper, with a clock in decoder built in. Rating is 50 V/2.0 A. Microstepping resolution is externally manipulated, as well as output current scaling.

[Learn More]

MCP2003B Click library

3

MCP2003B click is a mikroBUS add-on board with a bi-directional LIN transceiver. The click has three onboard screw terminals for connecting the transceiver to a LIN network (three wires: LIN, VBB and GND). MCP2003B click communicates with the target board MCU through the mikroBUS UART interface (RXD, TXD).

[Learn More]