30 min

Revolutionize brushed motor control with MAX14870 and PIC18F67K40

Maximize motor torque with ease

DC MOTOR 4 click with UNI Clicker

Published Jul 27, 2023

Click board™

DC MOTOR 4 click

Development board

UNI Clicker


NECTO Studio



Seamlessly combine brushed motor control to deliver unparalleled performance and effortlessly drive motors with impressive voltage capabilities of up to 36 Volts



Hardware Overview

How does it work?

DC Motor 4 Click is based on the MAX14870, a motor driver from Analog Devices capable of driving motors with a supply voltage from 4.5V to 36V. The Click is designed to run on either 3.3V or 5V power supply. DC Motor 4 Click communicates with the target MCU over the following pins on the mikroBUS™ line: PWM, AN, CS, and INT. The J2 jumper onboard the click selects a power supply - either the onboard 5V or the external DC

motor power supply input. DC Motor 4 Click can be used to drive DC motors, controlling the motor's speed and the direction of the rotation, as well to brake and regulate the current. The MAX14870 motor driver offers a small, low-power solution for driving and controlling brushed DC motors and relays with voltages between 4.5V and 36V. Very low driver on-resistance reduces power dissipation. It features a charge-pump-less design

for reduced external components and low supply current. There are two onboard screw terminals - one for connecting the DC motor and the other for connecting an external source if necessary. The DC motor is controlled through the board's PWM, CS, and AN pins.

DC MOTOR 4 click hardware overview image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU



8th Generation



MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


You complete me!


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 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 4 Click accessories image

Used MCU Pins

mikroBUS™ mapper

Rotation Direction
Chip Enable
Power Supply
PWM Control
Fault Indicator
Power Supply

Take a closer look


DC MOTOR 4 click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
UNI Clicker Access MB 1 - 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
Necto image step 7 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

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for DC Motor 4 Click driver.

Key functions:

  • dcmotor4_set_duty_cycle - Generic sets PWM duty cycle

  • dcmotor4_pwm_stop - Stop PWM module

  • dcmotor4_pwm_start - Start PWM module

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 
 * \brief DcMotor4 Click example
 * # Description
 * This library contains API for the DC Motor 4 Click driver.
 * Application change the speed and direction.
 * The demo application is composed of two sections :
 * ## Application Init 
 * Initialization driver enable's - GPIO,
 * set the direction-control of the motor forward movement, PWM initialization,
 * set PWM duty cycle and PWM frequency, enable the motor, start PWM.
 * ## Application Task  
 * This is an example that demonstrates the use of the DC Motor 4 Click board.
 * DC Motor 4 Click communicates with register via PWM interface.
 * It shows moving in the Clockwise direction from slow to fast speed
 * and from fast to slow speed, then rotating Counter Clockwise,
 * Results are being sent to the Usart Terminal where you can track their changes.
 * \author Nikola Peric
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "dcmotor4.h"

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

static dcmotor4_t dcmotor4;
static log_t logger;
uint8_t dcmotor_direction = 1;

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

void application_init ( )
    log_cfg_t log_cfg;
    dcmotor4_cfg_t cfg;

     * 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 ----" );
    Delay_ms( 100 );

    //  Click initialization.

    dcmotor4_cfg_setup( &cfg );
    Delay_ms( 100 );
    dcmotor4_init( &dcmotor4, &cfg );
    dcmotor4_pwm_start( &dcmotor4 );

void application_task ( )
    static int8_t duty_cnt = 1;
    static int8_t duty_inc = 1;
    float duty = duty_cnt / 10.0;

    if ( dcmotor_direction == 1 )
        dcmotor4_run_clockwise ( &dcmotor4 );
        log_printf( &logger, "> CLOCKWISE <\r\n" );
        dcmotor4_run_counter_clockwise ( &dcmotor4 );
        log_printf( &logger, "> COUNTER CLOCKWISE <\r\n" );
    dcmotor4_set_duty_cycle ( &dcmotor4, duty );
    dcmotor4_enable_motor ( &dcmotor4 );
    log_printf( &logger, "> Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
    Delay_ms( 500 );

    if ( 10 == duty_cnt ) 
        duty_inc = -1;
    else if ( 0 == duty_cnt ) 
        duty_inc = 1;
        if ( dcmotor_direction == 1 )
            dcmotor_direction = 0;
            dcmotor_direction = 1;
    duty_cnt += duty_inc;

    dcmotor4_disable_motor ( &dcmotor4 );

void main ( )
    application_init( );

    for ( ; ; )
        application_task( );

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

Additional Support