CSC 297 Robot Construction: Sensors

Sensing the World

Things aren't always what they seem...
image source


A robot, in our definition, interacts with the physical world under internal adaptive control. In order to adapt to a dynamic world, the robot must obtain information about it on an ongoing basis. This is what sensors provide.

Two natural questions are: one, what sort of information is useful to a robot and two, how can it be obtained? Now clearly, what information a robot needs depends on what it is supposed to do. But suppose we start with the classic idea of robots that interact with the world in human-like (or animal-like) ways. Whatever that may turn out to mean.

Where NOT to start

If we think about animals, there might seem to be some obvious answers to the question of what sensors are useful. For example, many animals have eyes and ears. So do people, and we have a fairly sophisticated subjective understanding of the sort of information they provide to us and what it is good for. We even have a detailed scientific understanding, in terms of physical theories of light and sound, of some of what eyes and ears do and how they do it.

So naturally, robots should have eyes and ears. Well, we don't know how to cut eyes and ears out of an animal and connect them to a robot in a practical and perceptually useful way. But we do have systems that can record the effects of sound and light, and re-create them so that human senses think the experience is close to the original in terms of information perceived (e.g. television and audio). This implies that the recordings capture much of what is perceptually relevant in the incoming sound and light fields. Modern systems even have a stage where all the information is represented as an electrical signal, which is the medium we are using to transfer and manipulate information in contemporary (1950-2015) robots.

Clearly all we have to do to give robots eyes and ears, is connect TV cameras and microphones to the internal computers and do the appropriate processing of the incoming electrical signals. So, starting in the 1970s, this is exactly what robot constructors did. That part was easy. Getting anything useful out of the signals, at least anything corresponding to the subjective concepts people employ when talking about visual and auditory perception, proved far harder. In fact, even today, 40+ years and about 8 orders of magnitude in computational resources later, computer vision systems are non-competitive with human or mammalian ones for doing many of tasks animals use vision to help accomplish (e.g. walking in the woods, never mind chasing down and catching a rabbit).

Since the animal brain is clearly doing something interesting and non-trivial with what the eye delivers, scientists have poked around (literally) in the brains of cats and monkeys and other visual critters to see if they can figure out what and how. A lot of interesting phenomena have been observed, some even reminiscent of processing machine vision researchers have found useful. However, aside from revealing that the brain is a system of stunning complexity, our knowledge of how the brain does what it does (or even what it does in a scientific sense) remains at best a suggestive outline. It certainly is not detailed enough to help us design robot processing.

Of course we have discovered something in 40 years of work on machine vision and hearing. There is certain robotically useful information we know how to extract from video, e.g. moving objects, depth maps, faces, even visual recognition and localization, in appropriately restricted contexts. We can reliably recognize isolated words, and even (sort of) transcribe continuous speech (in quiet environments with a good speaker). However most of these abilities require a fair amount of computation (i.e. at least laptop level resources), and thus must be counted as advanced perception.

Where we CAN Start

So if not eyes and ears, what CAN the constructor do with modest budget and computation? Quite a lot, it turns out.

One way of looking at the scientific models that underlie modern technological civilization is that they are basically all about measurement. Specifically, what can be measured, how it can be measured, and what relationships exist between measurables. Here measurement is defined as a process by which independent observers can associate the same number to some aspect of the physical world. Like the height of the Tower of Pisa in cubits, or the weight of the Stone of Scone in pounds, or the (fractional) number of electrons that mass a proton.

Scientists and engineers have spent the last 300 years discovering aspects of reality to which numbers can be stably associated and inventing clever measurement devices and techniques for reliably reproducing them. Mass, distance, duration. Force, velocity, acceleration. Momentum, energy, charge. Temperature, density, specific heat, electrical conductivity, index of refraction, spectral reflectivity, elastic modulus, ... The list is a long one.

Because measured numeric quantities are reproducible and invarient, because they represent functionally important information about the physical world, and because computers, the brains of our robots, are (not coincidently) particularly good with numbers, measurement devices are an obvious source of robot sensors. All we need is devices that output their numeric measures in an electrical language accessible to our bot's computer brains.

A convenient mechanism for displaying changing numeric values, dating from the beginning of the scientific era, is the galvanometer (essentially an electro-mechanical micro-ammeter with an analog needle display). Add a resistance and it is a voltmeter. Because of this display device, many sensors, even prior to the electronic era, were designed to produce an analog electrical output. With appropriate scaling resistors, such devices can be attached to, and directly read by, standard microcontrollers.

Modern sensors include ones designed specifically for digital interaction. They employ interaction protocols of varying complexity, ranging from simple digital triggering to sophisticated two-way serial communication. The simplest protocols can sometimes be programmed directly on a microcontroller with modest effort. More complex ones usually employ pre-written library routines. You can attempt to write them yourself, but you need complete details of the sensor and microcontroller internals. Writing efficient serial communication code frequently requires assembly-level programming of the microcontroller, and is surprisingly involved, especially for the novice. If you want to use complex digital sensors, you'll want libraries for them.

Classification of Sensors

There are enough different sensors useful to the robot constructor that some way of organizing them is helpful. Several characteristics are useful for categorization.

There are many, many sensors. Here is one big list (not focussed on robotics). Wikipedia list of sensors.

The following discussion is organized mostly, and somewhat loosely, in terms of the first two categories - sensor type and quantity measured. The first correlates strongly with how the sensor is used and what physical and computational support it needs, the second, with what sort of information the robot requires to do its thing, whatever that may be...

We will start with--


Switches (Wikipedia) make and break electrical circuits, generally in an all-or-nothing fashion. They have two main applications: as a method for directing electrical power, and as sensors that open or-close a low-power circuit to indicate some condition. Power switches must carry high currents, often many amperes, without overheating. They often must safely operate at high voltages. They must interrupt high-power currents without damaging arcs. To do this, they are usually large, heavy, and robustly built. Sensor switches, which are our primary focus here, are a different beast. They usually operate at only a few volts, and need to carry only milliamps of current. They can be much lighter in construction.

That said, a switch must always be selected to match the application. Switches are rated in terms of voltage and amperage. The DC rating is often much lower than the AC rating. This is because DC currents have a far greater tendency to arc than AC currents, which go to zero twice every cycle, giving any arc a chance to quench. As a rule of thumb, you should select switches with ratings at least twice the maximum you expect to occur in your application. In some situations where voltages are carefully regulated (such as household AC wiring) it may be safe to use components rated for that voltage. A switch UL rated for 130V AC is probably safe to use in your house. Our constructs are likely to be less disciplined. Best to leave marginal engineering to the professionals.

Classification of Switches

Simple mechanical switches come in three common ergonomic forms: 2-position flip or toggle, single-button momentary or tactile, and alternating button. A two-position switch features a lever, rocker, or slide that can be placed in either of two stable configurations. A momentary button switch is spring-loaded, so that it is normally in one configuration, and is in the other only when under pressure. Simple momentary switches can be classified as normally-open (NO) or normally-closed (NC) An alternating switch is a button which toggles between two configurations on alternate presses (e.g. press-on, press-off). More complex switches may have several positions, either on a slide or on a rotary dial.

Two-position switches come in four basic electrical configurations: Single-pole-single-throw (SPST), double-pole-single-throw (DPST), single-pole-double-throw (SPDT), and double-pole-double-throw (DPDT). Other configurations are sometimes encountered, but these are the most common.

Switch Symbols


Switches as Sensors

As sensors, switches are most often thought of as devices to take input from human operators. Turn on, turn off, start, stop, hold, run fast, run slow, execute program A, B, C, or D, tune to station 30, etc. A computer keyboard is basically several dozen momentary switches, arranged to allow a person to efficiently press them in arbitrary sequence.

However, switches are also frequently used to provide information about robot internal state. A common application is a "limit switch" which signals when a joint is about to exceed some safety bound. Such switches are often hard-wired to shut-down or power interrupt circuits to ensure that a robot does not damage itself in the event of software errors. Switches can also be used to detect when a robot comes in contact with the external environment. These are sometimes termed "bump switches" for obvious reasons, and are often used as a backup layer to longer range, but more error-prone distance sensors. Because they do not have to carry much power, quite small sensor switches are available.
A selection of switches from Sparkfun
A selection of switches from Adafruit

A simple switch attached to a microcontroller input pin can be wired either to open or close a circuit when pressed. For such circuits to operate reliably, they must be arranged so that, in no event, is the microcontroller input left "floating" when the switch is open. This is done by the use of pull up or pull down resistors, which connect the microcontroller input, through a fairly high resistance, either to positive voltage (pull up) or to ground (pull down), when the switch is open. Typical values for externally connectable pins are 10 kOhms - 100 kOhms. When the switch is closed, the effect of this large resister is negligible compared to the current that can be provided or sunk by the closed circuit.

Another issue that sometimes arises with switches attached to a microcontroller is "bounce". Because switch contacts are usually made of springy metal, when a contact is made, the switch may actually bounce rapidly several times, typically at kHz frequencies, before stabilizing. For switching power on or off, this usually makes no difference, but micro-controllers are fast enough to distinguish all the bounces. If your program watches for the switch to be pressed to do something, and then for it to be released to do something else, it can pass both conditions in a couple of milliseconds, which is often not the desired behavior.

A number of strategies exist for debouncing switches. The simplest is simply to wait for a short period (e.g. 50 or 100 ms) between making a state change and looking for the signal to execute the next. This is sufficient for most interactions with the macro-environment or human operators. For operations involving very fast sequencing, e.g. driving the phases of a motor, more sophisticated techniques are needed. One method is to combine a small filter capacitor with a Schmitt Trigger (Wikipedia) circuit.

Sensors as Switches

On the flip side, a large number of sensors are implemented as switches. Examples include "fuses", circuit breakers, mercury "tilt" switches and other tip sensors, and optical beam-trip (burgler alarm) sensors. Magnetic "non-contact" switches that activate in the presence of a strong magnetic field and are usually used to detect the presence of a permanent magnet nearby, could also be included in this category.

Thresholded analog devices are another source of switch sensors. Thresholds may be adjustable or software programmable. Examples include thermostatic temperature switches, pressure switches, and under/over-voltage sensors.

Sometimes a sensor performs complex processing, but presents a switch-like output for microcontroller use. Examples are ultrasonic motion alarms and IR proximity alarms.

Variable Resistance

A large number of electrical sensors are based on systems where the resistance of some component changes in response to an external physical condition (e.g., pressure, temperature, light.) We group them here because they are all connected to a microcontroller brain in the same basic way. Specifically, a voltage divider circuit is used to convert change in resistance into a change in voltage, which can then be applied to a microcontroller analog input. Some care is needed in selecting the resisters in this circuit so that the output voltage always falls in the desired range.


A potentiometer (Wikipedia) or POT for short, is a three-terminal device consisting of resistive element, usually a coil or bar, with a terminal at each end, and a moveable center terminal, termed a "wiper", that contacts the resistive element at a variable location between the two ends. The most common use of a potentiometer is as a variable voltage source. If a voltage is placed across the end terminals, one of which is taken as ground, then the voltage seen at the wiper is proportional to the physical fraction of the resistive element remaining between the tap and ground. If the current pulled from the center tap is small compared to the current flowing in the main resistance, then there is a near-linear relationship between the output voltage and the wiper position.

Potentiometer Symbol.

A potentiometer may also serve a a simple variable resistance (also known as a rheostat) by connecting it by one end terminal and the wiper. In this configuration, a potentiometer can be used to directly control a load by varying the resistance in series with it. This is not a very efficient way of implementing power control because at reduced settings, the resistive power dissipated is on the same order as that supplied to the load. There are some special applications where this is appropriate, but robot constructors should generally not use a variable resistance to directly control the power to a motor, or any element drawing more than a fraction of a watt.

Potentiometers usually employ either a rotary or a linear sliding contact. The wiper may be attached to a knob designed for manual manipulation, driven by a screw that is adjusted by a tool, or designed to be attached to an external moving element whose position is of interest. POTs are rated by their total (end-to-end) resistance and by the power they can dissipate.
10 kOhm rotary potentiometer from Sparkfun
10 kOhm sliding potentiometer from Sparkfun

--- No, I don't have stock in Sparkfun. Really. They just have a really nice online catalog of useful stuff for beginning robot constructors, with pictures and helpful comments and everything ---

Small potentiometers, sometimes called "trim pots" are used to tune resistances in circuits where precise values are needed, for example in a bridge comparator or other application where a "zero point" needs to be adjusted.
10 kOhm trimpot from Sparkfun

Another form known as a membrane potentiometer or "soft pot" consists of a thin strip laminated in flexible plastic or composite. Pressure at a point along the strip causes internal contact to be made, setting the resistance to a value proportional to location along the strip. The strips can be quite long, half a meter or more, and can be used to make fairly precise location measurements.
200mm softpot from Sparkfun

In robotics, potentiometers can be used in manual mode to adjust joint or other link positions. They can also be used to set speed or other manually adjustable parameters. This is almost always done by using the potentiometer as a variable voltage divider, feeding the center tap to an analog input on a microcontroller, and having the microcontroller moderate the action. Since the input impedance of microcontroller inputs is very high, the current drawn from the tap is not a problem.

Potentiometers are also used extensively in robotics to obtain information about the position of a joint or link. Most hobby RC standard servos employ POTs in their internal position control systems. They are cheaper and simpler to use than optical or magnetic quadrature encoders. The downside is they are less accurate, may introduce voltage-dependent errors. The sliding contact tends to wear, and may oxidize over over time. Potentiometers generally produce significant friction, as pressure needs to be maintained on the sliding contact. They are not the best choice for a joint that is in continuous, rapid motion (e.g. a wheel)

Pressure-Sensitive Resistors

Another group of sensors is based on materials that change their resistance in response to mechanical pressure. One of the first sensors of this type was the original microphone (Wikipedia), invented around 1870, which used a cartridge full of granulated carbon behind a diaphram that transformed atmospheric vibrations to pressure variation on the cartridge. The resistance of a carbon-filled cartridge decreases smoothly under pressure, permitting a well modulated electrical signal to be generated. Microscopically, the effect is due to the increase in size with pressure of the small contact regions between particles. Today high-gain electronic amplification allows more sensitive transducers (inductive or piezoelectric) to be used in mics.

A version of the old carbon trick is still with us however. Force-sensing resistors or FSRs (Wikipedia) are a class of sensors made by placing a pair of foil electrodes in contact with a thin film of piezoresistive material whose resistance decreases with pressure. some of these films employ the same microscopic principle as as the carbon mic using tiny embedded, conductive particles, whose contact area with the electrodes (and sometimes each other) increases with pressure.

The film and electrodes are sandwiched between two layers of protective plastic film, producing a sensor that is thin (0.5 mm or less), tough, waterproof, shockproof, and generally robust. The change in resistance is often well modeled by the relation 1/R ~ P over several order of magnitude, making the sensors useful over a wide range of forces. They are also relatively inexpensive, and easy to interface.

The disadvantages of force-sensing resistors include low absolute accuracy and repeatability. Measurement errors as high as 10% or more are to be expected. They also exhibit some hysteresis: when a load is removed, the resistance may not return quickly to the original value.

Force-sensing resistors are available in a wide range of sizes and shapes. Sensitivity varies, and is not always well specified, since the change in R depends on the pattern of the applied force. The unloaded resistance is usually very high, often in the Mega-ohm range, (as would be suggested by the 1/R ~ P relation). Sometimes the resistance under uniform pressure at two or more values is provided, which can give some guidance. In other cases, the user needs to perform some in-robo experiments to characterize the sensors. Cost is usually a few dollars, cheaper in bulk. Well-known brands include Interlink and Flexiforce.
0.5 inch force-sensitive-resistor from Sparkfun

Resistive Flex Sensors

Recently, fairly inexpensive resitive bend sensors have become available. These take the form of flexible, laminated strips a few inches long, and a fraction of an inch wide. They have a resistance that increases from a lower value when flat, to a higher one when flexed, (e.g. 10 kOhms flat to 100 kOhms bent 180 degrees). They are waterproof, robust, and can be flexed hundreds of thousands of times without significant degradation. Generally only one direction of flexture is effective. The response is not highly accurate, or linear with total curvature or other simple parameter, so the devices are best considered a somewhat qualitative sensor. Current cost (2015) for single units is order of $10, somewhat cheaper in large quantities.
4.5 inch resistive flex sensor from Sparkfun


Photoresistors (Wikipedia), also known as photocells or photoconductive cells, are simple, small, and relatively inexpensive light sensors. The most common form is made using cadmium sulphide (CdS). Resistance decreases from a high value, sometimes hundreds of kOhms to MOhms, under dark conditions, to a much lower value, generally several kOhms, when illuminated. Response tends to be broad-band. CdS cells respond across the visible range (400-700 nm), peaking in the yellow-green region (570 nm) Other semi-conductors respond in the infrared. For example, lead sulphide is used in mid-IR (3-8 um) detectors.

Photoresistors are rated by dark resistance and illuminated resistance at some standard light level, often 10 lux. A lux (Wikipedia), is a unit of illumination defined as one lumen per square meter. 1 lux is a bright full moon; 100 lux, hallway lighting; 500, bright office; 1000, outdoor overcast; 100,000, direct sunlight. The resistance vs. illumination function tends to be approximately linear on a log-log scale, and the slope of this line is sometimes included in the rating. A typical value is a bit less than (-)1, meaning a 10-fold increase in illumination will produce a bit less than a 10-fold decrease in resistance (often 3 to 9).

Compared some other photodetectors, such as photo-transistors and photodiodes, photocells have a relatively slow response time, often tens of ms. Full recovery to dark state can take a second or longer. They should thus not be used in applications where detecting changes in under 1/10 of a second is important. Photocells range in price from tens of cents to a few dollars, depending on type and quantity.
Small photoresistor from Adafruit

Variable Other Things

A number of other electro-physical phenomena are employed to implement sensing.

Sensing Proximity (and Motion)

Detecting the presence of an object without touching it can be useful to both living systems and robots, especially mobile ones. It helps animals move efficiently through the world. It can also help them find food and avoid becoming it. Many robots also need to move about efficiently. They are mostly not food, but may wish to avoid contact with humans and other moving objects, or detect them for other reasons.

It is useful to distinguish two basic domains of non-contact sensing: short-range, low-resolution, involving distances on the order of the size of the robot or less, and long-distance and/or high-resolution techniques. The domains differ substantially in the modalities and methods employed, and in applications of the acquired information (though there is naturally some overlap).

This section is concerned with short-range, low-resolution detection, which we will refer to as "proximity sensing". Long-distance or high-resolution methods often go by the name "remote sensing".

Proximity sensors have been designed using several different physical modalities. Infrared and ultrasonic detectors are probably the most familiar hobby-accessible sensors, but detectors based on magnetism and electromagnetic inductance are also available.

Infrared Proximity and Range Sensing

The simplest and least expensive proximity detectors are based on infrared illumination. They use a diode (LED) that emits in the near infrared (around 1000 nm), usually in a fairly narrow waveband, and a detector, generally one to several photodiodes or phototransistors (Wikipedia), that respond to radiation in the same band. The detector is often covered by a filter that blocks visible light, which would otherwise affect it. The emitter sends out a beam of IR. If an object is nearby, some of the radiation is reflected back to activate the detector.

A simple, intensity-based proximity detector can be easily implemented from basic components. Matched emitter/detector pairs are available for purchase for a dollar or two, or you can find and match your own individual components (e.g. on Digikey or Mouser, watch the wavelengths) for cheaper. Emitters are driven like ordinary LEDs with several milliamps. The detectors are usually 2-lead devices. A bias of a few volts (e.g. 5-10) is put across the leads. In the dark, little current flows (less than a uA) As the returned signal increases, a proportional output current flows across the leads, up to a few milliamps. This can be run through a resistor to produce an output voltage, which can be input directly to a high impedance microcontroller input, or to an op-amp for further processing.
IR emitter/detector pair from Sparkfun
IR emitter/detector pair from Radio Shack

The simple detector described above is sensitive only to the intensity of the returned light. In general, the further away an object is, the weaker the return signal. There is thus potentially, some quantitative information available. The falloff is rapid, generally at least quadratic, and may be faster. This limits usability to fairly short distances, generally a few inches for low-power emitter diodes. For a given object at fixed orientation, the distance function can be measured experimentally, and can provide a reasonable quantitative estimate of distance. However, reflectance is different for different objects and changes with orientation. Very dark objects, or ones that reflect the emitter signal in a specular (mirror-like) fashion may fail to be detected at all. IR sensors are also somewhat susceptible to false alarms due to sunlight or very bright incandescent light, both of which contain substantial amounts of near IR radiation.

Intensity-based IR proximity detectors are best treated as qualitative sensors, and are probably not a great choice if quantitative distance information is important. On the other hand, they are pretty good if all you want to do is detect a wall beside or in front of you. And you can build a nifty black-on-white line-follower pretty easily using a couple of really simple IR emitter-detectors. And you don't have to build them from components; you can buy them pre-assembled.
Simple IR reflectance sensor from Sparkfun

Response times for phototransistors/photodiodes are generally measured in microseconds, so these detectors are fast compared to photoresistors. This permits detection distance/sensitivity to be increased using a strobing trick. The LED is overdriven, but for such a short period, a millisecond or less, that it does not overheat and burn out. The detector can be sampled during the strobe period, and the net effect is as if a much brighter LED had been used.

More sophisticated IR distance sensors use lenses, several sensor elements, and what is effectively triangulation of an estimated spot center to obtain a quantitative value that is relatively insensitive to reflectance. Add in the strobing trick, and a reasonably accurate distance sensor good out to a meter or more can be constructed.

For around 10 bucks, you can buy an integrated unit that does all the above for you, and outputs an analog voltage that drops monotonically from a high value at close range, to a low value at max range. Such sensors are available with ranges up to a few meters. They are also available with a digital output corresponding to a fixed distance. In more sophisticated circuits, the trigger distance may be programmable.
Sharp integrated IR proximity sensor from Sparkfun
Datasheet via Mouser

Ultrasonic Proximity and Range Sensing

A second relatively simple distance-sensing technology employs ultrasound. Ultrasound is defined as acoustic vibration at a frequency beyond human hearing, or above 18-20kHz. The basic approach is for an emitter to send out a short pulse of sound and start a timer. A receiver "listens" for any echo, and stops the timer when and if it detects one. The elapsed time is proportional to the distance to the closest sound-reflecting object. The speed of sound can be used to convert the time into an absolute distance if needed.

The basic principle is simple. There are a few devils in the details. Unlike simple IR proximity, it is not so easy to build your own from basic components.

The emitter in inexpensive ultrasound units is generally a piezoelectric crystal (Wikipedia) attached to a metal diaphram. There may be a funnel-shaped "horn" to help form a narrow beam. The crystal is driven by several cycles of a square wave (e.g. 10-20) to produce an ultrasonic "chirp" A typical frequency for low-cost units is about 40kHz. The reason for the chirp is to give the receiver a very specific pattern to look for in the echo in order to distinguish it from background noise.

Sound in air under ordinary conditions travels at about 340 m/s or .34 mm/us. A 10 cycle pulse at 40 kHz is about 250us which amounts to 85 mm or just over 3 inches. Detecting a return chirp while the outgoing one is still being generated could be difficult, since the echo would probably be drowned out. The easiest way to avoid this is to impose a dead time during and slightly after chirp generation before listening for an echo. With more sophisticated processing, the receiver can be calibrated for "ringdown" during and after chirp production and detect a returning signal by subtracting the expected interference. This is less robust than listening in quite time, with the result that ultrasonic ranging devices are sometimes inaccurate for ranges under a few inches.

Piezo-electric crystals work in reverse, and can be used for detection as well as generation of ultrasound. Some sensors use the same crystal for both phases, some have separate detectors. Chirp detection requires some matched filtering. This can be done using either analog or digital processing, or a combination. Exactly how the processing is done in commercial units is not described in the data sheets; probably proprietary stuff. Judging from the complexity of the autocalibration and noise adaptation that is described, I'd guess modern units are primarily digital.

Commercial ultrasonic sensors provide output in several forms. Some, intended for industrial use, have only a serial communication channel (TTL, I2C, SPI, even RS232 protocols). However, as use of these sensors in consumer devices and by hobbyists has increased, many have also started to provide simpler interfaces. One or two pins are often used to provide pulse control. The most common outputs are an analog pin providing a voltage that decreases with distance, and a digital pin that provides a pulse whose temporal width is porportional to distance (and is often equal to the echo delay)

Ultrasonic proximity sensors for industrial use may cost hundreds or even thousands of dollars - typical of high industrial pricing. However as a consumer application market has developed, much less expensive sensors have become available. MaxBotics makes an extensive line starting at around $25. In the last year what appears to be a clone of the Parallax PING sensor (normally around $30), known as the HC-SR04 has shown up. It can be obtained from hobby suppliers for under $4, and from random internet sources for even less.
Maxbotic LV-MaxSonar-EZ1 from Sparkfun
HC-SR04 Ultrasonic Range Finder from Robot Shop

Motion Detection

Basically, any proximity detector that yields a distance-like measurement can be used as a motion detector. Just watch the distance for changes that are above the background noise level. If you want to monitor a broader area, point several proximity detectors in different directions and look for changes in any of them. Or even just add together the results and watch for a change in the overall sum.

If you don't even want to go to that trouble, just monitor any sort of return that is a function of a broad area. Any motion in that region will probably result in a change in the measured parameter. This is essentially how many simple IR and ultrasonic motion sensors are implemented. Of course some combinations of motions will produce no change in any single measurement, but it is unlikely to occur by accident. There may also be changes produced by events, that you are not interested in detecting (e.g. the sun going behind a cloud). These can be more of a problem, but careful selection of the sensor mode for the environment can often minimize the issue.

Bottom line is, that since a lot of the rapid changes in the physical world are due to moving objects, monitoring of any measureable for simple change can be a reasonable motion detector.

If you want to know the location of whatever it is that is moving, or exactly how it is moving, (e.g. is it going to collide with me) the problem becomes significantly more difficult. This is generally refered to as the "tracking problem", and useful approaches typically involve sophisticated sensors such as cameras, radar, or multi-aperature sonar. These are outside the scope of this section.

Other Proximity Sensors

Hall Effect Sensors

Hall effect sensors (Wikipedia) detect the presence (and strength) of magnetic fields. They utilize the fact that a conductor carrying a current perpendicular to a magnetic field develops a voltage across the conductor in the direction perpendicular to the current and the field. This is referred to (surprise, surprise) as the "Hall effect" (Wikipedia) after its discoverer, Edwin Hall. The effect can be qualitatively explained as a consequence of the Lorentz force on moving charge carriers in the conductor. A satisfactory quantitative description however requires quantum-mechanical models of electronic band structure.

The Hall voltage is proportional to the current and magnetic field. Though relatively small, it can be easily detected and amplified by modern high-gain semiconductor devices. Since magnetic fields penetrate most ordinary materials, a Hall-effect device can detect the presence, and to some extent the position, of a magnet without any mechanical connection. This is a very useful property. It allows sensing with no contacts to rub, wear out, or create friction. Sensors can be placed in high-pressure, liquid, or caustic environments without having to seal wires or moving parts.

A common use of Hall effect sensors is measuring the position of motors or other rotating elements. Such Hall encoders are frequently used in stepper motor or servo systems. A series of magnets set in the rotor pass by one or more sensors, creating a voltage pulse each time a magnet passes. These can be counted to keep track of the rotor position, or monitored in analog fashion to obtain more precise location information. Additional magnets and sensors can be used to mark a "zero" location or encode absolute position by other means.

Hall effect sensors can also be used to determine the position of a single joint by mounting a moving magnet so the field strength changes in a known manner as the joint moves. The signal can be used like that from a potentiometer, only there are no sliding electrical contacts to wear out or get dirty. The extra high-gain amplification and the need to correct for signal non-linearity make these sensors more expensive than cheap potentiometers, but the advantages are often worth the cost.

Inductive Sensors

The presence of magnetic materials or conductors near an inductive element (e.g. a coil) can change its inductance. In the case of ferro-magnetic materials like iron, the increased magnetic permeability in areas penetrated by the magnetic field associated with an inductor causes an increase in inductance. In the case of a conductor, induced currents counter any change to a magnetic field reducing the effective inductance at frequencies above the self-damping time of the conductor. The change in inductance can be detected by an appropriately designed circuit, providing a non-contact method of detecting conductors in close proximity.

Since most good conductors are metals, as is the most common ferro-magnetic material (iron), inductive sensors are often described as "metal detectors". The common metal detectors you see in the hands of beachcombers make use of exactly this principle.

Another sort of inductive sensor makes use of the electric potential produced in a conductor by a moving magnetic field. A coil placed near a rotor-mounted magnet will generate a signal every time the magnet sweeps by. Sensors of this sort are common in electronically commutated (brushless) motors. In fact the voltage or current in the motor coils themselves can be monitored for information about the rotor position. The signal is much stronger than that from a Hall effect sensor, but is only present if the rotor is moving. Thus Hall effect sensors remain important in motors that have to be held in a stationary position, or moved slowly (e.g. steppers or servo units).

Coming Soon...

Body Position Sensors (Proprioception)

Where is my leg with respect to my body and how is it moving?

Location and Ego-Motion Sensors

Where in the world am I, and where am I going (and how fast)?

Back to Robot Construction main page