Introduction

This is a ultra compact size Dual-H-Bridge dc motor driver (Based on HR8833), which could drive two way 1.5A DC brush motors up to 10V . It has the same footprint as your thumbnail suitable for projects with limited spaces. Both sides of the module are desgined with standard XH2.54 pins, which allows you to plug it on a breadboard or prototype board.

Specifications

Pin-out

Grade name Functional Description
1 VCC Power 3.3V-5V or IO port output high
2 GND Negative power supply
3 IB2 B channel logic input 2
4 IB1 B channel logic input 1
5 IA2 A channel logic input 2
6 IA1 A channel logic input 1
7 VM Motor drive power 3.3V-10V
8 GND Negative power supply
9 MB1 B Output 1
10 MB2 B Output 2
11 MA2 A Output 2
12 MA1 A Output 1

Pin mapping

Tutorial

Ready

Connection Diagram

Arduino Connection

IA1<——>10

IA2<——>12

IB1<——>11

IB2<——>13

Control Method

The IA1 and IA2 input pins control the state of the MA1 and MA2 outputs; similarly, the IB1 and IB2 input pins control the state of the MB1 and MB2 outputs. Below table shows the logic.

Ix1 Ix2 Mx1 Mx2 Function
0 0 Z Z Coast/fast decay
0 1 L H Reverse
1 0 H L Forward
1 1 L L Brake/slow decay

The inputs can also be used for PWM control of the motor speed. When controlling a winding with PWM, when the drive current is interrupted, the inductive nature of the motor requires that the current must continue to flow.This is called recirculation current. To handle this recirculation current, the H-bridge can operate in two different states, fast decay or slow decay. In fast decay mode, the H-bridge is disabled and recirculation current flows through the body diodes; in slow decay, the motor winding is shorted. To PWM using fast decay, the PWM signal is applied to one Ix pin while the other is held low; to use slow decay, one Ix pin is held high.

Ix1 Ix2 Function Description
PWM 0 Forward PWM,fast decay Speed = High duty-cycle
1 PWM Forward PWM,slow decay Speed = Low duty-cycle
0 PWM Reverse PWM,fast decay Speed = High duty-cycle
PWM 1 Reverse PWM,slow decay Speed = Low duty-cycle

Sample code

/*
* @file Motor driver HR8833-Test.ino
* @brief HR8833-Test.ino  Motor control program
*
* control motor positive inversion
*
* @author lei.wu@dfrobot.com
* @version  V1.0
* @date  2016-4-13
*/
const int IA1=10;
const int IA2=12;
const int IB1=11;
const int IB2=13;

void setup() {
     pinMode(IA1, OUTPUT);
     pinMode(IA2, OUTPUT);
     pinMode(IB1, OUTPUT);
     pinMode(IB2, OUTPUT);
}

void loop() {
 MA1_Forward(200);//Motor MA1 forward; PWM speed control
 delay(1000);
 MA2_Backward(200);//Motor MA1 backward; PWM speed control
 delay(1000);
}

void MA1_Forward(int Speed1)  //fast decay; Speed = High duty-cycle
{
     analogWrite(IA1,Speed1);
     digitalWrite(IA2,LOW);
  }

void MA2_Backward(int Speed1)  //slow decay; Speed = Low duty-cycle
{
    int Speed2=255-Speed1;
    analogWrite(IA1,Speed2);
    digitalWrite(IA2,HIGH);
  }

void MB1_Forward(int Speed1)
{
     analogWrite(IB1,Speed1);
     digitalWrite(IB2,LOW);
  }

void MB2_Backward(int Speed1)
{
    int Speed2=255-Speed1;
    analogWrite(IB1,Speed2);
    digitalWrite(IB2,HIGH);
  }

Result

Motor Reversing

Trouble shooting

More question and cool idea, visit DFRobot Forum

More Documents

Schematic

HR8833 Datasheet

SVG file

Github Repository

DFshopping_car1.png Get Thumbnail Sized DC Motor Driver 2x1.5A from DFRobot Store or DFRobot Distributor.

Turn to the Top