brushless23  2.0.0.0
Main Page

Brushless 23 click

Brushless 23 Click is a compact add-on board suitable for controlling BLDC motors with any MCU. This board features the TC78B011FTG, a three-phase sine-wave PWM pre-driver realized with six external MOSFETs to drive sensorless brushless motors from Toshiba Semiconductor. Some of the main features are a built-in closed-loop speed control function with internal non-volatile memory (NVM) for speed profile setting and the ability to set other features such as rotation direction selection, brake, Standby mode, and others. It also has a wide operating voltage range of 11V to 27V with an output current capacity of 5A and several built-in error detection circuits.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2022.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

Example Description

EXAMPLE_DESCRIPTThis example demonstrates the use of the Brushless 23 click board by driving the motor in both directions at different speeds.ION

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;
brushless23_cfg_t brushless23_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
brushless23_cfg_setup( &brushless23_cfg );
BRUSHLESS23_MAP_MIKROBUS( brushless23_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == brushless23_init( &brushless23, &brushless23_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BRUSHLESS23_ERROR == brushless23_default_cfg ( &brushless23 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Controls the motor speed by changing the PWM duty cycle every 500ms.

The duty cycle ranges from 20% to 80%. At the minimal speed, the motor switches direction. Each step will be logged on the USB UART where you can track the program flow.

void application_task ( void )
{
static int8_t duty_cnt = 3;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
brushless23_pwm_set_duty_cycle ( &brushless23, duty );
log_printf( &logger, " Duty cycle: %u%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
float motor_speed_hz = 0;
if ( BRUSHLESS23_OK == brushless23_get_motor_speed ( &brushless23, &motor_speed_hz ) )
{
log_printf( &logger, " Speed: %.1f Hz\r\n", motor_speed_hz );
}
if ( 8 == duty_cnt )
{
duty_inc = -1;
}
else if ( 2 == duty_cnt )
{
duty_inc = 1;
log_printf( &logger, " Switch direction\r\n\n" );
brushless23_switch_direction ( &brushless23 );
}
duty_cnt += duty_inc;
Delay_ms( 500 );
}

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

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.


brushless23_pwm_set_duty_cycle
err_t brushless23_pwm_set_duty_cycle(brushless23_t *ctx, float duty_cycle)
Brushless 23 sets PWM duty cycle.
brushless23_cfg_t
Brushless 23 Click configuration object.
Definition: brushless23.h:231
brushless23_t
Brushless 23 Click context object.
Definition: brushless23.h:205
brushless23_cfg_setup
void brushless23_cfg_setup(brushless23_cfg_t *cfg)
Brushless 23 configuration object setup function.
BRUSHLESS23_OK
@ BRUSHLESS23_OK
Definition: brushless23.h:255
application_task
void application_task(void)
Definition: main.c:66
brushless23_switch_direction
void brushless23_switch_direction(brushless23_t *ctx)
Brushless 23 switch direction function.
brushless23_default_cfg
err_t brushless23_default_cfg(brushless23_t *ctx)
Brushless 23 default configuration function.
BRUSHLESS23_ERROR
@ BRUSHLESS23_ERROR
Definition: brushless23.h:256
BRUSHLESS23_MAP_MIKROBUS
#define BRUSHLESS23_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: brushless23.h:188
application_init
void application_init(void)
Definition: main.c:30
brushless23_get_motor_speed
err_t brushless23_get_motor_speed(brushless23_t *ctx, float *motor_speed_hz)
Brushless 23 get motor speed function.
brushless23_init
err_t brushless23_init(brushless23_t *ctx, brushless23_cfg_t *cfg)
Brushless 23 initialization function.