Silvio’s robot can perceive odor concentrations and follow a trail, which could be useful in situations where there are harmful gases or other toxic substances. Watch out, bloodhounds; this robot smells better than you!


The continuing improvements in electronic technology have resulted in machines and robots with incredible characteristics. Every day, new robots with human-like abilities are being designed.

Until now, one of the human senses not yet implemented in a robot was the sense of smell. This article presents a possible application of odor sensing in mobile robots. The robot estimates the maximum gas concentration point and moves toward it or can also follow a smelling path on the ground.

A typical application for this kind of detector would be location of gases or dangerous substances. The smelling path follower can be used as a navigation system by allowing the robot to follow an odor trail on the ground or detect it to divert its trajectory [1].

This application is an example of how a midrange microcontroller (a 40-pin DIP Microchip PIC16C67) can be used in robotics. Particular care was spent on electronic design and power consumption.

The robot includes two gas sensors (to measure gas concentration), two Hall-effect sensors (to control the motor rotation), and a serial interface. By using the information derived from gas sensors, the robot recursively calculates concentration gradients and decides which direction to go, thereby defining the duty-cycle values of the square waves driving the motors.

Two DC motors driven by PWM signals directly derived from the micro provide movement. A fuzzy-logic control monitors the correct movement.

GAS SENSORS AND
CONCENTRATION MEASURE

With today’s technology, it’s possible to build an electronic nose with two gas sensors. In this application, I used Figaro TGS822 solvent sensors that are tin-dioxide (SnO2) semiconductor gas sensors [2]. When a gas is present, an oxido-reduction reaction occurs on the sensing element and the surface resistance changes.

The sensor can be seen as a concentration variable resistor described by:

eq0.jpg (5616 bytes)

where RS is the sensor resistance, R0 is the sensor resistance with no gas, and a is the sensibility.

I chose to measure the concentration by means of a technique based on capacitor-charge timing. As shown in Figure 1, two sensors and two resistors are connected to a capacitor. When a pin is configured as an output and is set to a logic high, C begins charging.

9903025-f1.gif (23904 bytes)

Figure 1—Here are the electronics for gas measurement and fuzzy control.
You can see the voltage regulator, two gas sensors, serial interface
(with ICL232) and inverter 74HC04 (to have antiphase signals drive DMOS),
and the connection to the second PCB and Hall-effect sensors.

All the other pins must be configured as inputs. If the pin is connected to the reference resistor RC, C charges up to VthH (high-threshold voltage of internal Schmitt trigger) in a time TC:

eq1.jpg (8872 bytes)

If the pin is connected to a sensor (RS), C takes a time TS before reaching VthH:

eq2.jpg (8991 bytes)

You can use a micro timer to monitor these delays. To guarantee the same initial condition on C, define a sampling period and use Rd to discharge the capacitor (configure the connected pin as an output and reset it to a logic low). By dividing TC and TS, you get:

eq3.jpg (7215 bytes)

By knowing RC and measuring TC and TS, you can determine RS and then the gas concentration. This technique can use the micro’s 16-bit internal timer, which improves the measure resolution.

Even though it’s possible to delete undesirable effects of capacitor and resistance tolerances, the obtained resolution is limited to 11 or 12 bits because of the electronic noise and the pins’ leakage current. When pins are configured as inputs, they absorb a current that causes the capacitor to charge more slowly.

Let’s say ileak is the typical pin leakage current (1 mA) [3]. Because four pins are configured as inputs and one as output, it’s possible to demonstrate that the C voltage raising time is:

eq4.jpg (10537 bytes)

Let’s use a particular algorithm to calculate the concentration gradient. In order to work properly, sensors must be heated. A heater is implemented into the sensor and presents a low value resistance (30–40 W) that must be connected to a power supply. The corresponding high current (150 mA) increases power consumption.

Instead of a DC current flow, I used dynamic driving by means of a switching-mode transistor (BS107) driven by a square-wave signal with a duty cycle of 50%. A sensible decrease in power consumption was obtained and robot autonomy increased.

By using the gas-concentration measures, the robot decides to go toward the maximum gas concentration point. Using two gas sensors mounted on the robot at a proper distance, you can obtain information about the spatial distribution of gas.

Note that the direction where the gradient is null describes the maximum increasing direction of function U. Therefore, by sampling the gas concentration U using two sensors, it’s possible to determine the gradient:

eq5.jpg (9662 bytes)

As shown in Figure 2, by estimating the direction where the gradient is null, you can find angle q, which is the steering angle in the robot motion.

To calculate the gradient, I implemented an algorithm (the Crank-Nicholson differentiator) [4] in which each directional difference is determined as:

9903025fig2.gif (3667 bytes)

Figure 2—Having a concentration measure enables you to calculate the direction where the gradient is null, thus estimating the steering angle q of robot motion.

where time (TS) is a concentration measure (in fact, it’s directly proportional to the sensor’s resistance, RS). Thanks to this equation of the directional difference, it’s possible to demonstrate that the effect of leakage currents is deleted.

By having the gradient expression, the robot can determine the angle q and, knowing the direction, move toward it. This method can be used when the robot is a maximum concentration point detector or a smelling-path follower.

ROBOT CHARACTERISTICS

The robot must have small dimensions to move in restricted spaces, so small motors were a necessity. I used two 3–6-VDC motors that provided low price, good characteristics, and easy driving control.

These motors are sources of strong electromagnetic emissions that could compromise the micro’s functionality, so mechanical shielding and two different PCBs were introduced. On the first PCB, there are gas sensors, a micro, a serial interface, and the circuitry for the Hall-effect sensors and driving bumpers (see Figure 1). The motor drivers are on the second PCB.

A PIC16C67 with a 4-MHz quartz oscillator was used and the PCB has a 5-VDC voltage supply obtained by a 9-VDC battery and a DC/DC step-down voltage regulator (a National Semiconductor LM2575), which can decrease power losses and assure the correct voltage even when the battery voltage drops.

A resistive partitor was introduced to monitor battery charge. A micro pin is connected to the central point and when the voltage reaches the low threshold voltage of the internal Schmitt trigger (VthL), the robot is stopped. This technique ensures that the correct input value is sent to the voltage regulator and then to all the circuitry.

I chose pulse-width modulation to drive the motors. Modulating the duty cycle of square-wave signals enables you to change average motor voltages (VLm), as shown by:

eq8.jpg (7112 bytes)

where VS is the voltage supply and D is driving signal duty cycle.

Driving a motor with different voltages permits different rotation velocities. The robot is steered by rotating the driving wheels. It’s possible to vary motor rotation and have the robot steering only work on duty-cycle values.

It’s also possible to guarantee negative average voltages (which reverses the motor rotation). During gas-concentration measurement, the robot switches off the motor (working on the ENABLE pin) to reduce noise effects.

Full-bridge DMOS drivers (L6202 SGS-Thomson) are mounted on the second PCB (see Figure 3). Thanks to the switching unipolar devices, power losses are strongly reduced and because of internal implementation, the DMOS driver can connect directly to the micro.

9903025-f3.gif (15847 bytes)

Figure 3—These schematics show the PCB (a) and internal electronics
(b) of the SGS-Thomson L6202 DMOS driver. It is possible to bootstrap the
capacitor, which is directly connected to the outputs and the internal
charge pump, voltage reference, and thermal shutdown.

A locked anti-phase control is used, and with a single PWM input signal, it’s possible to drive a diametrically opposite pair of DMOS switches together. The two pairs of switches are driven by the anti-phase signal obtained by the 74HC04 on the first PCB. For avoiding cross-conduction (two DMOS on the same side switching on contemporary and then short-circuiting the power supply), an internal dead-time logic is implemented.

By having two separate voltage supplies for the PCBs, you remove the effect of conducted noise from the motors, which are directly mounted on the robot chassis. The chassis is made of aluminum (to have a light structure) and consists of a plane under which the motors are mounted (see Photo 1a). The metal plane can serve as an electromagnetic shield to reduce the motors’ electromagnetic emission.

9903025 photo 1.jpg (30280 bytes)9903025 photo 2.jpg (47156 bytes)

        a)                                                b)

Photo 1a—Note the two PCBs on the sniffing robot. While the robot is working as a maximum gas point detector, the aspirator tubes are far from each other. bWhen the robot works as path follower, all you have to do is bend the tubes down toward the ground and the sensors can follow the odor trail.

After estimating the direction to follow (and the angle q), it’s possible to determine the difference of the duty cycle, thus giving the proper signals to the motors. The robot is monitored to ensure it doesn’t get diverted because of mechanical or dynamic phenomena. Sensors track the wheel rotation and estimate the robot’s direction.

Hall-effect sensors and eight little magnets were put on each wheel. Every time a magnet passes the sensor, it generates a signal and the micro increments a counter (if the signal is derived from the right wheel) or decrements it (if the signal is derived from the left wheel). Optical sensors were not used because any powder or dust along the path influences the sensors’ response.

The gas sensors must be positioned in different places when the robot is working as a maximum-concentration-point detector and when it is working as a path follower. As a maximum-concentration-point detector, the sensors must be as far apart as possible to provide more information about the gas distribution. When following a path, the sensors must be as near as possible to the smelling path.

To ensure a correct operation without moving the sensors, I used an aspiration system, which lets me choose where the robot "sniffs" by simply bending two tubes (see Photo 1b). Fuzzy logic is used to link information about the gradient estimation and the direction of travel.

ROBOT LEARNING

Because of differences among motors and sensors, a learning function is used to reach two goals—to determine both the R0 and duty-cycle values for each gas sensor to guarantee identical motor rotation.

As I mentioned, R0s are different from sensor to sensor. It’s possible to delete this undesirable tolerance by performing lots of measures without gas and calculating the average value of RS for each sensor (without gas, R0 = RS). The measure with gas (RS) is then compared with this value.

When the same voltage is supplied to the two DC motors, because of internal electrical and mechanical differences, different rotations are noted. To delete this effect and guarantee identical rotation, the duty-cycle value must be measured. This measurement is obtained via signals from Hall-effect sensors and a continuing variation of duty-cycle values.

At the beginning of the process, a threshold value is loaded into the micro’s counter and the same duty-cycle values are supplied to the motor drivers. Rotations are measured as different signals from the Hall-effect sensors and thus different values of the micro’s counter (remember, its value is increased or decreased each time a signal from the left or right wheel is sensed). This value is used to estimate the difference of the duty cycle to apply to motor drivers.

When no difference between the counter and threshold values is detected, the duty-cycle values are loaded into memory cells and added to the gradient information. When the angle q is null, you have a linear trajectory even though there are strong differences in the motors’ characteristics. This procedure annuls the intrinsic motors’ diversity and guarantees that steering is a result of gradient estimation, not dynamic or mechanical problems.

 

FUZZY-LOGIC CONTROL

After you estimate the direction the robot needs to go, you have to combine gradient information and Hall-effect signals to control the correct movement. Fuzzy-logic control helps solve this problem. I used fuzzyTECH-MP development tools (see Photo 2) to combine fuzzy variables gradient and diff_ motor to have the output fuzzy variable diff_duty.

9903025 photo 3.jpg (250926 bytes)

Photo 2This is what the fuzzy-logic controller, spreadsheet rule editor, and MBF of the input fuzzy variables gradient and diff_motor look like.

The variable gradient comes from gradient estimation and presents three MBFs—left is activated if the gradient estimation gives a left direction to follow, null if the direction is straight, and right if the gradient is to the right.

diff_motor derives from the Hall-effect signal (and represents differences of rotation). It is also described by three MBFs. Each MBF is activated if the robot is going toward the left (diff_ left), the right (diff_right), or straight (diff_null). The output variable diff_duty represents the difference of the duty cycle to apply.

Typical fuzzy rule structure makes control easy. By introducing three MBFs for each fuzzy variable (as shown in the lower side of Photo 2), it’s possible to have nine activation rules (as shown in the upper right side of Photo 2). A typical activation rule is made of:

IF cond1 AND cond2 THEN cond3

where cond1 is a condition of the variable gradient, AND is a Zadeh logic operator, cond2 is a condition of diff_ motor, and cond3 is the activation diff_duty.

It’s possible to use human thought to write activation rules. The gradient information is compared with the diff_motor information. If they match, the regulation action is light. In fact, this situation means a correct robot direction, and dutynull is activated to ensure a light regulation.

If the gradient and diff_motor information contrast, regulation is strong. In this case, the robot isn’t going in the correct direction and has to divert, so the fuzzy variables dutyleft or dutyright are activated.

Defuzzification is obtained by the CoM (center of Maximum or Sugeno) algorithm to ensure good resolution and easy calculation. Thanks to the RS-232 serial interface, it’s possible to adjust the fuzzy parameters as MBF or index of activation of each rule.

RESULTS

This project required many tests. Initially, the robot had to learn in a gas-free environment. At first, the robot moved chaotically, but because of the dynamic regulation of the duty cycle, it soon began to follow a linear trajectory.

To test the robot as a maximum-gas-concentration-point identifier, a plate with alcohol and naphthalene was set up to simulate a gas source. Given the solvent sensors, the electronic-nose response was good even though we didn’t use gas. At 4–5 m from the source, the robot came close to the plate (less than 15 cm away) and even touched it several times.

To test all possible behaviors, different starting positions were tried. The main setback was airflows, which tend to spoil the spatial distribution of gas and divert the robot from the gas source.

To test the robot as a path follower, we drew a path using the same alcohol and naphthalene mixture but more concentrated. The odor trails had different shapes to test the robot’s ability to follow paths.

If the trail contained an angle less than 120°, the robot had problems following the path. A better aspiration system and mechanical structure may solve this problem.

In other tests, we found that by using a switching voltage regulator and unipolar motor driver, it’s possible to decrease power losses and increase robot energy autonomy.

Using a micro, we integrated all the work into one device. Good software development decreases the number of components on the PCB, lowering cost.

An electronic nose may seem strange, but an odor-sensing robot can be useful when the presence of gas or toxic substances is dangerous to humans.

REFERENCES
[1] R.A. Russell, "Laying and sensing odor marking as a strategy for              assisting mobile robot navigation tasks," IEEE Robotics and              Automation, Sept. 1995.
[2] Figaro Engineering, TGS 822 for solvent vapor detection, Technical          Information, 1996.
[3] Microchip Technology, Microchip PIC16/17 Handbook, 1997.
[4] M. Proakis, Digital Signal Processing: Principles, Algorithms and              Applications, Prentice-Hall, Englewood Cliffs, NJ, 1991.

SOURCES
PIC16C67

Microchip Technology, Inc.
(602) 786-7200
Fax: (602) 899-9210
www.microchip.com

LM2575
National Semiconductor
(408) 721-5000
Fax: (408) 739-9803
www.national.com

L6202
SGS-Thomson
(617) 259-0300
Fax: (617) 259-4421
www.scp.sidex.ro/stonline/index.htm

TGS822
Figaro USA, Inc.
(847) 832-1701
Fax: (847) 832-1705
www.figarosensor.com

fuzzyTECH
Inform Software
(630) 268-7550
Fax: (630) 268-7554
www.inform-ac.com