In this Instructable we are going to Control two DC Motors using MSP430 Launchpad and L293D Motor Control Chip.
Here we are using a Motor Control Booster Pack (or shield) for MSP430 Launchpad development board to control the DC motors.The board isavailable online for purchase from our website
You can also buy it from our ebay Store.
The Booster Pack also contains a MAX485 Chip for RS485 communicationalong with the L293D chip,In case you decides to remotely operate the Motors.
The Control codes are written in embedded C and is compiled using Code Composer Studio or IAR embedded Workbench for MSP430.
Sourcecodes and Circuit Diagram can be downloaded from the original article here.
Step 1: Hardware Requirement
For Building this Instructable you will require the following stuff
1) MSP430 Launchpad Development Board (MSP-EXP430G2) with 20 pin MSP430G2553
2) MSP430 Motor Control Booster Pack Containing L293D and MAX485 chip.The Booster Pack contains built in Power Regulator and LED's for indicating Motor Control Direction.Tho Board is available online on our ebay Store or Website.
3) DC Brushed Motors, 2 Numbers
4) 9V Battery or Power Supply
5) As usual Wires
6) Since the Board is plugged on to the MSP430 Launchpad and the Booster Pack uses Screw terminals for Power Supply and Motor Control Terminals ,You won't require a Soldering Iron.
Step 2: Motor Control Booster Pack for MSP430 Launchpad
Motor Control Booster Pack is designed to be plugged on the MSP430 Launchpad and provide Motor Control and RS485 communicationcapabilities to your Launchpad.
The Booster Pack uses L293D for Motor Control and MAX485 for RS485 communication
The Booster Pack can be used to provide
Bidirectional control for Two Motors
Unidirectional Control (Start/Stop) Control for up to 4 Motors.
Controlling 4 Relays
The Motor Control Pins are terminated in screw terminals and can be easily attached to your Motor's Terminals.LED's are provided to Visualize the Logic Levels at the control Pins and enable Pins of L293D.
It is possible to remotely operate the Motors on the Booster Pack using RS485 Protocol
The Complete user manual of the Booster Pack is available here
You can also purchase it from ebay.
Step 3: Motor Control using L293D on the Booster Pack
The L293D contains 4 half H bridge drivers that can be combined together for bidirectional control of two Motors.L293D operates on a 5V supply(VCC1,Pin16) and has a separate input for the Motor supply (VCC2,Pin8).
The motors I am using are rated at 12V so i am connecting the VCC2 pin of L293D to 12V input and VCC1 to 5V (supply for the chip L293D).
In the case of Motor Control Booster Pack, just connect the 12V input to Screw terminal P2 (bottom left connector on the green board above),the 5V volt is automatically generated by the on board voltage regulators.
Please ensure that the polarities are correct while connecting 12V to P2.
The above figure shows a simplified block diagram of the L293D chip.
Here the two Orange triangles on the top represent a pair of half H bridge drivers which are combined together to control the Right Motor M1.
The Green triangles at the bottom represents the other two half H bridges (L293D has 4 half H bridge drivers) that are combined together to control Motor M2
More information regarding L293D can be found here
Step 4: Connecting the Motors
As i have already said ,L293D can control either two motors Bidirectionally or 4 Motors unidirectionaly .Here we are going to go for Bidirectional control of two DC brushed Motors.
The motors I am using are old motors scavenged from a Tape Recorder .The internal speed control mechanism of the motor is removed.
On the Booster Pack You can see two pairs of Screw terminals markedMOTOR_L and MOTOR_R which are used for connecting the Motors.
Connect the two terminals of one motor to MOTOR_L screw terminal and the other to MOTOR_R .
Mount your Booster Pack on your MSP430 Launchpad Board.
Provide Power to the MSP430 Booster Pack terminal P2 (Screw terminal at the Top Left ).
Please note that when you are providing power (9 - 16V DC) to the Booster Pack through P2 ,the on board Voltage regulator will create both 5V and 3V ,sothere is no need to provide power separately to the MSP430 Launchpad .
The Logic Levels at 1A,2A and 3A,4A pins can be easily visualized by looking at the LED's A1,A2 and B1,B2 near the L293D chip.
Step 5: Motor Control Circuit
The Port 2 of MSP430G2553 (on Launchpad) is interfaced with L293D motor control chip on the MSP430 Motor Control Booster Pack.
P2.0 is used to enable the 1&2_EN pin of L293D and P2.6 is used to enable the 3&4_EN pin of L293D .
Since by default P2.6 is used for crystal input you have to select port functions in the Port selection register to use P2.6 pin of MSP430.
All the Port 2.0 pins that are used for controlling the L293D chip are also connected to LED's so that you can see the status of all the control pins which makes debugging quite easy.
More details about controlling the DC motors along with code can be found here.
Step 6: Code
The code for controlling the motors using the Booster Pack is written in embedded C and is compiled using IAR embedded workbench for MSP430 and Code Composer Studio from TI.
The zip file containing the code contains two C files one for controlling a single motor (L293D-Single-Motor-Control.c) and other for controlling the two motors simultaneously (L293D-Dual-Motor-Control.c).
Source Codes are available from the original article here.
MSP430 Launchpad Booster Pack for Motor Control and RS485 communication can be purchased online from our ebay store