Brushless DC (BLDC) motor control solution based on a sensorless Field Oriented Control (FOC) integrated FET motor driver
A
A
Hardware Overview
How does it work?
Brushless 33 Click is based on the MCF8316A, a sensorless Field Oriented Control (FOC) integrated FET brushless DC (BLDC) driver from Texas Instruments, designed for BLDC motor control applications. This three-phase motor driver incorporates a code-free sensorless FOC algorithm, making it an ideal solution for controlling speed-regulated 12V to 24V BLDC or Permanent Magnet Synchronous Motors (PMSM) with a peak current of up to 8A. The MCF8316A integrates three half-bridges with an exceptionally low RDS(ON) value of 95mΩ (combined high-side and low-side), ensuring minimal energy loss and maximum efficiency during operation. Furthermore, the device allows for standalone functionality by storing algorithm configurations in its non-volatile EEPROM, enabling consistent and reliable motor control without additional external coding or adjustments once configured. Based on its broad range of features, the Brushless 33 Click is well-suited for numerous applications, including residential and living fans, air purifiers, humidifier fans, automotive fans, blowers, and medical CPAP blowers. The MCF8316A includes protection features to safeguard the device, motor, and overall system from potential faults. These integrated protections ensure robust performance and long-term reliability across diverse operating conditions. With its sensorless FOC algorithm, the MCF8316A offers smooth motor speed control, even in
applications requiring quiet and efficient operation. The Brushless 33 Click operates from an external power supply connected to the VM terminal, with a recommended operating range of 4.5V to 35V. Its output terminals, A, B, and C, can deliver a peak drive current of up to 8A, ensuring operation for spinning a three-phase sensorless Brushless DC (BLDC) motor. The A2212/13T 1000KV BLDC motor is one of our recommendations for optimal performance. In addition to the motor connection terminals, the board includes three dedicated hooks that serve as test points for the three phases of the BLDC motor, allowing for convenient monitoring and diagnostics during operation. This Click board™ is controlled by the host MCU using several pins and their corresponding logic states. The SPD pin allows for motor speed control through PWM by varying the duty cycle of the input signal, while speed can also be adjusted using frequency or an analog input on the SPD pin or configured via the I2C configuration register. The BRK pin brakes the motor when set to a HIGH logic state and enables normal operation when set to LOW. The DIR pin determines the direction of motor rotation, with a LOW state resulting in an A-C-B driving sequence and a HIGH state corresponding to an A-B-C sequence. Additionally, the FLT pin signals when a fault condition occurs in the MCF8316A. To provide visual feedback, several LED indicators reflect the state of key signals: a
green LED for SPEED, a yellow LED for BRAKE, and a red LED for FAULT, ensuring quick and intuitive monitoring of the system's operation. The MCF8316A includes the mentioned I2C interface, which allows an external host MCU to configure its various settings and access fault diagnostic information. The board also features a DRVOFF switch that enables or disables the internal gate drivers; in position 0, the MCF8316A is disabled, while in position 1, it is enabled for operation. Additionally, the board includes unpopulated pins offering extended functionality. The FG pin outputs pulses proportional to the motor's speed, providing a convenient way to monitor rotational speed. The SOX pin outputs the signal from one of the current sense amplifiers, offering precise current measurement capabilities. The EWD and ECK pins are optional inputs for external oscillator and watchdog signals. The ECK pin can provide an external clock reference, while the EWD pin can accept an external watchdog signal, enhancing system reliability and enabling advanced timing control. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Nucleo-64 with STM32F103RB MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin
headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is
provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M3
MCU Memory (KB)
128
Silicon Vendor
STMicroelectronics
Pin count
64
RAM (Bytes)
20480
You complete me!
Accessories
Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
BLDC A2212/13T/1000 KV Brushless DC Motor is a high-performance motor designed for reliable operation. Crafted with high-quality materials, including Japanese NMB ball bearings, Kawasaki stator steel, and oxygen-free pure copper wires, it ensures durability and smooth performance. With a lightweight aluminum CNC-machined case, 930KV high RPM, and patented balance techniques, this motor delivers powerful thrust for an exhilarating flight experience. Its N40UH magnets and silicone wire leads provide excellent high-temperature resistance, making it ideal for demanding applications.

Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
Brushless 33 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Example Description
This example demonstrates the control of an A2212/13T 1000KV motor using the Brushless 33 Click board. The example showcases basic motor operations, including speed adjustments, direction switching, and fault handling. The motor speed is controlled by varying the PWM duty cycle.
Key functions:
brushless33_cfg_setup
- Config Object Initialization function.brushless33_init
- Initialization function.brushless33_default_cfg
- Click Default Configuration function.brushless33_set_duty_cycle
- This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).brushless33_switch_direction
- This function switches the direction of motor rotation by toggling the DIR pin logic state.brushless33_get_fault_pin
- This function returns the fault indication pin logic state.
Application Init
Initializes the logger and configures the Click board.
Application Task
Adjusts the motor's duty cycle to control its speed, alternating between increasing and decreasing duty values. Fault conditions are checked and resolved to maintain stable operation. Additional motor controls, such as switching direction and braking, are triggered based on the duty cycle limits. Each step will be logged on the USB UART where you can track the program flow.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief Brushless 33 Click example
*
* # Description
* This example demonstrates the control of an A2212/13T 1000KV motor using
* the Brushless 33 Click board. The example showcases basic motor operations, including
* speed adjustments, direction switching, and fault handling. The motor speed is
* controlled by varying the PWM duty cycle.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the logger and configures the Click board.
*
* ## Application Task
* Adjusts the motor's duty cycle to control its speed, alternating between increasing
* and decreasing duty values. Fault conditions are checked and resolved to maintain
* stable operation. Additional motor controls, such as switching direction and braking,
* are triggered based on the duty cycle limits. Each step will be logged on the USB UART
* where you can track the program flow.
*
* @note
* The library is configured for an A2212/13T 1000KV motor with a 12V power supply.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "brushless33.h"
static brushless33_t brushless33;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
brushless33_cfg_t brushless33_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.
brushless33_cfg_setup( &brushless33_cfg );
BRUSHLESS33_MAP_MIKROBUS( brushless33_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == brushless33_init( &brushless33, &brushless33_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BRUSHLESS33_ERROR == brushless33_default_cfg ( &brushless33 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
static int8_t duty_cnt = 0;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
uint32_t gate_drv_flt = 0;
uint32_t controller_flt = 0;
if ( !brushless33_get_fault_pin ( &brushless33 ) )
{
if ( BRUSHLESS33_OK == brushless33_read_fault ( &brushless33, &gate_drv_flt, &controller_flt ) )
{
if ( gate_drv_flt )
{
log_printf( &logger, " GATE DRIVER FAULT: 0x%.8LX\r\n", gate_drv_flt );
}
if ( controller_flt )
{
log_printf( &logger, " CONTROLLER FAULT: 0x%.8LX\r\n", controller_flt );
}
}
brushless33_clear_fault ( &brushless33 );
// Motor startup delay
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
brushless33_set_duty_cycle ( &brushless33, duty );
log_printf( &logger, "> Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
if ( ( 1 == duty_cnt ) && ( 1 == duty_inc ) )
{
// Motor startup delay
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
Delay_ms ( 1000 );
duty_cnt += duty_inc;
if ( duty_cnt > 10 )
{
duty_cnt = 9;
duty_inc = -1;
}
else if ( duty_cnt < 0 )
{
duty_cnt = 0;
duty_inc = 1;
log_printf( &logger, " Pull brake\r\n" );
brushless33_pull_brake ( &brushless33 );
Delay_ms ( 1000 );
log_printf( &logger, " Switch direction\r\n" );
brushless33_switch_direction ( &brushless33 );
Delay_ms ( 1000 );
log_printf( &logger, " Release brake\r\n" );
brushless33_release_brake ( &brushless33 );
Delay_ms ( 1000 );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
Additional Support
Resources
Category:Brushless