The following notes are from: Robotic Systems ECE 401RB Fall 2006 Lecture 13: Processors Part 1 Chapter 12, G. McComb, and M. Predko, Robot Builder's Bonanza, Third Edition, Mc- Graw Hill, 2006. I. Introduction Some consider machines to be robots if they are at least remote controlled. But this leaves the intelligence in the hands of the remote controller. These robots may still have sensors. But the sensor information must be sent to the remote controller to make the control decisions. What types of sensors might provide this type of feedback to a remote controller? Touch Vision Chemical Maybe sound But most would say a robot needs to have autonomy. Receive sensor inputs. Process and interpret the sensor inputs. Make decisions. According to some plan or objective. - Carrying out specific, pre-planned actions. Lecture 13, Page 1 of 12
In response to sensor inputs. - Adjusting the plan given sensor inputs. - Responding to unexpected sensor inputs. - Like those that indicate danger to the robot. A computer of one type or another, therefore, needs to be present within a robot. Can consist of a simple assortment of electronic components. Up to an advanced computer. And the computer must be able to interface with all of the other parts of the robot. Sensors Motors Power distribution II. Intelligence from Discrete Components Discrete components can be used by themselves to control a robot. No microprocessor. Using transistors, resistors, etc. Given the knowledge from your lab, how could a light following robot be designed purely from discrete components? Light sensor could be used as a switch. Turn on the motors when the light is in front of the robot. Lecture 13, Page 2 of 12
Light shining on the photodetector turns on the circuit. Which turns on a relay to turn on a motor. - Then the robot moves forward. You can reverse the polarities to make the robot back away when it sees a light. No turning is possible for this simple case. How could the robot be improved to turn to follow the light? Two light sensors. One connected with each motor. The designer is the one providing the intelligence here, not much from the robot. - Although sensing the light is a very simple form of intelligence. Lecture 13, Page 3 of 12
Additional simple circuitry could be added. A 555 timer could be used to create time delays. To turn on for a certain time then stop. To wait a time delay before moving. Etc. The biggest problem with this type of robot is configurability. Hardware changes are required each time the behavior of the robot is to be changed. New wiring. Using breadboards, but breadboards can have loose connections. III. Line Tracing Example This can be accomplished using a few integrated logic circuits and a small assortment of transistors and resistors. Assume some kind of high contrast line is placed on the floor. White on black or black on white does not matter. Use an LED to illuminate below the robot and a phototransistor to sense the reflected light. These two devices paired together in a package are commonly available. Mount detectors on the bottom for the robot. Two detectors set apart roughly twice the width of the line. Lecture 13, Page 4 of 12
Then use a sensor circuit that provides an output if the light is detected. R2 determines the sensitivity of the phototransistor and its voltage range. The output is sent to a comparator circuit. Lecture 13, Page 5 of 12
These are integrated into an overall motor control circuit. And finally, relays control the motors. Lecture 13, Page 6 of 12
Here is the list of parts used for this example. Adjustments The robot may waddle it was down the track. - Overcorrecting for errors each time. This depends on the switching speed of the relays. - Faster-acting relays would create smoother movement. Also, the sensors could be placed a different distance apart. - Closer together or farther apart would make the robot jerk back and forth less? Farther apart would mean longer times between switching. Closer would mean faster switching, but less distance each time. Lecture 13, Page 7 of 12
How would a computer controlled approach help here? It could use the history of the readings to know how quickly to respond. It could respond more gradually over time depending on how much correction is needed. IV. Intelligence from Microcontrollers Here software changes are all that is required Not necessarily hardware changes. Options for computer control Microcontroller Personal Digital Assistant, like a Palm Pilot. Single-board computer Personal computer motherboard or laptop. Microcontrollers are a very good option Low cost Simple power requirements Usually 2.5 V to 5 V. Most can be programmed using software. Create the program on a PC. Then download the program to the microcontroller using a simple hardware interface. The microcontroller operates on its own once disconnected from the PC. Lecture 13, Page 8 of 12
There are literally hundreds of choices of microcontrollers. What do you imagine are the differences between them? Cost (as little as $1.00) Available inputs/outputs. Ease of programming. Programming language. Size Power requirements. People will frequently keep using the same controller. Once they have experience with it and its programming procedures. Microcontrollers do not have large, complicated operating systems. Operation is quite simple. Requires a few configuration commands. Otherwise, software is quite straightforward. The programming module can be costly. Much more costly than the microcontroller itself. There are two forms that a program can take. A regular program, compiled down to machine code as in a normal computer. Referred to as stand-alone microcontrollers. Can usually be programmed in a variety of high-level languages. - Like C, BASIC, Java. Lecture 13, Page 9 of 12
A program which makes use of special instructions available from the microcontroller. May have a series of very complex commands that can be used. This simplifies the work of the person writing the program, since important functions are already created. Referred to as a bootloader-equipped microcontroller. - The bootloader adds the special commands. Programmed in a predetermined high-level language. - For example, the BASIC Stamp 2 uses BASIC. Microcontrollers are available at 8, 16, or 32-bit processors. Most robot applications do not require more than eight bits. Complete Computer System on a Chip A key benefit of microcontrollers is that they combine a microprocessor component with various I/O that are typically needed to interface with the real world. Example configuration of the 8051 microcontroller. - CPU - CPU reset and clocking support circuitry. - Hardware interrupts - Built-in timer or counter. - Programmable full-duplex serial port. - 32 I/O lines Some microcontrollers have greater or fewer I/O lines. Not all have hardware interrupt inputs. Some also have analog-to-digital conversion. Some have voltage comparison. A big plus is the CPU reset and clocking support circuitry. The microcontroller, therefore, only needs a power input and decoupling capacitor. Unlike TTL or CMOS which need clocks. Lecture 13, Page 10 of 12
Program and Data Storage A low-cost microcontroller will only have a few thousand bytes of program storage. This may seem small. But this amount of memory is usually more than adequate. Possibly depending on the programming method. Two options for use of memory One common area for all programs and data storage. - With a single data bus. - Called a Princeton or Von Neumann architecture. - This is common also on standard desktop computers. Lecture 13, Page 11 of 12
Programs stored in one place and data in another. - Two buses are used. - Most modern microcontrollers use this. - Called the Harvard architecture. The difference between the two is not trivial. - The Harvard architecture can run faster, since it can fetch programs and data simultaneously. - The Von Neumann architecture must switch between programs and data. - But the Von Neumann architecture is superior for real-time operating systems. The Harvard architecture will use EEPROM (electronically erasable programmable ROM) for programs and RAM for data. A version of EEPROM used often is Flash. Two data storage specifications will commonly be seen for microcontrollers. Programming will be different for the two different architectures. At the assembler level. Should be no different when using a high-level language. Chip Programming Programming is now much easier than it used to be. Older microcontrollers used PROM and EEPROM that required tools to erase them before a new program could be burned into them. All microcontrollers have programmers. Not people programmers, but software to program the microcontrollers. Range in price from $25 to several thousand dollars. An important consideration is debugging features and capabilities. And how the hardware accomplishes the debugging. Lecture 13, Page 12 of 12