Read an Excerpt
MSP430-based Robot Applications
A Guide to Developing Embedded Systems
By Dan Harres Elsevier
Copyright © 2013 Elsevier Inc.
All rights reserved.
ISBN: 978-0-12-397296-5
CHAPTER 1
Introduction
Chapter Outline
Expected reader background 1
The parts of a robot 2
Where to get help 4
Tools you will need 5
Components 7
This is a book intended for individuals who are just getting started in electronics and microcontrollers, as well as individuals who have some experience and simply want to learn how to make an exciting robot out of a modified radio-controlled car and a low-power, but powerful, microcontroller. For those with experience, the first several chapters, which are a review of theory, can be skipped. For those just starting out, the best idea is to read the book through.
Expected reader background
To make good use of this material, the reader should have, at a minimum, knowledge of the following:
1. Mathematics up through algebra, preferably trigonometry
2. Some programming experience
3. Some soldering experience
4. A high-school physics course covering basic electromagnetics.
Individuals with this much experience should be able to follow the material in the book and should be able to successfully build the robots detailed in the book, particularly if following closely the example circuits and software. Naturally, additional background, particularly in circuit theory, will be helpful.
Before diving into how to build a robot, it's important to define what we mean by the term. For example, is a radio-controlled (RC) car a robot? What about the mechanical arms that you see pictured in automobile factories, painting car panels or spot welding parts on the car?
For the purposes of this book, we're going to narrow the scope of what people generally mean by the term robot. Here a robot is a mobile device, capable of moving autonomously but, perhaps, augmented with external commands. So an unmodified remote-controlled car that you can buy at the toy store is not a robot, since it can't move autonomously. An automobile factory spot welder, although a robot in a more general context, is not what we're talking about either, since it is mounted in place and is therefore not mobile.
The parts of a robot
The overall functions of a robot can be broken down into roughly four parts:
1. Locomotion
2. Control
3. Power source
4. Platform
Locomotion consists of the motors and wheels. Control consists of the electronics and software for sensing as well as the electronics and software for steering, motor control, etc. The power source is typically just the batteries or other source of energy. And the platform is the frame and other parts needed to hold the whole thing together.
Most books on robot building spend considerable time on the platform (building the frame, attaching motor and wheels, etc.) and on locomotion (sizing the motors, driving the wheels, mounting wheels to axles, etc.).
Now, consider how to build a robot inexpensively. The way robot building is often approached in books on the subject is to choose materials from which to build the frame, then build that frame, choose and purchase motors that are then mounted to this frame, etc., etc. Not only is this a long, drawn-out process, but it's expensive, too. And the resulting robot may be slow-moving and not impressive.
In this book, we'll take a different approach. We can purchase inexpensive, high-performance, already-built platforms, in the form of radio-controlled (RC) cars. These cars are available at lots of stores, they generally sell for around $20 to $30, and they often have rechargeable batteries. Thus, three of the four functions in the above list are already completed by taking this route. By substituting our own electronics (in the form of a microcontroller and associated hardware and software) we can transform this vehicle into a high-performance autonomous robot, capable of operating at high speeds, avoiding objects, tracking lines, etc. The end product is not only cheaper and easier to build, but it's impressive as well.
So that leaves us with just the electronics and associated software to deal with. What are the functions that these electronics will have to perform to make this robot work? They include:
1. Motor drive — this includes the power transistors that route the battery current to the motor.
2. Steering drive — this includes the transistors that transfer the microcontroller's commands to turn left or right.
3. Situational awareness — this is the collection of sensors and the sensor driver and receiver electronics that give the robot information about the environment in which it is operating.
Associated with each of these functions are also microcontroller operations. For example, the motor drive must be able to control not only whether current is being supplied to the motor but how much current is supplied, so that the speed of the robot is properly controlled. The steering drive command must be timed properly by the microcontroller so that, for example, the robot executes a desired 90 degree turn, not a 180 degree turn. For the situational awareness, there is considerable timing, data acquisition, and logic required of the microcontroller.
Along with the microcontroller software associated with each of these functions, there is a need for overall processing, coordination, and scheduling software. This is the software that determines when each of the functions are performed and how often they are repeated. It processes information from the sensors and, based on that information, determines what the next actions are that need to be taken by the motor and steering drives. The block diagram of Figure 1.1 illustrates this interaction between the different hardware and software functions.
The design of these functions is what we'll be looking at in this book. Along the way, you'll learn how bipolar and MOSFET transistors work, what an analog filter does and how to design it, how to design a feedback amplifier and more. In addition, you'll learn about digital electronics. This includes computer logic, computer arithmetic, and computer programming. The digital portion of the book will be centered on a popular and very powerful microcontroller, the Texas Instruments MSP430.
The MSP430 has lots of features that make it a good choice for these projects. For example, it is actually a family of 16-bit microcontrollers that includes hundreds of different variations on the same basic processor. As a result, you can tailor the microcontroller to your application, choosing the types of data acquisition units included, the number of timers, the amount of memory, the number of input/output pins, and much more. The microcontroller is available as an inexpensive ($4.30) evaluation board, called the LaunchPad, that allows you to get started programming immediately.
Where to get help
For those who are just beginning their exploration of electronics, computers, and robots, this book may be a little daunting. Electronics is not an easy subject to master. But, like a lot of things that are difficult, perseverance pays off. It will also pay off to consult others for help. This includes, for the microcontroller:
1. Example programs in this book and from TI
2. The TI publication SLAU144H, "MSP430x2xx Family User's Guide"
3. TI MSP430 Users' Forum
4. TI Application Notes
5. Texas Instruments (TI) microcontroller help desk
For the electronics functions, there is a vast array of books that could help. If you have some formal college-level training in electronics, you're already aware of what books are available. If you're just getting started in electronics, some books that might be of interest to you are:
1. Electrical Engineering 101
2. Other introductory circuit analysis books
3. Schaum's Basic Circuit Analysis outline
As we go through each chapter, additional references will be given for the material in that particular chapter.
The internet is also a great source of information. There is, of course, always the caveat that anyone can post anything on the internet and that what you see in a particular posting may or may not be correct. Nevertheless, the internet is, in general, a great resource. In particular, Wikipedia is a good source of information.
Tools you will need
There are a number of tools that you will absolutely need, all at low cost, and one optional tool that's somewhat expensive. The essential tools are:
1. Diagonal cutters
2. Needle-nose pliers
3. Magnifying glass or loupe or magnifying visor
4. Soldering iron with fine tip
5. Solder
6. Wet sponge
7. Wire stripper
8. Multimeter
9. Electric drill
10. Screwdrivers
11. Wrench
Keep in mind that the components that you will be working with are small and the tools will need to accommodate these small components. So, for example, the diagonal cutters and needle-nose pliers that you use for electrical repair work around the house are not going to be suitable for use in these projects. Likewise, the soldering iron needs to have a fairly small tip and a small-diameter solder (of the order of 0.03" will work best). Figures 1.2 through 1.4 show typical tools for working with the small electronic components in robotic projects. Alongside each tool is shown the larger version of the tool that is intended for home repair and is not appropriate for such small-component work.
There is one other tool that can be extremely useful, and that is the oscilloscope. No other diagnostic tool provides the insight into a circuit's behavior that the oscilloscope provides. Unfortunately, this tool is not cheap. The good news is that the cost of these instruments is coming down. A new, high-quality, two-channel scope can be purchased for less than $500.
Of course, that's still outside most hobbyists' price range. But there are alternatives. If you are a student, you may have access to oscilloscopes in your school's lab. There are also used scopes available, either locally or from market websites such as eBay. Finally, you can probably forego an oscilloscope altogether if you decide to stick strictly to the examples and designs presented in the text, particularly if you build the circuits from the printed circuit boards that are available for this purpose.
Components
Since this book is aimed at an audience with a wide range of electronic construction skills, the use of the larger dual-in-line packages (DIPs) and leaded passive components, rather than the smaller surface-mount technology (SMT) parts, is the goal in all designs. The industry's trend to smaller and smaller parts makes this approach a little challenging but, except in a few instances, it is still feasible and is used throughout the examples in this book.
For comparison purposes, Figure 1.5 shows three 16-pin packages, the dual inline package (DIP), a surface-mount small-outline integrated circuit (SOIC), and a surface-mount thin shrink small outline package (TSSOP).
(Continues...)
Excerpted from MSP430-based Robot Applications by Dan Harres. Copyright © 2013 Elsevier Inc.. Excerpted by permission of Elsevier.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.