How to Make a Robot - Lesson 7: Using Sensors

Posted on 17/09/2018 by cbenson in How to Make a Robot
Modified on: 22/03/2023
Steps completed / 12
Press to mark a step as
completed or click here to complete all
Introduction

Welcome to the RobotShop Grand Tutorial: How to Make a Robot, a series of 10 lessons that will teach you the principles behind making your own custom robot. Unlike humans, robots are not limited to just sight, sound, touch, smell, and taste. Robots use a variety of different electromechanical sensors to explore and understand their environment and themselves. This lesson covers the more popular sensors used in hobby robotics so you can determine which you want to implement. When you have selected, move on to the next lesson - Getting the Right Tools.


Unlike humans, robots are not limited to just sight, sound, touch, smell, and taste. Robots use a variety of different electromechanical sensors to explore and understand their environment and themselves. Emulating a living creature’s senses is currently very difficult, so researchers and developers have resorted to alternatives to biological senses.

Human smelling

Robots can “see” but have a hard time understanding what they are looking at. Using a camera, a robot may be able to pick up an image made up of millions of pixels but without significant programming, it would not know what any of those pixels meant. Distance sensors would indicate the distance to an object, but would not stop a robot from bumping into it. Researchers and companies are experimenting with a variety of different approaches to permit a robot to not only “see” but “understand” what it is looking at. It may be a long time before a robot is able to differentiate between objects placed before it on a table, especially if they do not appear to be exactly the same as what is in its database of objects. Robots have a really hard time tasting and smelling. A human may be able to tell you “this tastes sweet” or “this smells bad” whereas a robot would need to analyze the chemical composition and then look up the substance in a database to determine if humans have marked the taste as being “sweet” or the smell as being “bad”. There has not been much demand for a robot that can taste or smell, so not much effort has been put into creating the appropriate sensors. Humans have nerve endings throughout their skin and as such, we know when we have touched an object or when something has touched us. Robots are equipped with buttons or simple contacts placed in strategic locations (for example on a front bumper) to determine if it has come into contact with an object. Robot pets may have contact or force sensors placed in their head, feet, and back, but if you try to touch an area where there is no sensor, the robot has no way of knowing it has been touched and will not react. As research into humanoid robots continues, perhaps an “electromechanical skin” will be developed.

Nao Robotic Vision

Although a robot cannot tell you if a substance tastes good or if an odor smells bad, the steps involved in analyzing the chemical composition can give it far more information than a normal human could about its properties. A robot, equipped with a carbon monoxide sensor, would be able to detect carbon monoxide gas which is otherwise colorless, and odorless to humans. A robot would also be able to tell you the Ph level of a substance to determine if it is acidic or basic and much, much more. Humans use a pair of eyes to get a very good sense of depth, though for many, accurately gauging distance is not easy. A human might tell you “the tree looks to be about 50 feet away”, but a robot, equipped with the right distance sensors, can tell you “the tree is 43.1 feet away”. Additionally, robots can not only sense but give accurate values of a variety of environmental factors that humans are otherwise unaware of or incapable of sensing. For example, a robot can tell you the precise angular or linear acceleration it is subjected to, while most humans would only tell you “I’m turning”, or “I’m moving”. A human can tell you based on experience if they think an object will be hot or cold without actually touching it, whereas a thermal camera can provide a 2D thermal image of whatever is in front of it. Although humans have five main senses, robots can have an almost infinite number of different sensors.

So, what types of sensors are available, and which ones does your robot need? You need to first ask yourself “what do I want or need the robot to measure?” and refer to the appropriate category below. There is a good chance what you have in mind will not fall “nicely” into one of these categories, so try to break it down into its basic elements.

Robot Sensors

Source: Sensor Robot & Servo - Wikipedia

Push button / Contact switch

SFE 12mm Push-button

Switches, buttons, and contact sensors are used to detect physical contact between objects and are not just restricted to humans pushing buttons; bumpers on a robot can be equipped with momentary push buttons, and “whiskers” (just like an animal) can be used to sense multiple distances.

  • Advantages: very low cost, easy to integrate, reliable
  • Disadvantages: single distance measurement

Pressure sensor

Unlike a push button which offers one of two possible readings (ON or OFF), a pressure sensor produces an output proportional to the force that is being applied to it.

  • Advantages: allows gauging how much force is being applied
  • Disadvantages: can be imprecise and are more difficult to use than simple switches.

Interlink FSR

Source: Bomazi - Wikipedia

Distance Sensor

Ultrasonic Range Finders

Maxbotix Ultrasonic-Range-Finder LV-MaxSonar-EZ0Ultrasonic range finders use acoustics to measure the time between when a signal is sent versus when its echo is received back. Ultrasonic range finders can measure a range of distances, but are used specifically in air and are affected by the reflectivity of different materials.

  • Advantages: medium range (several meters) measurement.
  • Disadvantages: surfaces and environmental factors can affect the readings.

 

Infrared

Infrared light, which as we saw is used in communication, can also be used to measure distance. Some infrared sensors measure one specific distance while others provide an output proportional to the distance to an object.

  • Advantages: low cost, fairly reliable, and accurate.
  • Disadvantages: closer range than ultrasonic

Loke Industrial Laser Rangefinder

Laser

Lasers are used when high accuracy or long distances (or both) are required when measuring the range of an object. Scanning laser rangefinders use spinning lasers to get a two-dimensional scan of the distances to objects

  • Advantages: very accurate, very long-range.
  • Disadvantages: much costlier than regular infrared or ultrasonic sensors.

Encoders
Encoders

Optical encoders use a mini infrared transmitter/receiver pairs and send signals when the infrared beam is broken by a specifically designed spinning disk (mounted to a rotating shaft). The number of times the beam is broken corresponds to the total angle traveled by a wheel. Knowing the radius of the wheel, you can determine the total distance traveled by that wheel. Two encoders give you a relative distance in two dimensions.

  • Advantages: assuming there is no slip, the displacement is absolute. Often comes installed on the rear shaft of a motor
  • Disadvantages:  additional programming required; more accurate optical encoders can be ~$50+ each

Linear Potentiometer, resistive band

Linear Potentiometer

A linear potentiometer is able to measure the absolute position of an object. A resistive band changes resistance depending on where a force is applied.

  • Advantages: position is absolute. A resistive band requires pressure to be applied at a given position.
  • Disadvantages: the range is very small

 

Stretch and Bend Sensors

Stretch SensorA stretch sensor is made up of a material whose resistance changes according to how much it has been stretched. A bend sensor is usually a sandwich of materials where the resistance of one of the layers changes according to how much it has been bent. These can be used to determine a small angle or rotation, for example, how much a finger has been bent.

  • Advantages: useful where an axis of rotation is internal or inaccessible
  • Disadvantages: not very accurate, and only small angles can be measured

Stereo Camera System

Stereo Camera SystemJust like human eyes, two cameras placed a distance apart can provide depth information (stereo vision). Robots equipped with cameras can be some of the most capable and complex robots produced. A camera, combined with the right software, can provide color and object recognition.

  • Advantages: can provide dept information and good feedback about a robot’s environment
  • Disadvantages: complex to program and use the information

Positioning Devices

Indoor Localization (room navigation)

Hagisonic Stargazer Localization System

An indoor localization system can use several beacons to triangulate the robot’s position within a room, while others use a camera and landmarks.

  • Advantages: excellent for absolute positioning
  • Disadvantages: requires complex programming and the use of markers

GPS

4D Systems GPS

A GPS uses the signals from several satellites orbiting the planet to help determine its geographic coordinates. Regular GPS units can provide geographical positioning down to 5m of accuracy while more advanced systems involving data processing and error correction thanks to the use of other GPS units or IMUs can be accurate down to several cm.

  • Advantages: does not requires markers or other references
  • Disadvantages: can only function outdoors.

Rotation Sensors

Potentiometer

Phidgets Rotation SensorA rotary potentiometer is essentially a voltage divider and provides an analog voltage corresponding to the angle the knob is rotated to.

  • Advantages: simple to use, inexpensive, reasonably accurate, and provides absolute readings.
  • Disadvantages: most are restricted to 300 degrees of rotation

Gyroscope

SFE GyroAn electronic gyroscope measures the rate of angular acceleration and provides a corresponding signal (analog voltage, serial communication, I2C, etc.). Integrating this value twice will give you an angle.

  • Advantages: no moving “mechanical” components
  • Disadvantages: the sensor is always subjected to angular acceleration whereas a microcontroller cannot always take continuous input, meaning values are lost, leading to "drift".

Encoders

Solarbotics Wheel Watcher EncoderOptical encoders, as explained above, use a mini infrared transmitter/receiver pairs to signal when the infrared beam is broken by a spinning disk (mounted to a rotating shaft). The number of times the beam is broken corresponds to the total angle traveled by a wheel. A mechanical encoder uses a very finely machined disk with enough holes to be able to read specific angles. Mechanical encoders can therefore be used for both absolute and relative rotation.

  • Advantages: accurate
  • Disadvantages: for optical encoders, the angle is relative (not absolute) to the starting position.

Environmental Sensors

Photocell

Light Sensor

A light sensor can be used to measure the intensity of a light source, be it natural or artificial. Usually, its resistance is proportional to the light intensity.

  • Advantages: usually very inexpensive and very useful
  • Disadvantages: cannot discriminate the source or type of light.

 

Sound sensor

DFRobot Sound Sensor

A sound sensor is essentially a microphone that returns a voltage proportional to the ambient noise level. More complex boards can use the data from a microphone for speech recognition.

  • Advantages: inexpensive, reliable
  • Disadvantages: more meaningful information requires complex programming

 

Parallax AD592 Temperature Probe

Thermal Sensors

Thermal sensors can be used to measure the temperature where it is on a particular component or the ambient temperature.

  • Advantages: they can be very accurate
  • Disadvantages:  more complex and accurate sensors can be more difficult to use.

 

Thermal Camera

Devantech 8 pixel Thermal Array Sensor

Infrared or thermal imaging allows you to get a complete 2D thermal image of whatever is in front of the camera.  This way it is possible to determine the temperature of an object.

  • Advantages: differentiate objects from the background based on their thermal signature
  • Disadvantages: expensive

 

Humidity Sensor

Humidity

Humidity sensors detect the percentage of water in the air and are often paired with temperature sensors.

 

Pressure Sensor

A pressure sensor (which can also be a barometric sensor) can be used to measure atmospheric pressure and give an idea of the altitude of a UAV.

Gas sensors

Seeedstudio MQ6 Gas SensorSpecialized gas sensors can be used to detect the presence and concentration of a variety of different gases. However, only specialized robotic applications tend to need gas sensors.

  • Advantages: These are the only sensors that can be used to accurately detect gas
  • Disadvantages: inexpensive sensors may give false positives or somewhat inaccurate readings and should therefore not be used for critical applications.

Magnetometers

Hall Effect Sensor

Magnetic sensors or magnetometers can be used to detect magnets and magnetic fields. This is useful to know the position of magnets.

  • Advantages: can detect ferromagnetic metals.
  • Disadvantages: sometimes the sensors can be damaged by strong magnets.

Attitude Sensors

Compass

Parallax Dual Axis Compass

A digital compass is able to use the earth’s magnetic field to determine its orientation with respect to the magnetic poles. Tilt-compensated compasses account for the fact that the robot may not be perfectly horizontal.

  • Advantages: provides absolute navigation
  • Disadvantages:  greater accuracy increases the price

 

Gyroscope

SFE Dual Axis Gyro

Electronic gyroscopes are able to provide the angle of the tilt in one or more axes. Mechanical tilt sensors usually determine if a robot has been tilted past a certain value by using mercury in a glass capsule or a conductive ball.

  • Advantages:  electronic tilt sensors have higher accuracy than mechanical ones
  • Disadvantages:  can be expensive

 

Accelerometers

SFE Triple Axis Accelerometer

Accelerometers measure linear acceleration. This allows measuring the gravitational acceleration or any other accelerations the robot is subject to. This can be a good option to approximate the distance traveled if your robot cannot use the surrounding environment as a reference. Accelerometers can measure accelerations along one, two, or three axes. A three-axis accelerometer can be used also to measure the orientation a

  • Advantages:  they do not require any external reference or marker to function and can provide absolute orientation with respect to gravity, or relative orientation.
  • Disadvantages: they only approximate the traveled distance and cannot precisely determine it.

IMU's

Phidgets IMUAn Inertial Measurement Unit combines a multi-axis accelerometer with a multi-axis gyroscope and sometimes a multi-axis magnetometer in order to more accurately measure roll

  • Advantages: it is a very reliable way of measuring the robot's attitude without using external references (besides the earth’s magnetic field)
  • Disadvantages: can be very expensive and is complex to use.

Miscellaneous Sensors

Current and Voltage Sensors

SparkFun INA169 Current SensorCurrent and voltage sensors do exactly as their name describes; they measure the current and/or voltage of a specific electric circuit. This can be very useful for gauging how much longer your robot will operate (measure the voltage from the battery) or if your motors are working too hard (measure the current).

  • Advantages: they do exactly what they are intended to do
  • Disadvantages: can disturb the voltage or current they are measuring. Sometimes they require the circuit being measured to be modified.

Magnetic Sensors

SparkFun 6DoF Magnetometer LSM303CMagnetic sensors or magnetometers detect magnetic objects and can either require contact with the object or be relatively close to the object. Such sensors can be used on an autonomous lawn mower to detect wire embedded into a lawn.

  • Advantages: usually inexpensive
  • Disadvantages: usually need to be relatively close to the object, and sadly cannot detect non-magnetic metals.

Vibration

Vibration sensors detect the vibration of an object by using piezoelectric or other technologies.

RFID

RFIDRadio Frequency Identification devices use active (powered) or passive (non-powered) RFID tags usually the size and shape of a credit card, a small flat disc, or an addition to a key chain (other shapes are possible as well). When the RFID tag comes within a specific distance of the RFID reader, a signal with the tag’s ID is produced.

  • Advantages: RFID tags are usually very low cost and can be individually identified
  • Disadvantages: not useful for measuring distance, only if a tag is within range.

1.      “I want my robot to follow a person”

(More info on the robot featured in the video...)

There is no “person following sensor” available (yet), so you would need to see which categories above may apply and which don’t need to be considered.

  • Q: Are you looking to detect, and measure the distance to  (or contact with) an object?
    • Immediately the answer should be yes and this first category of sensors will likely give the best results.
  • Q: Are you looking to measure rotation?
    • Perhaps, but you really don’t need to know if the robot is rotated (that’s a different aspect entirely) or if the human is rotated with respect to the robot.
  • Q: Are you looking to measure environmental conditions?
    • Not really. You might consider tracking a human based on its thermal signature, but differentiating between humans and animals (or even a microwave) would be difficult.
  • Q: Are you looking to measure position, orientation, or angle?
    • GPS is the first sensor that immediately stands out.

Having gone through the main categories, we should be considering sensors related to distance, contact, and detection, and also considering GPS. Take a closer look at the types of sensors in this category:

  • Contact: irrelevant since the robot will be following the human at a distance.
  • Distance:
    • Ultrasonic, infrared, and laser: measuring the distance is useful when combined with other sensors.
    • Camera: This may be the best option and we will look into it.
    • Stretch: This would require the human to be physically connected to the robot, which is something we do not want.
  • Rotation: irrelevant
  • Positioning:
    • GPS: placing a GPS unit on both the robot and the human would allow the robot to easily follow the human within a certain radius.
  • Environmental conditions: irrelevant
  • Attitude:
    • Accelerometer: not very useful since it does not give the robot an idea of where the human is.
    • IMU: not very useful since it does not give the robot an idea of where the human is.
  • Miscellaneous:
    • RFID:  An RFID reader can locate a tag placed around it, and although some sort of RFID option may be possible, it would require quite a bit of research.

Therefore out of the options available, the most appropriate sensors to allow a robot to follow a human may be ultrasonic or infrared distance sensor(s), a camera, and GPS. A camera may be used to pick up a specific pattern placed on the shirt of the individual to follow while GPS units mounted on the robot and on the human would help the robot find the human if she cannot be seen visually. Distance sensors would ensure the robot does not get too close to the human. Therefore when choosing sensors to help your robot follow a human, the sensors listed above would be a good starting point.

2.       “I want my robot to stay within the boundaries of our lawn”

There is no “neighbor’s grass” sensor available (that we are aware of), so you will need to devise another sensor-based solution.

  • Q: Are you looking to detect, and measure the distance to  (or contact with) an object?
    • Yes, we are looking to detect a boundary
  • Q: Are you looking to measure rotation?
    • Not really
  • Q: Are you looking to measure environmental conditions?
    • Not really, but we’ll keep an open mind since the robot is outdoors.
  • Q: Are you looking to measure position, orientation, or angle?
    • Not really

Applicable categories, therefore, include measuring distance, feeling contact, detecting an object, and perhaps environmental conditions. Out of the list of sensors in this category, we can see that the following may be useful:

  • Contact: Detecting collisions in order to avoid obstacles.
  • Distance:
    • Ultrasonic, infrared, and laser: These will help the robot to avoid hitting objects, and when several are placed facing downwards, will help the robot avoid falling into openings such as pools.
  • Rotation:
    • Encoders: Encoders: these will help position the robot in two-dimensional space based on a starting position.
    • Positioning:
      • GPS: Ideal, the robot could be instructed to remain within certain coordinates.
  • Environmental conditions:
    • Humidity sensor: This is not an “intuitive” solution and was creatively used on the Lawnbott Spyder lawn mower to differentiate between grass and “non-humid” surfaces such as concrete and pavement.
    • Magnetic sensor: Magnetic sensors are used both indoors and outdoors to mark boundaries. The perimeter is marked with a strip of conductive wire and the robot is equipped with a few magnetic sensors.
  • Attitude:
    • IMU: this may make the data obtained from the encoders more accurate, especially if there are slopes or uneven terrain.
  • Miscellaneous: irrelevant

Therefore if you want your robot to stay within the boundaries of your lawn, the sensors listed above would be a very good start.

For further information on learning how to make a robot, please visit the RobotShop Learning Center. Visit the RobotShop Community Forum in order to seek assistance in building robots, showcase your projects, or simply hang out with other fellow roboticists.

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post