TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (403 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (132 codes)
  5. Bugz Bensce (97 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 (140957 times)
  2. FAT32 Library (73508 times)
  3. Network Ethernet Library (58321 times)
  4. USB Device Library (48508 times)
  5. Network WiFi Library (44132 times)
  6. FT800 Library (43686 times)
  7. GSM click (30546 times)
  8. mikroSDK (29286 times)
  9. PID Library (27220 times)
  10. microSD click (26931 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

DC Motor 26 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: Brushed

Downloaded: 138 times

Not followed.

License: MIT license  

DC Motor 26 Click is a compact add-on board with a brushed DC motor driver. This board features the TB9053FTG, a PWM-type, dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor. The TB9053FTG is rated for an operating voltage range from 4.5V to 28V, with the motor controlled directly through a PWM signal or SPI serial interface. In addition, this driver allows a dual configuration with two motors with 5A current ratings per channel or one 10A channel drive in a Parallel mode of operation. It also has complete diagnostic and protection capabilities supporting robust and reliable operation.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DC Motor 26 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DC Motor 26 Click" changes.

Do you want to report abuse regarding "DC Motor 26 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


DC Motor 26 Click

DC Motor 26 Click is a compact add-on board with a brushed DC motor driver. This board features the TB9053FTG, a PWM-type, dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor. The TB9053FTG is rated for an operating voltage range from 4.5V to 28V, with the motor controlled directly through a PWM signal or SPI serial interface. In addition, this driver allows a dual configuration with two motors with 5A current ratings per channel or one 10A channel drive in a Parallel mode of operation. It also has complete diagnostic and protection capabilities supporting robust and reliable operation.

dcmotor26_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2023.
  • Type : SPI type

Software Support

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

Standard key functions :

  • dcmotor26_cfg_setup Config Object Initialization function.

    void dcmotor26_cfg_setup ( dcmotor26_cfg_t *cfg );
  • dcmotor26_init Initialization function.

    err_t dcmotor26_init ( dcmotor26_t *ctx, dcmotor26_cfg_t *cfg );
  • dcmotor26_default_cfg Click Default Configuration function.

    err_t dcmotor26_default_cfg ( dcmotor26_t *ctx );

Example key functions :

  • dcmotor26_get_motor_current DC Motor 26 get motor current function.

    err_t dcmotor26_get_motor_current ( dcmotor26_t *ctx, float *current );
  • dcmotor26_set_ch1_operation_mode DC Motor 26 set ch1 operation mode function.

    err_t dcmotor26_set_ch1_operation_mode ( dcmotor26_t *ctx, uint8_t mode );
  • dcmotor26_set_cm_sel_pin DC Motor 26 set cm sel pin function.

    err_t dcmotor26_set_cm_sel_pin ( dcmotor26_t *ctx, uint8_t state );

Example Description

This example demonstrates the use of DC Motor 26 Click board by controlling the speed of DC motor over PWM duty cycle as well as displaying the motor current consumption.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the Click default configuration.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    dcmotor26_cfg_t dcmotor26_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.
    dcmotor26_cfg_setup( &dcmotor26_cfg );
    DCMOTOR26_MAP_MIKROBUS( dcmotor26_cfg, MIKROBUS_1 );
    if ( DCMOTOR26_OK != dcmotor26_init( &dcmotor26, &dcmotor26_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( DCMOTOR26_OK != dcmotor26_default_cfg ( &dcmotor26 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Changes the operation mode and motor speed by setting the PWM duty cycle and then calculates the motor current consumption for that speed. All data is being logged on the USB UART where you can track changes.

void application_task ( void )
{
    if ( DCMOTOR26_OK == dcmotor26_set_ch1_operation_mode ( &dcmotor26, DCMOTOR26_MODE_OUTPUT_OFF ) )
    {
        log_printf ( &logger, " MODE: OFF\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
    if ( DCMOTOR26_OK == dcmotor26_set_ch1_operation_mode ( &dcmotor26, DCMOTOR26_MODE_FORWARD ) )
    {
        dcmotor26_set_cm_sel_pin ( &dcmotor26, DCMOTOR26_PIN_LOW_LEVEL );
        for ( uint16_t duty = 0; duty <= DCMOTOR26_CONFIG56_DUTY_PERIOD_MAX; duty += 100 )
        {
            float current;
            log_printf ( &logger, " MODE: FORWARD\r\n" );
            if ( DCMOTOR26_OK == dcmotor26_set_ch1_duty_period ( &dcmotor26, duty ) )
            {
                log_printf ( &logger, " Duty: %u\r\n", duty );
            }
            if ( DCMOTOR26_OK == dcmotor26_get_motor_current ( &dcmotor26, &current ) )
            {
                log_printf ( &logger, " Current: %.3f A\r\n\n", current );
            }
            Delay_ms ( 500 );
        }
    }
    if ( DCMOTOR26_OK == dcmotor26_set_ch1_operation_mode ( &dcmotor26, DCMOTOR26_MODE_BRAKE ) )
    {
        log_printf ( &logger, " MODE: BRAKE\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
    if ( DCMOTOR26_OK == dcmotor26_set_ch1_operation_mode ( &dcmotor26, DCMOTOR26_MODE_REVERSE ) )
    {
        dcmotor26_set_cm_sel_pin ( &dcmotor26, DCMOTOR26_PIN_HIGH_LEVEL );
        for ( uint16_t duty = 0; duty <= DCMOTOR26_CONFIG56_DUTY_PERIOD_MAX; duty += 100 )
        {
            float current;
            log_printf ( &logger, " MODE: REVERSE\r\n" );
            if ( DCMOTOR26_OK == dcmotor26_set_ch1_duty_period ( &dcmotor26, duty ) )
            {
                log_printf ( &logger, " Duty: %u\r\n", duty );
            }
            if ( DCMOTOR26_OK == dcmotor26_get_motor_current ( &dcmotor26, &current ) )
            {
                log_printf ( &logger, " Current: %.3f A\r\n\n", current );
            }
            Delay_ms ( 500 );
        }
    }
}

Note

The Click board swiches should be set as follows: SW 1-2-3-4 : H-H-L-L This sets the Click board as a SPI controlled single-channel device so the motor should be connected to OUT1/2 and OUT3/4.

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

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

Relay 5 Click

0

Relay 5 Click is a compact add-on board with general-purpose relays that any host MCU can control. This board features three J1031C3VDC.15S, a high-current single-pole double-throw (SPDT) signal relays controlled by the PCA9538A, a low-voltage 8-bit I/O port expander from NXP Semiconductors. Highly sensitive, the J1031C3VDC.15S offers a low coil power consumption in a small, lightweight package with PC pin mounting. It comes with a dimension of 12.5x7.5x10 millimeters (LxWxH) and a 1C contact arrangement with a coil voltage of 3VDC, providing a maximum switching voltage of 125VAC/60VDC.

[Learn More]

Current 5 Click

0

Current 5 Click is a compact add-on board that provides a precise and accurate current sensing solution. This board features the INA381, a high-speed current-sense amplifier with an integrated comparator from Texas Instruments. This device has selectable operating modes (transparent or latched) and detects overcurrent conditions by measuring the voltage developed across a current shunt resistor. Then it compares that voltage to a user-defined threshold limit set by the comparator reference potentiometer. The current-shunt monitor can measure differential voltage signals on common-mode voltages that vary from –0.2V to 26V, independent of the supply voltage. This Click board™ delivers higher performance to applications such as test and measurement, load and power supplies monitoring, low-side phase motor control, and many more.

[Learn More]

Single Wire CAN Click

0

Single Wire CAN Click is a compact add-on board that contains an IC for a single wire data link capable of operating with various protocols such as the Controller Area Network (CAN). This board features the NCV7356D1R2G, Single Wire CAN transceiver from ON Semiconductor, which operates from a supply voltage from 5V to 27V with bus speed up to 40 kbps.

[Learn More]