MSP430 Robot Shield Slave Unit for Motor Control using RS485

Pinterest icon

MSP430G2553 microcontroller controlling 2 DC brushed motors using L293D remotely using MAX485 RS485 chip through RS485 cable

In this section of the tutorial we will learn about the slave unit comprising of MSP430 Launchpad and Robot Shield which controls the the two motors connected to it. The RS485 communication with the PC and Motor control are handled by the Robot Shield board while the control software runs on  the MSP430G2553 controller on the Launchpad board.

The figure below shows the(unconnected) Robot Shield mounted on the Launchpad development board.

MSP430 Motor Controller Shield and RS485 shield

The Software running on the PC will send commands to the MSP430 Launchpad-RobotShield Combo through the RS485 cable using USB2SERIAL board .The figure below shows the block diagram of the connection diagram.

connection diagram for controlling the motors through RS485 network

 

Circuit Diagram of RS485 Section

MAX485 interfaced with MSP430

The RS485 section on the Robot shield board consists of a MAx485 chip,terminal block RS485 connector P4  and two LED's D4 and D3 for displaying the status of the DE and ~RE pins.In Slave Mode the MAX485 is put in receive mode by making both ~RE and DE pins LOW (the LED's D3 and D$ will be off).The jumper P1 is used to connect the RXD and TXD pins of the MSP430 on Launchpad to RO and DI pins of MAX485 chip.P1 is quite useful while trouble shooting the RS485 communication,you can easily check whether the problem is with the RS485 section or with your UART. In case you want to know more about RS485 communication you can check this tutorial.

Circuit Diagram of L293D Motor Control Section

MSP430G2553pins which control L293D chip 

msp430 interfaced with l293d to control two motors remotely via RS485

The motor controller section is built around the popular L293D chip which can control two DC brushed motors accordingly to the commands send from the PC.The Motors connected to the chip are switched at 12V which is given to VCC2 of L293D.In Robot Shield board ,the voltage applied to the P2 Terminal block connector is sourced to VCC2.

A detailed explanation on how to interface MSP430 with L293D along with Code is already covered here.

This tutorial only switches the motors connected to Robot Shield ON and OFF ,If you are interested in controlling their speed using PWM check this tutorial

Please note that the images presented above are edited to highlight only the relevant sections,You can download the complete schematic of the Robot Shield from here.  

Please remember to change the jumper settings of  USB2SERIAL (USB to RS485 Converter) to RS485 mode.

Code 

The code running on the slave unit (MSP430G2553 Launchpad + RobotShield) is written in embedded C and compiled on IAR Embedded Workbench for MSP430.The code configures the MSP430G2553 controller's UART then puts the MAX485 chip in receive mode and goes to sleep .When the PC sends the Control characters ascii 'A','D','Q' etc through the RS485  network.MAX485 decodes the RS485 protocol and sends them to the MSP430 UART.The reception of characters wakes up the controller and a switch statement is used to control the motors connected to it.

The code for the MSP430 is available in the Mainpage along with the PC Master control software.

 

Back to Main Page