TamuBot Version 3.0: Parker01

H-Bridge

Introduction:

------------------------------------------------------------------------------------------------------------------------------------------------------


The TAMUbot version 3.0 robot uses motor controller consisting of H-bridges and a micro controller. A single motor controller can control up to two DC motors. The motors are controlled using Pulse Width Modulation (PWM) while it receives commands in the I2C format. (This build of the robot is called the Parker01)

The H-Bridge is called the MD22. It is a dual 50 volt, 5 amp H-Bridge motor controller.

===================================================================================

Parts List:

------------------------------------------------------------------------------------------------------------------------------------------------------

  1. MD22 Dual 50v 5 Amp H bridge motor controller

===================================================================================

Data Sheets and Ordering Information:

------------------------------------------------------------------------------------------------------------------------------------------------------

This part can be bought online at DevanTech


Figure 1: The MD22 Motor Controller with connection labels [1]


 The schematics of the system can be found in the attachments below titles md22sch1.gif and md22sch2.gif

===================================================================================

Features of Component:

------------------------------------------------------------------------------------------------------------------------------------------------------

1. Can drive two independent motors
2. Has several control modes of which I2C is used for Parker01
3. Handles voltages from 5 V to 50 V for motor control
4. 5V at 50mA is needed for control logic
5. Can handle up to 5 Amps of current
6. Physical size: 110mm x 52mm x 25mm
7. Uses a
PIC16F873 micro controller as its primary logic IC to perform I2C Communication

===================================================================================

Working of Component

------------------------------------------------------------------------------------------------------------------------------------------------------

This part of the guide explains the working of the I2C communications of the MD22 motor controller. And the connections required for running the DC Motors
The MD22 consists of 2 H-Bridges and uses a PIC16F873 micro controller. The controller comes with a control program which can be found in the attachment md22.hex.

The I2C communication mode allows the MD22 to interface with the AVR micro-controllers that run a PI controller for navigation purposes. The AVR and PI controller will be
covered in the TAMU Robot Controller section of this guide.
The maximum connection speed that the MD22 can handle over the I2C bus is 200Mhz

------------------------------------------------------------------------------------------------------------------------------------------------------

Connecting the MD22:
  • The 24 volt battery connects to the Motor power and Motor ground connectors in Figure 1.
  • Outputs for the 2 motors are to be attached to the Motor1 and Motor 2 connectors.
  • The control logic needs a 5 volt source connected to it at the Logic 5V and Logic Ground which should come from a source other than the 24 volt battery supplying the motor
  • The SDA and SCL connections are the communications channels that make up the I2C communication are connected to the  TAMU Robot Controller
The MD22 does not have a fuse and can burn due to high currents. A 10A fuse is recommended to be connected in line with the V+ battery terminal

-----------------------------------------------------------------------------------------------------------------------------------------------------

Modes of the MD22

The MD22 can run at multiple modes, in this section we will cover the I2C mode.

Each mode for the the MD22 can be selected with the physical switch (blue) seen in Figure 1. There are 16 different possible modes that this switch can indicate of which all are used.
Eight of the sixteen modes are I2C modes.
The position of the switch is read once at power-up. The mode cannot be changed when the MD22 is on.

Mode Switch 1 Switch 2 Switch 3 Switch 4
I2C Bus - address 0xB0 On On On On
I2C Bus - address 0xB2 Off On On On
I2C Bus - address 0xB4 On Off On On
I2C Bus - address 0xB6 Off Off On On
I2C Bus - address 0xB8 On On Off On
I2C Bus - address 0xBA Off On Off On
I2C Bus - address 0xBC On Off Off On
I2C Bus - address 0xBE Off Off Off On
0v - 2.5v - 5v Analog On On On Off
0v - 2.5v - 5v Analog + Turn Off On On Off
RC Servo On Off On Off
RC Servo + Turn Off Off On Off
 RC Servo, timeout on
            On             On
            Off
            Off
 RC Servo + turn, timeout on 
            Off             On
            Off
            Off
 Analogue turn mode 2             On             Off             Off             Off
 RC Servo, turn mode 2, timeout on             Off             Off             Off             Off
Table 1. Positions of switch indicating different modes.[1]

------------------------------------------------------------------------------------------------------------------------------------------------------

I2C mode:

The MD22 has 8 registers due to the PIC16F873 it relies upon to perform the I2C to PWM conversion. Of these 8 registers only 5 are used.
The registers are numbered 0-7 and are as follows. Details for each used register are given after the table

Register Address

Name

Read/Write

Description

0

Mode

R/W 6 Modes of operation

1

Speed

R/W

 Left motor speed (mode 0,1) or

speed (mode 2,3)

2

Speed2/Turn*

R/W

Right motor speed (mode 0,1) or

turn (mode 2,3)

3

Acceleration

R/W

Acceleration for i2c (mode 0,1)

4

Unused

Read only

Read as zero

5

Unused

Read only

Read as zero

6

Unused

Read only

Read as zero

7

Software Revision

Read only

Software Revision Number

Table 1. Registers of the MD22 [1]

It is important to note that certain features work only with certain modes of the MD22
*Speed2/turn register has dual usage.
The register is used as the speed register for motor 2 in mode 0,1
The register is used as a turn register for the two motors in mode 2,3

------------------------------------------------------------------------------------------------------------------------------------------------------


Mode Register

Mode Register Setting

Corresponding Operation


                      0 (default setting)
 Speed register is read as a literal value
0 = full reverse  128 = full stop  255 = full forward
                       1  Speed register is read as a signed value
-127 = full reverse  0 = full stop  127 = full forward
                       2  Speed register controls both motor speeds
0 = full reverse    128 = full stop   255 = full forward
                       3  Speed register controls both motor speeds but reads speed register as a signed value
-127 = full reverse  0 = full stop  127 = full forward
                4 (introduced in version 9)
 Alternate method of turning. The turn value can now be used to introduce power to the system
0 = full reverse  128 = full stop  255 = full forward
                 5(introduced in version 9)  Alternate method of turning. The turn value can now be used to introduce power to the system. Values are read as signed values
-127 = full reverse  0 = full stop  127 = full forward
Table 3: Operation of the MD22 in different modes
   

------------------------------------------------------------------------------------------------------------------------------------------------------

Speed Register

In mode 0,1 the speed register will set the speed for motor 1
In mode 2,3 the speed register will set the speed for both motor 1 and motor 2

In modes 0 and 2 the speed register is read as a unsigned value
In modes 1 and 3 the speed register is read as a signed value

------------------------------------------------------------------------------------------------------------------------------------------------------

Turn Register

In mode 0,1 this will act exactly like the speed register but for motor 2
In mode 2,3 the value in the turn register is combined with the value in the speed register to steer the robot
    in this mode the speed register is looked up to decide if the direction is reverse or forward 
 
        if the direction is forward
                motor speed1 = speed - turn
                motor speed2 = speed + turn

        else the direction is reverse so
                motor speed1 = speed + turn
                motor speed2 = speed - turn    [1]

------------------------------------------------------------------------------------------------------------------------------------------------------

Acceleration Register

By default the fastest changes power every 64us
The acceleration register can be used to control the acceleration of the robot if a certain period is to be consumed before reaching the desired speed.
Thus the time taken to reach the new speed is given by

                Time = Acceleration register value*64us*Steps [1]   (Eq.1)

                0=< Acceleration register value >=255
                Steps = |current speed - desired speed|

------------------------------------------------------------------------------------------------------------------------------------------------------



Attachments (3)

  • md22.hex - on Apr 21, 2008 8:03 AM by Pramod Nathan (version 1)
    13k Download
  • md22sch1.gif - on Apr 21, 2008 8:03 AM by Pramod Nathan (version 1)
    16k View Download
  • md22sch2.gif - on Apr 21, 2008 8:03 AM by Pramod Nathan (version 1)
    22k View Download