Robotics: How to Get Started — Part 1
If you’re new to robotics, it’s easy to become frustrated and discouraged because there is so much to learn. The goal of this series of articles is to help you understand your options, organize your choices, and find a path to the successful fulfillment of your goals.
A typical SERVO reader probably has been into hobby robotics for many years, perhaps even decades. If you ask someone with that kind of experience how you can get into robotics, it’s easy for them to forget all the struggles they had when they were trying to build their first robot. One reason for this is that everything seems so much easier now than when they started.
When I first got into robotics, for example, there were no off-the-shelf robotic parts. If I wanted some form of sensor, I had to do hours of research (without the Internet), design my own hardware, find all the parts, build it, test it, etc. It could easily take weeks to get an ultrasonic ranger to work at all — and far longer to ensure reliable operation.
When someone wants an ultrasonic sensor today, their biggest problem might be deciding if they’re going to buy it locally or if they’re willing to wait for it to arrive from China to save a few bucks. Today, most every modular piece of a robot can be purchased. Since a robot can be built by simply assembling the modules, many experienced hobbyists assume that a beginner doesn’t have to know much. However, that just isn’t true.
To begin with, today’s novice is trying to build a far more sophisticated robot than most seasoned hobbyists even dreamed of when they started. With all the prebuilt modules available (sensors, motor drivers, radio links, encoders, etc.), it’s true that there is little need to design any low-level circuitry. However, you still need to know what modules you’ll need, how to interface them together, write all the main software, and link it properly with all the necessary drivers and libraries.
Building a robot today requires knowledge of many disciplines including electronics, mechanics, mathematics, and programming just to name a few. In many ways, this enormous diversity is what makes robotics such an amazing hobby.
Think about all the hardware options available (just look through the ads and new product announcements in an issue of SERVO). A true beginner can easily be overwhelmed just deciding where to start.
What sensors should be used? Are DC or servo motors best? Is a motor driver required? What about the chassis, the computer, and the interfaces? What programming language should be used to control everything? The choices really are endless.
I have a lot of empathy for someone starting out in hobby robotics today because the answer given to most of their questions is often something like this: “Oh that’s easy — just get yourself an ultrasonic sensor and determine where the objects are and turn the robot to avoid them.” An experienced hobbyist can easily forget how much they take for granted because they had the luxury of learning all the advances in technology over a long period of time.
The purpose of this series is to give those that are just starting out a little perspective by providing an overview of the systems and subsystems that are needed to build a robot. It will discuss the need for interfacing the various parts and understanding the software to handle the necessary communication.
Don’t expect this series to answer all your questions. Instead, look for it to help you decide what questions you need to ask and to know where to look for the answers. The real goal is to help you get started while preventing you from becoming so discouraged you want to quit.
Parts of a Robot
What makes up a typical hobby robot? It makes sense that you should probably start with a basic mobile robot (as opposed to one that walks). This means you’ll need motors and wheels and some way to control them. You’ll need some form of chassis or platform on which to mount the motors.
Your robot will need sensors so that it can react to its environment. A computer or microcontroller will be required as it will communicate with the sensors to determine what the robot should do (based on the goals you set for it), and then tell the motors how fast, how long, and in which direction to move.
Figure 1 shows a block diagram of the electronics and mechanical components, all of which are generally mounted on a chassis. Most hobby robots have at least two wheels driven by independent motors. Turning both motors so that the robot will move forward produces a straight line motion. Reversing one of the motors will cause the robot to rotate around its center.
The main computer often needs some circuitry to connect (interface) with the motors because of their higher current requirements. Sometimes the computer board itself will have this interface, but you may need a separate module — especially for larger motors.
There are many options for sensors. The example diagram in Figure 1 shows two types (proximity and ranging). Proximity sensors generally have a very short range; often only a few inches. They detect nearby objects and are used to help prevent imminent collisions. Ranging sensors can measure the distances to more faraway objects, typically out to a few feet or even a few yards.
As your robots get more complicated, it will probably need more sophisticated sensors. Cameras can give your robot vision, accelerometers can assist with balance, compasses and GPS modules can provided support for navigation — and these few examples are only scratching the surface of what is available.
Like motors, sensors generally need some type of interface to communicate with the main computer. Depending on the sensor itself, sometimes the interface is part of the computer (a simple digital I/O port, for example). Some sensors might need an analog port, a USB port, or even specialized circuitry for their interface.
In most cases, special software is required just to acquire the data from the sensors and to control the motors. In some cases, the computer language you’re using might have built-in functions for handling some interface options. However, it’s not unusual to have to create your own.
The functionality of controlling motors or interrogating sensors might seem pretty straightforward at first, but they’re often more complicated than most people expect. Even simple things like how you control a motor’s speed can be challenging because the answer is dependent on what motors you choose, how they are interfaced to the computer, what software you’re using, etc.
It will get even more complicated when you realize you can’t just turn a motor on and off. You need to be able to control its speed and direction. Your robot will move a lot smoother if the speed can be increased and decreased slowly (how would your car feel if you always forced the brake and accelerator pedals to the floor?).
Deciding on an Approach
Perhaps the first thing you need to decide is what approach you want to take. You have four basic choices.
Build Everything Yourself
Your first choice (but probably not the best for most people) is to do everything yourself. You could, for example, build your own motor drivers from discrete transistors. The cost might be very low compared to a prebuilt module, but building your own can take a lot of time and require significant knowledge.
Fully Assembled Robots
At the other end of the spectrum, you could purchase a fully assembled robot. You still need to learn about programming (which really is what hobby robotics is all about), but you won’t have to worry about what sensors to buy, how to interface your motors, etc.
One downside can be that the stock sensors might not be exactly what you would prefer, but that might be outweighed by the ease of getting started. All this means is you should research some of the kits on the market and try to find one that has the capabilities you’re looking for.
Figure 2 shows a Parallax Scribbler S3 available from Parallax. It’s a great example of a fully assembled robot that has several types of sensors suitable for basic experimentation.
It can be programmed with BlocklyProp (a very easy to learn language) and has built-in hardware and software interfaces for the motors and sensors. All this — plus the extensive documentation and tutorials provided by Parallax — makes this robot great for someone new to robotics.
There have been a number of articles in SERVO (including some of my own) on how to program the Scribbler S3 and even how to add additional sensors to it. Having options for expansion certainly minimizes some of the objections often levied at fully assembled robots.
The major reason fully assembled robots can be easier to use is that you don’t have to worry about interfacing motors and sensors, let alone which ones to buy.
Furthermore, since the drivers and library modules needed for controlling motors and communicating with sensors are typically integrated into the main software package used for programming the robot’s activities, you can concentrate more on what you want the robot to do and less on mundane tasks like how to control a motor’s speed or how to convert the signals from an ultrasonic sensor into distance data.
Hiding the details associated with motors and sensors can be advantageous for sure and makes a fully-assembled robot a good place to start. However, it can also prevent you from having a full understanding of how your robot works internally.
Modular Robot Kits
If you want a deeper knowledge of how a robot works (not just how to program it to accomplish various goals), then consider a robot kit rather than a fully assembled unit. Figure 3 shows a Boe-Bot from Parallax.com and Figure 4 shows a 3pi from Pololu.com.
Both robots require some assembly which lets you learn more about a robot’s internal operation. The Boe-Bot even has a solderless breadboard for building and experimenting with a variety of interesting circuits.
When you buy a kit, make sure you purchase something that can be programmed with a language that interests you. The 3pi, for example, is programmed in a variation of the C language which is powerful, but somewhat cryptic if you are new to it. Parallax offers several variations of the Boe-Bot (including one called the ActivityBot) that use different microcontrollers with several programming options.
As you feel more comfortable with robotics, you can take the kit approach to a whole new level by purchasing various modules (from the same or different companies) and assembling a custom robot made from a variety of prebuilt parts. For example, you could purchase a microcontroller from one company, a motor assembly from another, and your desired sensors from whoever offers what you need.
This approach will require far more knowledge, of course, but at some point, most people will use this approach to build exactly what they want.
This would imply that your first robotic projects should not be expected to provide you with the robot you’ve always dreamed of. Instead, choose your initial options with the goal of obtaining the skills and knowledge you’ll eventually need to utilize a modular approach.
Magazines like SERVO can be extremely beneficial in your quest for knowledge. And don’t limit your reading to just current issues. Your subscription can provide you access to electronic versions of many back issues.
Reading articles (even those you don’t find particularly exciting or those that might be beyond your skill level) can expand your vocabulary, introduce you to subjects you didn’t even know you needed, and add to your understanding of how all the parts of a robot can work together to create something truly exciting.
As you progress towards your goals, expect (at least initially) to have far more questions than you find answers. Ideally, you might have friends that share your interests. If not, consider joining a local robotics club and if one doesn’t exist, consider starting one.
Also consider books on robotics. You can find many of my writings, for example, by searching Amazon.com for RobotBASIC (a language I helped develop and give away free). If you can’t find the help you need, write me at RobotBASIC@yahoo.com and suggest topics you would like me to consider for future articles.
All the physical parts of a robot are necessary, but the programming is really what defines it. It’s such an important aspect of building a robot that in the next couple of installments of this series, we’ll concentrate on programming.
We’ll start by examining the fundamental aspects of programming and how properly learning one language can make it relatively easy to transition to almost any other language.
From there, we’ll utilize a simulated robot so that you can learn how to program a robot without purchasing any hardware.
The best thing is that programming the simulator will give you many of the insights you need to decide what kinds of things you want your real robot to do — and that will allow you to make far better decisions when you start considering the enormous number of choices that have been discussed in this article. SV