CHAPTER 29

THE SENSE OF TOUCH
Like the human hand, robotic grippers often need a sense of touch to determine if and when they have something in their grasp. Knowing when to close the gripper to take hold of an object is only part of the story, however. The amount of pressure exerted on the object is also important. Too little pressure and the object may slip out of grasp; too much pressure and the object may be damaged.
The human hand has an immense network of complex nerve endings that serve to sense touch and pressure. Touch sensors in a robot gripper are much cruder with just one or two points, but for most hobby applications these sensors serve their purpose: to provide nominal feedback on the presence of an object and the pressure exerted on the object.
This chapter deals with the fundamental design approaches for several touch sensing systems for use on robot grippers (or should the robot lack hands, elsewhere on the body of the robot). Modify these systems as necessary to match the specific gripper design being used and the control electronics you are using to monitor the sense of touch.
Note that in this chapter the distinction between touch and collision is made. Touch is a proactive event, where you specifically wish the robot to determine its environment by making physical contact. Conversely, collision is a reactive event, where (in most cases) you wish the robot to stop what it’s doing when a collision is detected and back away from the condition. Chapter 30, “Object Detection,” deals with the (potential for) physical contact resulting in a collision.
images
You can choose from a wide variety of switch styles when designing contact switches for tactile feedback. Leaf switches (sometimes referred to as Microswitch switches) come with levers of different lengths that enhance the sensitivity of the switch. You can also use miniature contact switches, like those used in keyboards and electronic devices, as touch sensors on your robot.
In all cases, mount the switch so it makes contact with whatever object you wish to sense. In the case of a robotic gripper, you can mount the switch in the hand or finger sections.
images
One of the most convenient components that you can use for sensing objects around a robot or in its grippers is the Microswitch (Fig. 29-3). The name comes from one of the first companies to manufacture switches that can be actuated by external mechanical pressure. Microswitches come in a variety of different shapes and sizes (many more than an inch long, which seems contradictory for something with micro in its name).
images
When you start out, you might want to consider a Microswitch with a long metal actuator like the one shown in Fig. 29-3 and have a double throw internal switch (three connections— a common, a normally open, and a normally closed). The actuator can be extended by gluing on a plastic tube (or straw) or soldering on a metal extension. The double throw switch will allow you to use the Microswitch as normally open or normally closed or as part of a debounce circuit that will be discussed later in the chapter. These features will give you a maximum amount of operational flexibility when adding a Microswitch to your robot.
images
These oscillations are caused by the contacts within the switch literally bouncing off one another when the switch is closed. Going by Fig. 29-4, you can see that this bouncing takes place over a few hundred microseconds—much too fast to be detected by the naked eye. But this bouncing is a problem for computer systems and other electronic devices. Without being properly debounced, each spike may be recognized as an individual event and instead of the robot responding as if the switch changed state once, it will respond to many switch changes, which will potentially make your robot behave erratically.
It is important to note that switch bouncing also takes place when contacts are pulled apart from each other as well as when they come together. You will have to ensure that debouncing takes place for both cases to ensure that no unexpected switch transitions affect the way you expect your robot to operate.
There are some simple hardware approaches to debouncing switch inputs. These methods eliminate the need for software to be developed to process the incoming signals as will be discussed in the next section. Unfortunately, these methods increase the robot’s circuitry, so while there is some savings in software complexity, there will be an increase in the overall robot circuitry, which can be difficult to add in a small robot or one that has already been built.
The first method to debounce a circuit uses a double throw switch and a couple of CMOS Schmitt input inverters as shown in Fig. 29-5 (with its parts list in Table 29-1). The two inverters form a flip-flop that only changes state when the switch definitely changes state.
images
 
74LS14
Hex Schmitt trigger input inverter chip
10k
10k resistor
Switch
Double throw, single pole switch
 
When the common contact is not touching either connector (and is disconnected from Vcc and ground), the flip-flop circuitry remembers the last common contact position. In the circuit given in Fig. 29-5, note that the inverters are Schmitt-triggered CMOS gates—the Schmitt trigger helps ensure that the flip-flop only changes state at a definite voltage level. The CMOS gates along with the 10k current limiting resistor ensures that there is not a large current flow or “backdriving” of an inverter’s output.
There are other hardware debounce circuits that you can use in your application as well. One of the most popular is using a 555 set up as a monostable multivibrator with enough of a delay to ensure that any bounces are masked by the 555’s output. The circuit shown in Fig. 29-5 is very efficient, both in terms of operation as well as cost; you will be hard pressed to find a circuit that is as simple and effective as this one.
Debouncing button inputs in software can be tricky; the need for performing other operations in an application means that the debounce code must be integrated with the complete application. This requirement adds a level of complexity to the code that can be difficult to implement for many new programmers. While debouncing button inputs in software is more cost efficient than adding hardware, you may find that the amount of work to get debounce code working in a complete robot application to be much more effort than adding a couple of CMOS Schmitt trigger inverters and a resistor.
The rule of thumb for debouncing a button input is that the line is considered to be debounced and the input stable when it has not changed state for at least 20 ms. The code for debouncing a single button in a stand-alone application is actually quite easy:
images
This code increments a counter each time in a loop that the button is down. If the button is not down then the counter is reset. The counter value is continually checked to see if it has incremented to a value equal to or greater than 20 ms and when it is, the execution of the program leaves the “while” loop and returns to the subroutine’s caller.
The problem with debugging a button in software comes when there are additional functions built into the robot. When this happens the time the main robot loop code executes must be known (and becomes the incrementing value for the button counter) and the main loop above becomes distributed. If the robot execution loop was assumed to execute in 1 ms, then the basic code could look like:
images
Note that the button “state” variables are limited to a maximum value of 20. This is done to ensure that the variables do not overflow and become zero, which indicates the buttons are not pressed.
While the code in the listing seems complex, you should remember that multiple buttons could be added to the robot application by simply copying this code for each additional button (new counter variables will be required as well). You will discover that the execution time penalty of the button debounce software is negligible, and using this code, you should be able to add a number of buttons to your robot application relatively easily.
Optical sensors use a narrow beam of light to detect when an object is within the grasping area of a gripper. Optical sensors provide the most rudimentary form of touch sensitivity and are often used with other touch sensors, such as mechanical switches.
images
Mounting the infrared pair on the tips of the fingers or pinchers provides little grasping area because the robot is told that an object is within range when only a small portion of it can be grasped. In most gripper designs, two or more LEDs and phototransistors are placed along the length of the grippers or fingers to provide more positive control. Alternatively, you may wish to detect when an object is closest to the palm of the gripper. You’d mount the LED and phototransistor accordingly.
Fig. 29-7 shows the schematic diagram for a single LED-transistor pair. Adjust the value of R2 to increase or decrease the sensitivity of the phototransistor. You may need to place an infrared filter over the phototransistor to prevent it from triggering as a result of ambient light sources (some phototransistors have the filter built into them already). Use an LED-transistor pair equipped with a lens to provide additional rejection of ambient light and to increase sensitivity.
images
During normal operation, the transistor is on because it is receiving light from the LED. When an object breaks the light path, the transistor switches off. A control circuit connected to the conditioned transistor output detects the change and closes the gripper. In a practical application, using a computer as a controller, you’d write a short software program to control the actuation of the gripper.
An optical sensor is a go/no-go device that can detect only the presence of an object, not the amount of pressure on it. A pressure sensor detects the force exerted by the gripper on the object. The sensor is connected to a converter circuit, or in some cases a servo circuit, to control the amount of pressure applied to the object.
Pressure sensors are best used on grippers where you have incremental control over the position of the fingers or pinchers. A pressure sensor would be of little value when used with a gripper that’s actuated by a solenoid. The solenoid is either pulled in or it isn’t; there are no in-between states. Grippers actuated by motors are the best choices when you must regulate the amount of pressure exerted on the object.
You can make your own pressure sensor (or transducer) out of a piece of discarded conductive foam—the stuff used to package CMOS ICs. The foam is like a resistor. Attach two pieces of wire to either end of a 1-in square hunk and you get a resistance reading on your volt-ohm meter. Press down on the foam, and the resistance lowers.
The foam comes in many thicknesses and densities. Look for semi-stiff foam that regains its shape quickly after it’s squeezed. Very dense foams are not useful because they don’t quickly spring back to shape. Save the foam from the various ICs you buy and test other types until you find the right stuff for you.
You can make a pressure sensor by sandwiching several pieces of material together, as shown in Fig. 29-8. The conductive foam is placed between two thin sheets of copper or aluminum foil. A short piece of 30 AWG wire-wrapping wire is lightly soldered onto the foil (when using aluminum foil, the wire is wound around one end). Mylar plastic, like the kind used to make heavy-duty garbage bags, is glued on the outside of the sensor to provide electrical insulation. If the sensor is small and the sense of touch does not need to be too great, you can encase the foam and foil in heat-shrink tubing. There are many sizes and thicknesses of tubing; experiment with a few types until you find one that meets your requirements.

images
images
For example, the transducer may first register an output of 30KΩ (the exact value depends on the foam, the dimensions of the piece, and the distance between wire terminals). The software reads this value and uses it as the set point for a normal (nongrasping) level to 30K. When an object is grasped, the output drops to 5K. The difference—25K—is the amount of pressure. Keep in mind that the resistance value is relative, and you must experiment to find out how much pressure is represented by each 1K of resistance change.
The transducer may not go back to 30K when the object is released. It may spring up to 40K or go only as far as 25K. The software uses this new value as the new set point for the next occasion when the gripper grasps an object.
Obviously, the home-built pressure sensors described so far leave a lot to be desired in terms of accuracy. If you need greater accuracy, you should consider commercially available strain gauges. These work by registering the amount of strain (the same as pressure) exerted on various points along the surface of the gauge.
The output of both the homemade conductive foam pressure transducers and the strain gauges is analog—a resistance or voltage. Neither can be directly used by a computer, so the output of these devices must be converted into digital form first.
images
Notice the 10K resistor in Fig. 29-10, placed in series between the pressure sensor and ground. This converts the output of the sensor from resistance to voltage. You can change the value of this resistor to alter the sensitivity of the circuit. For more information on ADCs, see Chapter 14, "Computer Peripherals."
A new form of electricity was discovered just a little more than a century ago when the two scientists Pierre and Jacques Curie placed a weight on a certain crystal. The strain on the crystal produced an odd form of electricity—significant amounts of it, in fact. The Curie brothers coined this new electricity piezoelectricity; piezo is derived from the Greek word meaning press. Later, the Curies discovered that the piezoelectric crystals used in their experiments underwent a physical transformation when voltage was applied to them. They also found that the piezoelectric phenomenon is a two-way street. Press the crystals and out comes a voltage; apply a voltage to the crystals and they respond by flexing and contracting.
All piezoelectric materials share a common molecular structure, in which all the movable electric dipoles (positive and negative ions) are oriented in one specific direction. Piezoelectricity occurs naturally in crystals that are highly symmetrical—quartz, Rochelle salt crystals, and tourmaline, for example. The alignment of electric dipoles in a crystal structure is similar to the alignment of magnetic dipoles in a magnetic material.
When an electrical voltage is applied to the piezoelectric material, the physical distances between the molecular dipoles change. This causes the material to contract in one dimension (or axis) and expand in the other. Conversely, placing the piezoelectric material under pressure (in a vise, for example) compresses the dipoles in one more axis. This causes the material to produce a voltage.
While natural crystals were the first piezoelectric materials used, synthetic materials have been developed that greatly demonstrate the piezo effect. A common human-made piezoelectric material is ferroelectric zirconium titanate ceramic, which is often found in piezo buzzers used in smoke alarms, wristwatches, and security systems. The zirconium titanate is evenly deposited on a metal disc. Electrical signals, applied through wires bonded to the surfaces of the disc and ceramic, cause the piezo material to vibrate at high frequencies (usually 4 kHz and above).
Piezo activity is not confined to brittle ceramics. PVDF, or polyvinylidene fluoride (used to make high-temperature PVDF plastic water pipes), is a semicrystalline polymer that lends itself to unusual piezoelectric applications. The plastic is pressed into thin, clear sheets and is given precise piezo properties during manufacture by—among other things—stretching the sheets and exposing them to intense electrical fields.
Whether you are experimenting with ceramic or flexible PVDF film, it’s important to understand a few basic concepts about piezoelectric materials:
The ubiquitous ceramic disc is perhaps the easiest form of piezoelectric transducer to experiment with. A sample disc is shown in Fig. 29-11. The disc is made of nonferrous metal, and the ceramic-based piezo material is applied to one side. Most discs available for purchase have two leads already attached. The black lead is the ground of the disc and is directly attached to the metal itself.
images
You can use a ceramic disc as an audio transducer by applying an audio signal to it. Most piezo discs will emit sound in the 1K to 10K region, with a resonant frequency of between 3K and 4K. At this resonant frequency, the output of the disc will be at its highest.
When the piezo material of the disc is under pressure—even a slight amount—the disc outputs a voltage proportional to the amount of pressure. This voltage is short lived: shortly after the initial change in pressure, the voltage output of the disc will return to 0. A negative voltage is created when the pressure is released (see the discussion of the bipolar nature of piezo materials earlier in the chapter).
You can easily interface piezo discs to a computer or microcontroller, either with or without an analog-to-digital converter. Chapter 30, “Object Detection,” discusses several interface approaches. See the section “Piezo Disc Touch Bar” in that chapter for more information.
Samples of Kynar piezoelectric film are available in a variety of shapes and sizes. The wafers, which are about the same thickness as the paper in this book, have two connection points, as illustrated in Fig. 29-12. Like ceramic discs, these two connection points are used to activate the film with an electrical signal or to relay pressure on the film as an electrical impulse.
images
You can perform basic experiments with the film using just an oscilloscope (preferred) or a high-impedance digital voltmeter. Connect the leads of the scope or meter to the tabs on the end of the film (the connection will be sloppy; there are some suggestions for other ways to attach leads to Kynar film in the next section). Place the film on a table and tap on it. You’ll see a fast voltage spike on the scope or an instantaneous rise in voltage on the meter. If the meter isn’t auto-ranging and you are using the meter at a low setting, chances are that the voltage spike will exceed the selected range.
Unlike piezoelectric ceramic discs, Kynar film doesn’t usually come with pre-attached leads (although you can order samples with leads attached, but they are expensive). There are a variety of ways to attach leads to Kynar film. Obviously, soldering the leads onto the film contact areas is out of the question. Acceptable methods include applying conductive ink or paint, self-adhesive copper-foil tape, small metal hardware, and even miniature rivets. In all instances, use small-gauge wire—22 AWG or smaller. You can expect the best results using 28 AWG and 30 AWG solid wire-wrapping wire. The following are the best methods:
  • Conductive ink or paint. Conductive ink, such as GC Electronics’ Nickel-Print paint, bonds thin wire leads directly to the contact points on Kynar film. Apply a small globule of paint to the contact point, and then slide the end of the wire in place. Wait several minutes for the paint to set before handling. Apply a strip of electrical tape to provide physical strength.
  • Self-adhesive copper-foil tape. You can use copper-foil tape designed for repairing printed circuit boards to attach wires to Kynar film. The tape uses a conductive adhesive and can be applied quickly and simply. As with conductive inks and paints, apply a strip of electrical tape to the joint to give it physical strength.
  • Metal hardware. Use small 2/56 or 4/40 nuts, washers, and bolts (available at hobby stores) to mechanically attach leads to the Kynar. Poke a small hole in the film, slip the bolt through, add the washer, and wrap the end of a wire around the bolt. Tighten with the nut.
  • Miniature rivets. Homemade jewelry often uses miniature brass or stainless steel rivets. You can obtain the rivets and the proper riveting tool from many hobby and jewelry-making stores. To use them, pierce the film to make a small hole, wrap the end of the wire around the rivet post, and squeeze the riveting tool (you may need to use metal washers to keep the wire in place).
Fig. 29-13 shows a simple demonstrator circuit you can build that indicates each time a piece of Kynar film is struck. Tapping the film produces a voltage output, which is visually indicated when the LED flashes. The 4066 IC is an analog switch. When a voltage is applied to pin 3, the connection between pins 1 and 2 is completed and that finishes the electrical circuit to light the LED. For a robotic application, you can connect the output to a computer or microcontroller.
images
You can easily create a workable touch sensor by attaching one or two small Kynar transducers to a thick piece of plastic. The finished prototype sensor is depicted in Fig. 29-14. The plastic membrane could be mounted on the front of a robot, to detect touch contact, or even in the palm of the robot’s hand. Any flexing of the membrane causes a voltage change at the output of one or both Kynar film pieces.
images
The human body has many kinds of touch receptors embedded within the skin. Some receptors are sensitive to physical pressure, while others are sensitive to heat. You may wish to endow your robot with some additional touch sensors like:
To learn more about . . .
 
Read
Designing and building robot hands
 
Chapter 28, “Experimenting with Gripper Designs”
Connecting sensors to computers and microcontrollers
 
Chapter 14, “Computer Peripherals”
Collision detection systems
 
Chapter 30, “Object Detection”
Building light sensors
 
Chapter 32, “Robot Vision”
Fire, heat, and smoke detection for robotics
 
Chapter 34, “Fire Detection Systems”