ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 4182
Скачиваний: 0
SENSORS |
2 |
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
There are a vast number of different sensors being used in robotics, applying different measurement techniques, and using different interfaces to a controller. This, unfortunately, makes sensors a difficult sub-
ject to cover. We will, however, select a number of typical sensor systems and discuss their details in hardware and software. The scope of this chapter is more on interfacing sensors to controllers than on understanding the internal construction of sensors themselves.
What is important is to find the right sensor for a particular application. This involves the right measurement technique, the right size and weight, the right operating temperature range and power consumption, and of course the right price range.
Data transfer from the sensor to the CPU can be either CPU-initiated (polling) or sensor-initiated (via interrupt). In case it is CPU-initiated, the CPU has to keep checking whether the sensor is ready by reading a status line in a loop. This is much more time consuming than the alternative of a sensor-initiated data transfer, which requires the availability of an interrupt line. The sensor signals via an interrupt that data is ready, and the CPU can react immediately to this request.
Sensor Output |
Sample Application |
Binary signal (0 or 1) |
Tactile sensor |
Analog signal (e.g. 0..5V) |
Inclinometer |
Timing signal (e.g. PWM) |
Gyroscope |
Serial link (RS232 or USB) |
GPS module |
Parallel link |
Digital camera |
Table 2.1: Sensor output
1717
2 Sensors
2.1 Sensor Categories
From an engineer’s point of view, it makes sense to classify sensors according to their output signals. This will be important for interfacing them to an embedded system. Table 2.1 shows a summary of typical sensor outputs together with sample applications. However, a different classification is required when looking at the application side (see Table 2.2).
Local |
Global |
|||
Internal |
Passive |
Passive |
– |
|
battery sensor, |
||||
chip-temperature sensor, |
||||
shaft encoders, |
||||
accelerometer, |
||||
gyroscope, |
||||
inclinometer, |
||||
compass |
||||
Active – |
Active |
– |
||
External |
Passive |
Passive |
||
on-board camera |
overhead camera, |
|||
satellite GPS |
||||
Active |
Active |
|||
sonar sensor, |
sonar (or other) global |
|||
infrared distance sensor, |
positioning system |
|||
laser scanner |
||||
Table 2.2: Sensor classification |
||||
From a robot’s point of view, it is more important to distinguish:
•Local or on-board sensors
(sensors mounted on the robot)
•Global sensors
(sensors mounted outside the robot in its environment and transmitting sensor data back to the robot)
For mobile robot systems it is also important to distinguish:
•Internal or proprioceptive sensors
(sensors monitoring the robot’s internal state)
•External sensors
(sensors monitoring the robot’s environment)
18
Binary Sensor
A further distinction is between:
•Passive sensors
(sensors that monitor the environment without disturbing it, for example digital camera, gyroscope)
•Active sensors
(sensors that stimulate the environment for their measurement, for example sonar sensor, laser scanner, infrared sensor)
Table 2.2 classifies a number of typical sensors for mobile robots according to these categories. A good source for information on sensors is [Everett 1995].
2.2 Binary Sensor
Binary sensors are the simplest type of sensors. They only return a single bit of information, either 0 or 1. A typical example is a tactile sensor on a robot, for example using a microswitch. Interfacing to a microcontroller can be achieved very easily by using a digital input either of the controller or a latch. Figure 2.1 shows how to use a resistor to link to a digital input. In this case, a pull-up resistor will generate a high signal unless the switch is activated. This is called an “active low” setting.
VCC |
||||||
R (e.g. 5k: |
||||||
input signal |
||||||
GND
Figure 2.1: Interfacing a tactile sensor
2.3 Analog versus Digital Sensors
A number of sensors produce analog output signals rather than digital signals. This means an A/D converter (analog to digital converter, see Section 2.5) is required to connect such a sensor to a microcontroller. Typical examples of such sensors are:
•Microphone
•Analog infrared distance sensor
19
2 Sensors
•Analog compass
•Barometer sensor
Digital sensors on the other hand are usually more complex than analog sensors and often also more accurate. In some cases the same sensor is available in either analog or digital form, where the latter one is the identical analog sensor packaged with an A/D converter.
The output signal of digital sensors can have different forms. It can be a parallel interface (for example 8 or 16 digital output lines), a serial interface (for example following the RS232 standard) or a “synchronous serial” interface.
The expression “synchronous serial” means that the converted data value is read bit by bit from the sensor. After setting the chip-enable line for the sensor, the CPU sends pulses via the serial clock line and at the same time reads 1 bit of information from the sensor’s single bit output line for every pulse (for example on each rising edge). See Figure 2.2 for an example of a sensor with a 6bit wide output word.
CE |
|||||||||||||||||
Clock |
1 |
2 |
3 |
4 |
5 |
6 |
|||||||||||
(from CPU) |
|||||||||||||||||
D-OUT
(from A/D)
Figure 2.2: Signal timing for synchronous serial interface
2.4 Shaft Encoder
Encoders are required as a fundamental feedback sensor for motor control (Chapters 3 and 4). There are several techniques for building an encoder. The most widely used ones are either magnetic encoders or optical encoders. Magnetic encoders use a Hall-effect sensor and a rotating disk on the motor shaft with a number of magnets (for example 16) mounted in a circle. Every revolution of the motor shaft drives the magnets past the Hall sensor and therefore
Encoder ticks results in 16 pulses or “ticks” on the encoder line. Standard optical encoders use a sector disk with black and white segments (see Figure 2.3, left) together with an LED and a photo-diode. The photo-diode detects reflected light during a white segment, but not during a black segment. So once again, if this disk has 16 white and 16 black segments, the sensor will receive 16 pulses during one revolution.
Encoders are usually mounted directly on the motor shaft (that is before the gear box), so they have the full resolution compared to the much slower rota-
20
Shaft Encoder
tional speed at the geared-down wheel axle. For example, if we have an encoder which detects 16 ticks per revolution and a gearbox with a ratio of 100:1 between the motor and the vehicle’s wheel, then this gives us an encoder resolution of 1,600 ticks per wheel revolution.
Both encoder types described above are called incremental, because they can only count the number of segments passed from a certain starting point. They are not sufficient to locate a certain absolute position of the motor shaft. If this is required, a Gray-code disk (Figure 2.3, right) can be used in combination with a set of sensors. The number of sensors determines the maximum resolution of this encoder type (in the example there are 3 sensors, giving a resolution of 23 = 8 sectors). Note that for any transition between two neighboring sectors of the Gray code disk only a single bit changes (e.g. between 1 = 001 and 2 = 011). This would not be the case for a standard binary encoding (e.g. 1 = 001 and 2 = 010, which differ by two bits). This is an essential feature of this encoder type, because it will still give a proper reading if the disk just passes between two segments. (For binary encoding the result would be arbitrary when passing between 111 and 000.)
As has been mentioned above, an encoder with only a single magnetic or optical sensor element can only count the number of segments passing by. But it cannot distinguish whether the motor shaft is moving clockwise or counterclockwise. This is especially important for applications such as robot vehicles which should be able to move forward or backward. For this reason most encoders are equipped with two sensors (magnetic or optical) that are positioned with a small phase shift to each other. With this arrangement it is possible to determine the rotation direction of the motor shaft, since it is recorded which of the two sensors first receives the pulse for a new segment. If in Figure 2.3 Enc1 receives the signal first, then the motion is clockwise; if Enc2 receives the signal first, then the motion is counter-clockwise.
encoder 1 encoder 2
two sensors
7 |
0 |
6 |
1 |
5 |
2 |
4 |
3 |
Figure 2.3: Optical encoders, incremental versus absolute (Gray code)
Since each of the two sensors of an encoder is just a binary digital sensor, we could interface them to a microcontroller by using two digital input lines. However, this would not be very efficient, since then the controller would have to constantly poll the sensor data lines in order to record any changes and update the sector count.
21
2 Sensors
Luckily this is not necessary, since most modern microcontrollers (unlike standard microprocessors) have special input hardware for cases like this. They are usually called “pulse counting registers” and can count incoming pulses up to a certain frequency completely independently of the CPU. This means the CPU is not being slowed down and is therefore free to work on higher-level application programs.
Shaft encoders are standard sensors on mobile robots for determining their position and orientation (see Chapter 14).
2.5 A/D Converter
An A/D converter translates an analog signal into a digital value. The characteristics of an A/D converter include:
•Accuracy
expressed in the number of digits it produces per value (for example 10bit A/D converter)
•Speed
expressed in maximum conversions per second (for example 500 conversions per second)
•Measurement range expressed in volts (for example 0..5V)
A/D converters come in many variations. The output format also varies. Typical are either a parallel interface (for example up to 8 bits of accuracy) or a synchronous serial interface (see Section 2.3). The latter has the advantage that it does not impose any limitations on the number of bits per measurement, for example 10 or 12bits of accuracy. Figure 2.4 shows a typical arrangement of an A/D converter interfaced to a CPU.
data bus |
|||
1bit data to dig. input |
microphone |
||
CPU |
serial clock |
A/D |
|
CS / enable |
|||
GND |
|||
Figure 2.4: A/D converter interfacing
Many A/D converter modules include a multiplexer as well, which allows the connection of several sensors, whose data can be read and converted subsequently. In this case, the A/D converter module also has a 1bit input line, which allows the specification of a particular input line by using the synchronous serial transmission (from the CPU to the A/D converter).
22
Position Sensitive Device
2.6 Position Sensitive Device
Sensors for distance measurements are among the most important ones in robotics. For decades, mobile robots have been equipped with various sensor types for measuring distances to the nearest obstacle around the robot for navigation purposes.
Sonar sensors In the past, most robots have been equipped with sonar sensors (often Polaroid sensors). Because of the relatively narrow cone of these sensors, a typical configuration to cover the whole circumference of a round robot required 24 sensors, mapping about 15° each. Sonar sensors use the following principle: a short acoustic signal of about 1ms at an ultrasonic frequency of 50kHz to 250kHz is emitted and the time is measured from signal emission until the echo returns to the sensor. The measured time-of-flight is proportional to twice the distance of the nearest obstacle in the sensor cone. If no signal is received within a certain time limit, then no obstacle is detected within the corresponding distance. Measurements are repeated about 20 times per second, which gives this sensor its typical clicking sound (see Figure 2.5).
sensor |
obstacle |
||||||||||||||||||||
sonar transducer (emitting and receiving sonar signals)
Figure 2.5: Sonar sensor
Sonar sensors have a number of disadvantages but are also a very powerful sensor system, as can be seen in the vast number of published articles dealing with them [Barshan, Ayrulu, Utete 2000], [Kuc 2001]. The most significant problems of sonar sensors are reflections and interference. When the acoustic signal is reflected, for example off a wall at a certain angle, then an obstacle seems to be further away than the actual wall that reflected the signal. Interference occurs when several sonar sensors are operated at once (among the 24 sensors of one robot, or among several independent robots). Here, it can happen that the acoustic signal from one sensor is being picked up by another sensor, resulting in incorrectly assuming a closer than actual obstacle. Coded sonar signals can be used to prevent this, for example using pseudo random codes [Jörg, Berg 1998].
Laser sensors Today, in many mobile robot systems, sonar sensors have been replaced by either infrared sensors or laser sensors. The current standard for mobile robots is laser sensors (for example Sick Auto Ident [Sick 2006]) that return an almost
23