INTRODUCTION

 

Many mobile robot systems combine a global path-planning module with a local obstacle avoidance module to perform navigation. While the global path planner determines a suitable path based on a map of the environment, the obstacle avoidance algorithm determines a suitable direction of motion based on recent sensor data. Obstacle avoidance is performed locally in order to ensure that real-time constraints are satisfied. A fast update rate of the obstacle avoidance algorithm is required to allow the robot to safely travel at high speeds. Most of the obstacle detection techniques apply equally well to motion in three-dimensional space or on two-dimensional surfaces. The intended application is the control of motion of geometrical models in simulated environments, such as in the production of computer animation. Similarly, they are useful in certain types of simulation studies for engineering applications, such as modeling the flow of machines and people around each other on a factory floor. Some of the techniques are applicable to control of the motion of real physical objects such as robotic vehicles.

It is possible to pre-specify paths around a static environment. A series of control points is specified which describe a splined curve in space. The object is moved along the curve at a scripted rate. For simple, well-defined motion this is probably the most convenient and direct technique. For complex environments (with hundreds or even thousands of objects) and so presumably for correspondingly complex paths, such pre-specification can become quite tedious. And in a situation where the environment is not static, where in fact all of the objects might be in motion themselves, it is simply not practical. In an environment where the obstacles are moving along unpredictable paths (perhaps as the result of a simulation process) the only way to reliably move an object while avoiding collisions is to abandon pre-specification and use an active navigation algorithm "while" the object is in motion .

Obstacle avoidance techniques based on geometrical models presume some ability to deal with the environment as a geometrical model. The world is defined in terms of points in three space and surfaces between them. For an object to move it must determine which obstacles e relevant to its path and determine which way to steer.

•  The steer away from surface ("force field") approach supposes that a force field is emanating from the surface of the obstacle. The flying object is accelerated away from the surface of the obstacle by a force whose strength is inversely related to distance. Often the field can be represented by a single equation and so the steering acceleration can be easily calculated.

•  The steer away from center technique basically considers the obstacle to be a point and says to steer in the direction opposite to that center point of the obstacle. If the center point is to the left of our path, we turn toward the right, if the center point is above our path, we dive down, and so on.

•  The steer along surface ("curb feeler") technique is familiar to anyone who has ever waLked down a darkened hallway, brushing a hand along the wall for guidance. The touch sensors on elevator doors and industrial robots, the whiskers on a cat, and the "curb feelers" on old automobiles are all based on the same concept. As long as nothing is within the range of the "curb feelers," all is well. But if a probe does touch an obstacle the possibility of a collision arises, and corrective action must be taken at once.

•  Steer towards silhouette edge: rather than consider surface orientation or centroid location, the heuristic here is to steer around an obstacle, head toward its nearest silhouette edge. Regardless of the shape compleity of an obstacle, its most significant feature is its silhouette from the point of view of the moving object.

Our project focuses on local obstacle avoidance, and this is implemented based on infrared obstacle detection circuits. The infrared sensor data is fed to a microcontroller (PIC) which in turn controls a servo motor. The servo motor is coupled to the steering mechanism.

 

Schematic Layout

Circuit Description

 

The circuit of this robot can be subdivided into three main parts:

•  A 567 tone decoder IC

•  Current drive for IR LEDs

•  PIC 16F84 Microcontroller

•  Current drive for servo motor

The VCO of the 567 tone decoder is designed to operate at a centre frequency of 20 kHz.

The square wave output of the VCO is to be fed to the transmitting IR LEDs. But as the LM567 does not have enough power to drive two IR LEDs, a current drive circuit has been connected in between the VCO output and the IR LEDs. The current drive circuit basically consists of a power transistor. The power transistor used is BD140. It is a PNP epitaxial silicon transistor which has an h fe value in the range of 50 and has high current rating of 1.5A and a power rating of 12.5W. The radiation from the IR LEDs reflected from the obstacle is detected using the phototransistor. The phototransistor is an open base transistor with the current flow through the transistor decided by the light falling on the base region. The signal detected by the phototransistor is fed back to the phase detector input of the tone decoder LM 567. When the signal is received the PLL gets locked and the low pass filter output of the Tone decoder goes low. At all other times it remains high.

There are three such detector circuits given at the front of the robot, left, middle and right, which detect obstacles in the respective directions. The outputs of these detectors are given as 3-bit logical input to the PIC microcontroller, 16F84. The microcontroller acts as the decision making unit of the robot.

The microcontroller makes decisions based on the inputs from the detectors. When an obstacle is detected on the right side of the Robot, the output of the detector on the right side goes low due to the locking of the PLL. Hence a low signal appears on the input pin of the microcontroller for the right detector. When this happens, the microcontroller issues a pulse width modulated (PWM) signal to the servo mechanism, which turns the servo motor towards left. Similarly, when an obstacle is detected on the left side, the microcontroller makes the servo to turn right by issuing a control signal with a higher pulse width than that of the previous one. By default, when an obstacle appears in front of the robot, the microcontroller makes the servo motor turn left.

The servo motor works on a control signal which is pulse width modulated. For a pulse width of 1.5ms the servo motor is in the middle or 0 0 position. In this condition the robot moves straight. When a higher pulse width signal is given, the servo motor turns right. This happens when an obstacle is detected on the left. The microcontroller issues this control signal. To turn left, a signal with pulse width lower than 1.5ms is to be given to the servo motor.

The current drive of the servo motor consists of a current amplifier configuration using SL100. The control signal from the microcontroller is given to the base of the transistor and the output taken from the emitter. A current drive for a servo motor is necessary because the motor takes high current while it turns. This high current cannot be provided by the microcontroller, which may get damaged due to drawing of excess current from it. So, a current drive is provided for the servo motor.

 

The Servo Motor

 

A servo is a motor that is attached to a position feedback device. The servo motor has internal circuitry that allows it to be commanded to go to a specified position. Servos are active devices, meaning that when commanded to move they will actively hold their position. Thus, if a servo is commanded to the neutral position and an external force is present to push against the servo the servo will actively resist being moved out of that position.

Servo Construction

Servos are constructed from three basic components, a motor, a feedback device, and a control board. In R/C servos the feedback device is typically a potentiometer (variable resistor). The motor, through a series of gears, turns the output shaft and the potentiometer simultaneously. The potentiometer is fed into the servo control circuit and when the control circuit detects that the position is correct, it stops the motor. The servo mechanism subsystems are the motor, the gear train, the potentiometer, the electronics, and the output shaft bearing

Servo Characteristics

The maximum amount of force the servo can exert is the torque rating of the servo. The Futaba S-148 servo (which we have used) is rated at 40 oz/inches. Servos will not hold their position forever though; the position pulse must be repeated to instruct the servo to stay in position.

he maximum amount of time elapsed before the servo will stop holding its position is the command repetition rate . Typical values for the command repetition rate are 20 - 30 ms. When the pulse sent to a servo is less than 1.5 ms, the servo positions and holds its output shaft some number of degrees counterclockwise from the neutral point. When the pulse is wider than 1.5 ms the opposite occurs. The minimal width and the maximum width of pulse that will command the servo to turn to a valid position are functions of each servo. Different brands, and even different servos of the same brand, will have different maximum and minimums. Generally the minimum pulse will be about 1ms wide and the maximum pulse will be 2 ms wide. The extreme positions and the centre position are shown in the following picture.

Another parameter that varies from servo to servo is the slew rate . This is the time it takes for the servo to change from one position to another. The worst case slewing time is when the servo at minimum rotation and it is commanded to go to maximum rotation. This can take several seconds on very high torque servos. Typically it takes less than two seconds. Sometimes this parameter is specified as the Transit Time , or Speed. The Futaba S148 servo has a speed of 0.22 Sec per 60 degree movement.

 

The LM 567 Tone Decoder

 

The LM 567 tone and frequency decoder is a highly stable phase-locked loop with synchronous AM lock detection and power output circuitry. Its primary function is to drive a load whenever a sustained frequency within its detection band is present at the self-biased input. The bandwidth center frequency and output delay are independently determined by means of four external components. It has a wide frequency range (.01Hz to 500 kHz) and also provides a highly stable center frequency. It also features a logic compatible output with 100mA current sinking capability.

The main applications of this IC are touch-tone decoding, carrier current remote controls, ultrasonic controls (remote TV, etc.), communications paging, frequency monitoring and control, wireless intercom, precision oscillator etc. The IC internally has mainly a phase detector, a voltage controlled oscillator (VCO), a low pass filter and an amplifier. The VCO is a free running multivibrator and produces an output square wave and triangular wave at the pins 5 and 6 respectively. The multivibrator operates at a set frequency f o which is called the free running frequency. This is determined by the external resistor and capacitor. The phase detector is a comparator which produces an error signal after comparing its input signal at pin 3 and the output of the VCO. If both the signals are the same then it produces a digital low output at the pin 8. The IC requires a dc supply of 5V and is provided at the pin 4.

The oscillator frequency is determined by the relation * :-

The detector circuit is set to work as a tone decoder. The VCO output (pin 5) is current boosted and fed to the transmitting IR LEDs. The output from the phototransistor is capacitively coupled to pin 3 which forms the inputs to both the phase detectors of the tone decoder. The control signal fed to the PIC is taken from pin 8, which forms the output of the filter.

 

PIC 16F84 Microcontroller

 

The PIC microcontroller forms the brains of the robot. It controls and guides the robot based on the data from the detectors. The following is a brief preview of the PIC16F84.

The PIC16F84 is a low-cost, high-performance, CMOS, fully-static, 8-bit microcontroller. The PIC microcontroller employs an advanced RISC (Reduced Instruction Set Computing) architecture. It has an eight-level deep stack, and multiple internal and external interrupt sources. The separate instruction and data buses of the Harvard architecture allow a 14-bit wide instruction word with a separate 8-bit wide data bus. The two stage instruction pipeline allows all instructions to execute in a single cycle, except for program branches (which require two cycles). A total of 35 instructions (reduced instruction set) are available. Additionally, a large register set is used to achieve a very high performance level. The PIC16F84 has up to 68 bytes of RAM, 64 bytes of Data EEPROM memory, and 13 I/O pins.

PIC16F84 devices contain an 8-bit ALU and working register. The ALU is a general purpose arithmetic unit. It performs arithmetic and Boolean functions between data in the working register and any register file. The ALU is 8-bits wide and capable of addition, subtraction, shift and logical operations. Unless otherwise mentioned, arithmetic operations are two's complement in nature. In two-operand instructions, typically one operand is the working register (W register), and the other operand is a file register or an immediate constant. In single operand instructions, the operand is either the W register or a file register. The W register is an 8-bit working register used for ALU operations. It is not an addressable register .

ROM Instruction Memory:

In the 16F84 instructions are 14 bits wide and stored in EEPROM. There is a maximum of 1024 of these. It is impossible to modify these instructions except through external programming. You can't have self modifying code. When the chip is reset, a program counter is set to zero and instructions are executed from there. The program is retained when power is removed from the chip.

RAM Memory :

Besides the 14 bit program bus there is another 8 bit data bus in the PIC connected to registers, ports, timer etc. There are 80 RAM locations in the 16F84. RAM is where the variables are put. The only way to change these RAM locations is through instructions. The information in RAM disappears when power is removed. The first 12 RAM locations, (00h - 0Bh), have internal registers mapped to them. Changing these locations with instructions changes the corresponding registers. Microchip calls RAM locations 'files' or 'registers' and uses the symbol 'f' when referring to them. The remaining 68 locations can be used for your variables. Microchip calls the first 12 locations special function registers and the remaining 68 general purpose registers.

Banked RAM Memory :

The memory is split into two banks-bank 0 and bank 1. Bank 1 is used to control the actual operation of the PIC. Bank 0 is used to manipulate the data. A 'banking' bit has to be set in the byte at RAM location 3 to reach the se two banks . This location is called STATUS and the bit, (bit 5), is called RP0. If RP0 is zero, bank 0 is in access, if it is 1 bank 1 is available. For user defined variables it doesn't matter which bank is in use because they are mapped to both banks. For some of the first 12 locations it does matter. Seven of the 12 are mapped to both banks but five are not; so location 5 for example has two meanings depending on RP0. If RP0 is clear, (bank 0), location 5 refers to the data on PORT A. IF RP0 is set, (bank 1), location 5 refers to the direction register TRISA that tells which bits of PORTA are inputs and which are outputs.

The TRIS instruction can be used to set the port direction registers and OPTION can be used to set the OPTION register which deals mainly with timer operations. If code is ported to future Microchip processors that don't support these instructions, you will probably want to rewrite the code for some other reason anyway. 

EEPROM Memory:

There is a third type of memory in the 16F84, 64 bytes of electrically reprogrammable memory, (8 bit). This is used to hold values would have to be stored when the power is turned off. There are a couple of difficulties. First, the memory is not directly addressable; it has to be worked indirectly through four of the special function registers. Secondly, it takes a few hundredths of a second to 'burn' the information in so it isn't fast memory like RAM. This memory can also be burned in when the program memory is burned in.

Instructions:

Each PIC16F84 instruction is a 14-bit word divided into an OPCODE which specifies the instruction type and one or more operands which further specify the operation of the instruction. The PIC16F84 instruction set can be summarized as byte-oriented, bit-oriented and literal and control operations. For byte-oriented instructions, ‘ f ' represents a file register designator and ‘ d ' represents a destination designator. The file register designator specifies which file register is to be used by the instruction. The destination designator specifies where the result of the operation is to be placed. If ‘ d ' is zero, the result is placed in the W register. If ‘ d ' is one, the result is placed in the file register specified in the instruction. For bit-oriented instructions, ‘b' represents a bit field designator which selects the number of the bit affected by the operation, while ‘ f ' represents the number of the file in which the bit is located. For literal and control operations, ‘ k ' represents an eight or eleven bit constant or literal value. The instruction set has been included in datasheet section.

Input/Output Ports:

The 16F84 has 13 pins that can be individually configured as either inputs or outputs. They are divided into PORTA, (5 bits), and PORTB, (8 bits). The direction of each bit is determined by the bits in the corresponding direction registers TRISA (Tristate A) and TRISB (Tristate B). A zero means the bit will be an output, a 1 means input.

Certain port pins are also hooked to other functions of the processor. The high 4 bits of PORTB can be used as interrupt pins when they are programmed as inputs. The high bit of PORTA is also used as an external clock input for the counter/timer. Bit 0 of PORTB (RB0/INT) can be used for an external interrupt.

Timing with delay loops

Each instruction takes four clock cycles or 1 microsecond for a 4 MHz crystal unless the program counter has to be changed, (flow control instruction). 2 microseconds are required for program branches. The control signal given to the servo motor is pulse modulated using delay loops. The delay loops are implemented by the following technique: a value is stored inside a register and decremented inside a loop until it becomes zero after which the output is toggled. By changing the contents of the register above said the pulse width of the output signal is varied.

Want to see how the robot looks ??...