Intermediate
30 min

Achieve superior performance in every brushed application with TB67H400AFTG and STM32F091RC

Unlock the motor's true capabilities

DC MOTOR 7 Click with Nucleo-64 with STM32F091RC MCU

Published Feb 26, 2024

Click board™

DC MOTOR 7 Click

Dev Board

Nucleo-64 with STM32F091RC MCU

Compiler

NECTO Studio

MCU

STM32F091RC

Seize the opportunity to optimize your motorized system. Employ an alternative mode of this solution to use H-Bridges in parallel, receiving twice as much power!

A

A

Hardware Overview

How does it work?

DC MOTOR 7 Click is based on the TB67H400AFTG, a PWM chopper-type brushed DC motor driver from Toshiba Semiconductor. This IC uses a proprietary BiCD manufacturing process, allowing this IC to be powered by a wide range of supply voltages, from 10V up to 47V. Due to the MOSFETs' very low ON resistance, the TB67H400AFTG can deliver up to 4A of current to the connected load. However, many external parameters affect both the maximum voltage and the current specifications, especially when the connected load is complex, such as the DC motor. This IC offers an alternative mode, where it can use its internal H-Bridges in parallel, offering twice as much power for a single motor. Before attempting to connect a single DC brushed motor, please refer to the datasheet of the TB67H400AFTG for precise connection instructions. DC MOTOR 7 click requires an external power supply for operation. The optimal voltage that should be used is 24V. Although the TB67H400AFTG driver has thermal and overcurrent protection, it is a temporary measure. A short-circuit at the output terminal may damage the Click board™. There are two output terminals used to connect DC motors and a power supply input terminal, where the external PSU can be connected, with respect to the polarity marked on the Click board™ itself (bottom side). Brushed DC motors are typically made with only two conductors to supply the motor with power, so even controlling the direction can be

challenging in some situations. Therefore, a specialized driver circuit is required. The TB67H400AFTG utilizes two sensing resistors (one for each channel) and an internally generated PWM signal to regulate the current through the motor. This results in better efficiency and less heat dissipation and provides control over the motor's torque, direction, and speed. Each motor is driven by the internal H-Bridge, which is controlled by the control logic section of the TB67H400AFTG IC. The motor control logic section regulates the current by opening and closing the specific MOSFETs of the H-Bridge, allowing the current through the coils to rise to a certain point (charging) to circulate between the coils and the driver until a specified point of time reached (slow decay), and then to return the remaining energy to the power supply (fast decay). The whole cycle is timed by pulses of the PWM signal derived from the internal oscillator. The TB67H400AFTG exposes six control pins to the microcontroller (MCU): PWMA, PWMB, INA1, INA2, INB1, and INB2. By changing the logic states on these pins, the MCU can control both connected motors independently. Besides a detailed explanation of the operating modes, the TB67H400AFTG datasheet also provides a truth table that explains the effects of logic states on these pins. Since the TB67H400AFTG IC has six different control pins, an additional port expander IC is required to access all these pins.

The PWMA and PWMB pins are routed to the mikroBUS™ RST and PWM pins, respectively, while the rest of the control pins (INA1, INA2, INB1, and INB2) are accessible via the PCA9538A, an 8-bit I2C port expander by NXP Semiconductors. In addition, the HBMODE pin used to select the single or dual operating mode (Large Mode or Small Mode) and the TBLKAB pin used to set the blanking interval are also available over the PCA9538A IC. Logic states on the PCA9538A pins can be easily set over the I2C interface, allowing to quickly change states on all the control pins of the TB67H400AFTG IC using a single command over the I2C interface. Please note that the state of the HBMODE pin should not be altered once the Click board™ is powered up and initialized. The slave I2C address of the PCA9538A can be changed. Two LSB of the I2C address can be set to 0 or 1 by switching SMD jumpers on the Click board™. This allows four different 7-bit I2C addresses to be selected from 0x70 to 0x73. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the SMD jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the 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.

DC MOTOR 7 Click hardware overview image

Features overview

Development board

Nucleo-64 with STM32F091RC 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.

Nucleo 64 with STM32F091RC MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M0

MCU Memory (KB)

256

Silicon Vendor

STMicroelectronics

Pin count

64

RAM (Bytes)

32768

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.

Click Shield for Nucleo-64 accessories 1 image

DC Gear Motor - 430RPM (3-6V) represents an all-in-one combination of a motor and gearbox, where the addition of gear leads to a reduction of motor speed while increasing the torque output. This gear motor has a spur gearbox, making it a highly reliable solution for applications with lower torque and speed requirements. The most critical parameters for gear motors are speed, torque, and efficiency, which are, in this case, 520RPM with no load and 430RPM at maximum efficiency, alongside a current of 60mA and a torque of 50g.cm. Rated for a 3-6V operational voltage range and clockwise/counterclockwise rotation direction, this motor represents an excellent solution for many functions initially performed by brushed DC motors in robotics, medical equipment, electric door locks, and much more.

DC MOTOR 7 Click accessories image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Motor A Channel Short-Brake Control
PC12
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Motor B Channel Short-Brake Control
PC8
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB8
SCL
I2C Data
PB9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

DC MOTOR 7 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-64 accessories 1 image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo-64 with STM32F091RC MCU as your development board.

Click Shield for Nucleo-64 accessories 1 image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
LTE IoT 5 Click front image hardware assembly
Prog-cut hardware assembly
LTE IoT 5 Click complete accessories setup image hardware assembly
Nucleo-64 with STM32XXX MCU Access MB 1 Mini B Conn - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Clicker 4 for STM32F4 HA MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for DC MOTOR 7 Click driver.

Key functions:

  • dcmotor7_set_port - Functions for set port

  • dcmotor7_go_to_stand_by_mode - Function for setting the motor in stand mode

  • dcmotor7_set_pwm_motor_b - Function for set PWM value for motor B

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 
 * \brief DcMotor7 Click example
 * 
 * # Description
 * This application is a dual brushed DC motor driving.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization driver init, enabled all output port, sets H-Bridge operation mode and Motor Digital tblk
 * 
 * ## Application Task  
 * Set the motor A and the motor B to rotate clockwise and in the Counte clockwise direction, 
 * and between the change of direction, the motor stops the motor.
 * 
 * *note:* 
 * VM input - 10 V (min) to 47 V (max)
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "dcmotor7.h"

// ------------------------------------------------------------------ VARIABLES

static dcmotor7_t dcmotor7;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    dcmotor7_cfg_t cfg;

    //  Click initialization.

    dcmotor7_cfg_setup( &cfg );
    DCMOTOR7_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    dcmotor7_init( &dcmotor7, &cfg );

    dcmotor7_default_cfg( &dcmotor7 );
}

void application_task ( void )
{
    dcmotor7_set_motor( &dcmotor7, DCMOTOR7_MOTOR_A, 0, 1 );
    dcmotor7_set_motor( &dcmotor7, DCMOTOR7_MOTOR_B, 0, 1 );
    Delay_ms( 500 );
    
    dcmotor7_motor_stop( &dcmotor7, DCMOTOR7_MOTOR_A );
    dcmotor7_motor_stop( &dcmotor7, DCMOTOR7_MOTOR_B );
    Delay_ms( 2000 );
    
    dcmotor7_set_motor( &dcmotor7, DCMOTOR7_MOTOR_A, 1, 0 );
    dcmotor7_set_motor( &dcmotor7, DCMOTOR7_MOTOR_B, 1, 0 );
    Delay_ms( 500 );
    
    dcmotor7_motor_stop( &dcmotor7, DCMOTOR7_MOTOR_A );
    dcmotor7_motor_stop( &dcmotor7, DCMOTOR7_MOTOR_B );
    Delay_ms( 2000 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.