Module 3
Up ] Overview ] Prologue ] Objectives ] Non-Tech Syn ] Tech Syn ] Module 1 ] Module 2 ] [ Module 3 ] Module 4 ] Module 5 ] Module 6 ] Module 7 ] Applications ] Components ] Dealers ]

 

Module#3:SENSORS AND SHAFT ENCODER

In this chapter we look in detail at the obstacle detection system (the sensors) and the distance measurements system (shaft encoders). Our aim was to make the rover detect the obstacles in its path and accordingly change direction. As the aim of the rover is to reach a final destination in terms of X and Y co-ordinates we even had to design a mean to calculate the distance travelled by the rover.

SHAFT ENCODER :

For this we decided to use optical encoders (shaft encoders). The distance the rover travels will be determined by counting the number of revolution of the wheels. One way to count wheel revolutions employs breakbeam sensors. Breakbeam sensors work by detecting interruptions in the light. The photosensor searches for direct light instead of reflected light. When the beam is broken, it is detected by the photosensor, similar to the phototransistor detecting the change in wavelength.

 

To determine wheel revolutions, the wheel must be divided into a known number of segments alternating from transparent to opaque. Each time the beam shines through the wheel, the sensor detects it.

Given the number of times the beam passes through, the wheel revolutions can be calculated using the formula :

D=2*Pi*R*n/N

where D : distance travelled by the rover

Pi : 3.147

R : radius of the wheel

n : number of holes that pass through the shaft encoder

N : total number of holes in the wheel

* In our implementation we bored 60 holes on the circular metal plate attached to the shaft.

Shaft encoders can be used to count the number of times a wheel spins, or in general the number of digital pulses seen by an input. Two types of shaft encoders can be made using sensors: optical encoders which use optical switches whose beam is periodically broken by a slotted wheel, or magnetic encoders which uses hall effect sensors which change state when a magnet on a shaft rotates past. We are using optical encoders.

Shaft encoders are implemented using the input timer capture feature on the 6811. Therefore processing time is only used when a pulse is actually being recorded, and even very fast pulses can be counted. Because digital ports 0 and 1 are the only two input capture channels available for use on the handy board, only two channels of shaft encoding are possible. The encoding software for the handy board keeps a running count of the number of pulses each enabled encoder has seen. The number of counts is set to 0 when a channel is first enabled and when a user resets that channel. Because the counters are only 16-bits wide, they will overflow and the value will appear negative after 32,767 counts have been accumulated without a reset.

Shaft Encoder Files :

As shaft encoders are an optional feature and not part of the standard hardware of the handy board, the library routines which read them are not loaded on start up. In order to load the following routines for use in your programs, load the file "encoders.lis". This file is in the standard library directory so IC will find it by this name.

Shaft Encoder Routines :

The actions of the shaft encoders are commanded and the results are read using the following routines. The argument encoder to each of the routines specifies which shaft encoder the function should affect. This value should be 0 for digital port 0 or one for digital port 1. Arguments out of the range 0 to 1 have no useful effect.

void enable encoder(int encoder) : This routine enables the given encoder to start counting pulses and resets its counter to zero. By default, encoders start in the disabled state and must be enabled before they start counting.

void disable encoder(int encoder) : This routine disables the given encoder and prevents it from counting. Each shaft encoder uses processing time every time it receives a pulse while enabled, so they should be disabled when you no longer need the encoder's data.

void reset encoder(int encoder) : This routine resets the counter of the given encoder to zero. For an enabled encoder, it is more efficient to reset its value than to use enable encoder() to clear it.

int read encoder(int encoder) : This routine returns the number of pulses counted by the given encoder since it was enabled or since the last reset, whichever was more recent.

SENSORS :

As the project was a collision avoidance system we needed sensors to detect the obstacle in front of the rover.

We considered the following sensors:

i) Switch Sensors (Microswitch–style) :

 

As indicated in the diagram, the switch terminals common and normally open should be connected to the sensor plug. This wiring creates a switch sensor that is normally open, or disconnected, except when the switch is pressed. The standard software for reading the state of a switch interprets this logic high value as "not pressed" or false. When the switch is closed, the sensor line is connected to ground, and the software reads a logic low value, which is interpreted as "pressed" or true.

ii) CdS Photocell (or other resistive sensor) :

The photocell sensor wiring also makes use of the on-board 47K resistor that connects the sensor signal line to 5V. When wired from the signal line to ground, the photocell becomes part of a voltage divider circuit as indicated in the schematic below. The output voltage Vout in the circuit is the sensor signal line. Vout varies as the ratio between the two resistances (the fixed 47K resistance and the varying Rphoto resistance). When the photocell resistance is small (as when brightly illuminated), the Vout signal is close to zero volts; when the photocell resistance is large (as in the dark), Vout is close to 0.5 volts, with a continuously varying range between the extremes.

This means that the sensor will report small values when brightly illuminated and large values in the dark.

iii) Infrared Reflective Optosensor :

The infrared reflectance sensor consists of two discrete devices: an infrared LED emitter and an infrared phototransistor receiver. The receiver and emitter are matched, so that the peak sensitivity of the receiver is at the same wavelength of the emissions of the emitter. The emitter LED is powered by the Handy Board’s + 5V supply, with a 330 ohm resistor in series to limit the current through the LED to an appropriate value. The detector transistor is pulled high with the Handy Board’s internal 47K resistor. When increasing amounts of light from the emitter LED is reflected back into the receiver, increasing amounts of current flowing through the receiver transistor and hence the internal 47K resistor. The voltage drop across this resistor results in a lower voltage presented to the Handy Board’s analog input.

iv) Bend Sensors :

The Bend Sensor element is a resistive device that changes its resistance when it is deformed. It consists of a silver layer which when stretched increases the resistance. In relaxed state, its resistance is 50 Kohm, while in stretched state its resistance increases to 300 Kohm.

 

 

v) Ultrasonic Sensors :

Ultrasonic sensors make use of ultrasonic waves and their property of reflection. In an ultrasonic sensor there are two parts, a transmitter and a receiver. The transmitter is an ultrasonic wave generator like magnetostriction oscillator or piezoelectric oscillator. The ultrasonic waves are then transmitted in the surrounding. If an obstacle is present then the ultrasonic waves are reflected back. These waves are then received by a receiver. The time interval between transmission and reception can give the distance of the obstacle, if the velocity of the ultrasonic wave is known. These sensors are extremely costly and hence are not being used in our project.

vi) Microwave Sensors :

These sensors are similar to ultrasonic sensors, but operate at a much higher frequency and hence have a longer range. They have a very high sensitivity and are costly so it was not feasible to use them in our design.

Selection of Sensors :

Now, we had to select the best sensor which would give us good sensitivity and would be moderate in cost. From the sensors discussed above, the microswitch and bend sensor get activated only when the switch is pressed and when the wire gets bent respectively. This would be possible only when the sensors touch the obstacle. As we needed a collision avoidance system, we did not want the sensors to touch the obstacle, so we rejected these two sensors. The ultrasonic and the microwave sensors were rejected due to their high costs though they have excellent sensitivity. The CdS photocell was rejected as it did not have the required sensitivity. Therefore we selected the infra red sensor which had good sensitivity and was slightly costly (Rs 1500 per sensor). The sensor could detect upto a distance of about 6 inches.

Position of Sensors :

We wanted to cover the maximum area in front of the rover by the sensors and at the same time use minimum number of sensors. Therefore we decided to employ three sensors, one in the front and two at the sides. The sensor in the front was kept exactly in the middle of the chassis. The sensors at the sides were placed exactly behind the wheels.

 

The Digital Input Circuit :

 

 The Infra Red Transmitter circuit :

 

 

©1999 IEEE VESIT Student Branch   Hits : Hit Counter

ieevesitanim.gif (6435 bytes)

Webmaster : Saumitra Mohan Das