Ensure smooth and reliable operation for robotics and automation systems
A
A
Hardware Overview
How does it work?
DC Motor 19 Click is based on the TC78H653FTG, a dual H-bridge driver for one or two DC brushed motors or one stepping motor from Toshiba Semiconductor. The integrated MOSFETs, configured with an H-Bridge circuit inside the TC78H653FTG, use DMOS elements with low-on resistance (0.11Ω typical with 5V power supply and activated Large mode). It has a wide operating voltage range with an output current capacity of 4A (DC) and control functions, including motor-related functions (Forward, Reverse, Brake, Stop), current control, and built-in detection circuits for overcurrent, overheat, and low/high voltage. As mentioned in the product description, DC Motor 19 Click communicates with MCU using several GPIO pins. Also, this Click board™ has a Standby pin labeled as SBY routed to the CS pin of the mikroBUS™ socket used to switch to Standby
mode by toggling the pin. When the SBY pin is low, TC78H653FTG stops supplying the power to the logic circuit, with the Standby current significantly reduced because all circuits in the IC are configured with CMOS/DMOS elements, and the current consumption in this mode is 0μA typical. To turn ON the internal MOSFETs of the TC78H653FTG, they need to be switched by the logic level, which is input to the control input pins: IN1, IN2, IN3, and IN4 pins routed to the RST, AN, PWM, and INT pins of the mikroBUS™ socket. Thereby, the Forward/Reverse/Brake/Stop rotation direction mode can be selected according to the state of its input control signals, while the motor operation and current mode can be chosen through onboard switches labeled as MODE and LARGE alongside control signals. With active LARGE mode, IN1 and IN2 pins control this
mode while motor control pins A+ and A- are connected as OUT+ and pins B- and B+ pins are connected as OUT- pins. More information on the Motor Mode Selection can be found in the attached datasheet. The DC Motor 19 supports an external power supply for the TC78H653FTG, which can be connected to the input terminal labeled as VM and should be within the range of 1.8V to 7.5V, while the DC motor coils can be connected to the terminals labeled as B+, B-, A-, and A+. 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. 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.
Features overview
Development board
EasyPIC PRO v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC PRO v8 provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances at any time. Each part of the EasyPIC PRO v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and Ethernet are also included, including the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options (graphical and character-based LCD). EasyPIC PRO v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
![default](https://cdn.mikroe.com/rent-a-product/request-setup/mcu-cards/mcu-card-3-for-pic-pic18f96j65.png)
Type
8th Generation
Architecture
PIC
MCU Memory (KB)
96
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
3808
You complete me!
Accessories
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.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![DC Motor 19 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee790dc-be66-6bac-8b16-0242ac120009/schematic.webp)
Step by step
Project assembly
Track your results in real time
Application Output
After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.
![UART Application Output Step 1](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-40a0-6b58-88de-02420a00029a/UART-AO-Step-1.jpg)
Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.
![UART Application Output Step 2](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-eb29-62fa-ba91-02420a00029a/UART-AO-Step-2.jpg)
In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".
![UART Application Output Step 3](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703b-7543-6fbc-9c69-0242ac120003/UART-AO-Step-3.jpg)
The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
![UART Application Output Step 4](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703c-068c-66a4-a4fc-0242ac120003/UART-AO-Step-4.jpg)
Software Support
Library Description
This library contains API for DC Motor 19 Click driver.
Key functions:
dcmotor19_drive_motor
- This function drives the motor for a certian time specified by time_ms at the desired speed. The motor channel and mode must be previously selected using the dcmotor19_set_channel_mode functiondcmotor19_set_channel_mode
- This function sets the active channel and mode which will be used by the dcmotor19_drive_motor functiondcmotor19_disable_standby_mode
- This function disables the standby mode
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief DC Motor 19 Click Example.
*
* # Description
* This example demonstrates the use of DC Motor 19 click board by driving the motors
* in both direction in the span of 14 seconds.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and enables the click by disabling the standby mode.
*
* ## Application Task
* Drives the motors in the forward direction for 5 seconds, then pulls brake for 2 seconds,
* and after that drives them in the reverse direction for 5 seconds, and finally,
* stops driving for 2 seconds which basically disconnects the motors.
* Each step will be logged on the USB UART where you can track the program flow.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "dcmotor19.h"
static dcmotor19_t dcmotor19; /**< DC Motor 19 Click driver object. */
static log_t logger; /**< Logger object. */
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
dcmotor19_cfg_t dcmotor19_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.
dcmotor19_cfg_setup( &dcmotor19_cfg );
DCMOTOR19_MAP_MIKROBUS( dcmotor19_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == dcmotor19_init( &dcmotor19, &dcmotor19_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
dcmotor19_disable_standby_mode ( &dcmotor19 );
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
log_printf ( &logger, " Driving motors forward...\r\n" );
dcmotor19_set_channel_mode ( &dcmotor19, DCMOTOR19_CHANNEL_1 | DCMOTOR19_CHANNEL_2, DCMOTOR19_MODE_FORWARD );
dcmotor19_drive_motor ( &dcmotor19, DCMOTOR19_SPEED_DEFAULT, 5000 );
log_printf ( &logger, " Pull brake!\r\n" );
dcmotor19_set_channel_mode ( &dcmotor19, DCMOTOR19_CHANNEL_1 | DCMOTOR19_CHANNEL_2, DCMOTOR19_MODE_SHORT_BRAKE );
Delay_ms( 2000 );
log_printf ( &logger, " Driving motors in reverse...\r\n" );
dcmotor19_set_channel_mode ( &dcmotor19, DCMOTOR19_CHANNEL_1 | DCMOTOR19_CHANNEL_2, DCMOTOR19_MODE_REVERSE );
dcmotor19_drive_motor ( &dcmotor19, DCMOTOR19_SPEED_DEFAULT, 5000 );
log_printf ( &logger, " Stop driving!\r\n\n" );
dcmotor19_set_channel_mode ( &dcmotor19, DCMOTOR19_CHANNEL_1 | DCMOTOR19_CHANNEL_2, DCMOTOR19_MODE_STOP );
Delay_ms( 2000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END