Module5 Sensors
Module5 Sensors
SENSORS
COMPENG ELEC 2
2nd Sem, SY 2022 -2023
Aubrey Micah C. Dalino
Ma. Christina V. Magabilin
i
Table of Contents
Introduction .......................................................................................................... 1
Objectives .............................................................................................................. 1
Learning Content ................................................................................................... 1
What is Sensor? ............................................................................................ 1
Types of Robot Sensors .............................................................................. 1
1. Light sensors ........................................................................................... 1
2. Sound Sensor .......................................................................................... 2
3. Temperature Sensor ............................................................................... 2
4. Contact Sensor ........................................................................................ 2
5. Proximity Sensor ..................................................................................... 2
6. Distance Sensor ...................................................................................... 3
7. Pressure Sensors ..................................................................................... 3
8. Tilt Sensors ............................................................................................. 3
9. Navigation / Positioning Sensors............................................................. 3
10. Acceleration Sensor ............................................................................. 4
11. Gyroscope ............................................................................................ 4
12. IMU...................................................................................................... 4
13. Voltage Sensors ................................................................................... 5
14. Current Sensors.................................................................................... 5
15. Other sensors for robots ...................................................................... 5
Summary ............................................................................................................... 5
Teaching and Learning Activities ............................................................................ 5
Recommended Learning Materials and Resources for Supplementary Reading...... 6
ii
CHAPTER 5 – SENSORS
COMP ENG ELEC 2 – ROBOTICS/MACHINE LEARNING 2
Introduction
In this chapter, sensors are defined and its different types are discussed thoroughly. The aim of this module is to
equip students with necessary knowledge in identifying appropriate sensors for their needs. At the end of the module,
students will be asked to provide programming codes for different sensors.
Objectives
At the end of the topic, the student should be able to:
Learning Content
What is Sensor?
Is a device, module, machine or subsystem whose purpose is to detect events or changes in tits environment
and send the information to other electronics, frequently a computer processor.
It is a device that coverts signals form one energy domain to electrical domain.
1. Light sensors
is used to detect light and create a voltage difference.
The two main light sensors generally used in robots are Photoresistor and Photovoltaic cells. Other
kinds of light sensors like Phototubes, Phototransistors, CCD’s etc. are rarely used.
o Photoresistor is a type of resistor whose resistance varies with change in light intensity; more
light leads to less resistance and less light leads to more resistance. These inexpensive sensors
can be easily implemented in most light dependent robots.
o Photovoltaic cells convert solar radiation into electrical energy. This is especially helpful if you
are planning to build a solar robot. Although photovoltaic cell is considered as an energy source,
an intelligent implementation combined with transistors and capacitors can convert this into a
sensor.
1
2. Sound Sensor
As the name suggests, this sensor (generally a microphone) detects sound and returns a voltage
proportional to the sound level.
A simple robot can be designed to navigate based on the sound it receives. Imagine a robot which turns
right for one clap and turns left for two claps. Complex robots can use the same microphone for speech
and voice recognition.
Implementing sound sensors is not as easy as light sensors because Sound sensors generate a very
small voltage difference which should be amplified to generate measurable voltage change.
3. Temperature Sensor
What if your robot has to work in a desert and transmit ambient temperature? Simple solution is to use
a temperature sensor.
Tiny temperature sensor ICs provide voltage difference for a change in temperature. Few generally
used temperature sensor IC’s are LM34, LM35, TMP35, TMP36, and TMP37.
4. Contact Sensor
Are those which require physical contact against other objects to trigger.
A push button switch, limit switch or tactile bumper switch are all examples of contact sensors.
These sensors are mostly used for obstacle avoidance robots. When these switches hit an obstacle, it
triggers the robot to do a task, which can be reversing, turning, switching on a LED, Stopping etc.
There are also capacitive contact sensors which react only to human touch (Not sure if they react to
animal’s touch). Touch screen Smart phones available these days use capacitive touch sensors (Not to
be confused with older stylus-based models).
Contact Sensors can be easily implemented, but the drawback is that they require physical contact. In
other words, your robot will not turn until it hits an object. A better alternative is to use a proximity sensor.
5. Proximity Sensor
This is a type of sensor which can detect the presence of a nearby object within a given distance, without
any physical contact.
The working principle of a Proximity sensor is simple. A transmitter transmits an electromagnetic
radiation or creates an electrostatic field and a receiver receives and analyzes the return signal
for interruptions.
There are different types of Proximity sensors and we will discuss only a few of them which are generally
used in robots.
o Infrared (IR) Transceivers: An IR LED transmits a beam of IR light and if it finds an obstacle,
the light is simply reflected back which is captured by an IR receiver. Few IR transceivers can
also be used for distance measurement.
o Ultrasonic Sensor: These sensors generate high frequency sound waves; the received echo
suggests an object interruption. Ultrasonic Sensors can also be used for distance
measurement.
o Photoresistor: Photoresistor is a light sensor; but, it can still be used as a proximity sensor.
When an object comes in close proximity to the sensor, the amount of light changes which in
turn changes the resistance of the Photoresistor. This change can be detected and processed.
There are many different kinds of proximity sensors and only a few of them are generally preferred for
robots. For example, Capacitive Proximity sensors are available which detects change in capacitance
around it. Inductive proximity sensor detects objects and distance through the use of induced magnetic
field.
2
6. Distance Sensor
Most proximity sensors can also be used as distance sensors, or commonly known as Range Sensors;
IR transceivers and Ultrasonic Sensors are best suited for distance measurement
o Ultrasonic Distance Sensors: The sensor emits an ultrasonic pulse and is captured by a
receiver. Since the speed of sound is almost constant in air, which is 344m/s, the time between
send and receive is calculated to give the distance between your robot and the obstacle.
Ultrasonic distance sensors are especially useful for underwater robots.
o Infrared Distance sensor: IR circuits are designed on triangulation principle for distance
measurement. A transmitter sends a pulse of IR signals which is detected by the receiver if
there is an obstacle and based on the angle the signal is received, distance is calculated.
SHARP has a family of IR transceivers which are very useful for distance measurement. A
simple transmit and receive using a couple of transmitters and receivers will still do the job of
distance measurement, but if you require precision, then prefer the triangulation method
o Laser range Sensor: Laser light is transmitted and the reflected light is captured and analyzed.
Distance is measured by calculating the speed of light and time taken for the light to reflect back
to the receiver. These sensors are very useful for longer distances.
o Encoders: These sensors (not actually sensors, but a combination of different components)
convert angular position of a shaft or wheel into an analog or digital code. The most popular
encoder is an optical encoder which includes a rotational disk, light source and a light detector
(generally an IR transmitter and IR receiver). The rotational disk has transparent and opaque
pattern (or just black and white pattern) painted or printed over it. When the disk rotates along
with the wheel the emitted light is interrupted generating a signal output. The number of times
the interruption happens and the diameter of the wheel can together give the distance travelled
by the robot.
o Stereo Camera: Two cameras placed adjacent to each other can provide depth information
using its stereo vision. Processing the data received from a camera is difficult for a robot with
minimal processing power and memory. If opted for, they make a valuable addition to your
robot.
There are other stretch and bend sensors which are also capable of measuring distance. But their range
is so limited that they are almost useless for mobile robots.
7. Pressure Sensors
As the name suggests, pressure sensor measures pressure.
Tactile pressure sensors are useful in robotics as they are sensitive to touch, force and pressure.
If you design a robot hand and need to measure the amount of grip and pressure required to hold an
object, then this is what you would want to use.
8. Tilt Sensors
This measures tilt of an object.
In a typical analog tilt sensor, a small amount of mercury is suspended in a glass bulb. When mercury
flows towards one end, it closes a switch which suggests a tilt.
9. Navigation / Positioning Sensors
The name says it all. Positioning sensors are used to approximate the position of a robot, some for
indoor positioning and few others for outdoor positioning.
o GPS (Global Positioning System): The most commonly used positioning sensor is a GPS.
Satellites orbiting our earth transmit signals and a receiver on a robot acquires these signals
3
and processes it. The processed information can be used to determine the approximate position
and velocity of a robot. These GPS systems are extremely helpful for outdoor robots, but fail
indoors. They are also bit expensive at the moment and if their prices fall, very soon you would
see most robots with a GPS module attached.
o Digital Magnetic Compass: Similar to a handheld magnetic compass, Digital Magnetic
compass provides directional measurements using the earth’s magnetic field which guides your
robot in the right direction to reach its destination. These sensors are cheap compared to GPS
modules, but a compass works best along with a GPS module if you require both positional
feedback and navigation. Philips KMZ51 is sensitive enough to detect earth’s magnetic field.
o Localization: Localization refers to the task of automatically determining the location of a robot
in complex environment. Localization is based on external elements called landmarks which
can be either artificially placed landmarks, or natural landmark. In the first approach, artificial
landmarks or beacons are placed around the robot, and a robot’s sensor captures these signals
to determine its exact location. Natural landmarks can be doors, windows, walls, etc. which are
sensed by a robots sensor / vision system (Camera). Localization can be achieved using
beacons which generate Wi-Fi, Bluetooth, Ultrasound, Infrared, Radio transmissions, Visible
Light, or any similar signal.
10. Acceleration Sensor
An accelerometer is a device which measures acceleration and tilt. There are two kinds of forces which
can affect an accelerometer: Static force and Dynamic Force
o Static Force: Static force is the frictional force between any two objects. For example, earth’s
gravitational force is static which pulls an object towards it. Measuring this gravitational force
can tell you how much your robot is tilting. This measurement is exceptionally useful in a
balancing robot, or to tell you if your robot is driving uphill or on a flat surface.
o Dynamic force: Dynamic force is the amount of acceleration required to move an object.
Measuring this dynamic force using an accelerometer tells you the velocity/speed at which your
robot is moving. We can also measure vibration of a robot using an accelerometer, if in any
case you need to.
Accelerometer comes in different flavors. Always select the one which is most appropriate for your robot.
Some of the factors which you need to consider before selecting an accelerometer are:
o Output Type: Analog or Digital
o Number of Axis: 1,2 or 3
o Accelerometer Swing: ±1.5g, ±2g, ±4g, ±8g, ±16g
o Sensitivity: Higher or Lower (Higher the better)
o Bandwidth
11. Gyroscope
A gyroscope or simply Gyro is a device which measures and helps maintain orientation using the
principle of angular momentum.
In other words, a Gyro is used to measure the rate of rotation around a particular axis.
Gyroscope is especially useful when you want your robot to not depend on earth’s gravity for
maintaining Orientation. (Unlike accelerometer)
12. IMU
Inertial Measurement Units combine properties of two or more sensors such as Accelerometer, Gyro,
Magnetometer, etc, to measure orientation, velocity and gravitational forces.
4
In simple words, IMU’s are capable of providing feedback by detecting changes in an objects orientation
(pitch, roll and yaw), velocity and gravitational forces. Few IMUs go a step further and combine a GPS
device providing positional feedback.
13. Voltage Sensors
These typically convert lower voltages to higher voltages, or vice versa. One example is a general
Operational-Amplifier (Op-Amp) which accepts a low voltage, amplifies it, and generates a higher
voltage output.
Few voltage sensors are used to find the potential difference between two ends (Voltage Comparator).
Even a simple LED can act as a voltage sensor which can detect a voltage difference and light up. (not
considering current requirements here)
14. Current Sensors
These are electronic circuits which monitor the current flow in a circuit and output either a proportional
voltage or a current. Most current sensors output an analog voltage between 0V to 5V which can be
processed further using a microcontroller.
15. Other sensors for robots
There are hundreds of sensors made today to sense virtually anything you can think of, and it is almost
impossible to list all available sensors. Apart from those mentioned above, there are many other sensors
used for specific applications. For example: Humidity Sensors measures Humidity; Gas sensors are
designed to detect particular gases (helpful for robots which detects gas leaks); Potentiometers are so
versatile that they can be used in numerous different applications; Magnetic Field Sensors detect the
strength of magnetic field around it.
Summary
In this chapter, we have learned that a simple obstacle avoider robot can be built using a couple of photoresistors,
or an infrared sensor. The more complex your robot gets, the greater number of sensors you tend to use. A single
task may require a combination of different sensors, or different tasks can be achieved using a single sensor.
Sometimes, a task can be performed from any of the many available sensors. Decide the best sensor based on
availability, cost and ease of use.
Together with your group, choose 5 sensors discussed in this module and look for
reliable resources on how to code them in Arduino.
Then, using the resources you made, create a simple program that could use your
chosen 3 sensors simultaneously.
Individual codes for Chosen 5 sensors = 6 pts each (30 pts)
Codes for Simultaneously using these 3 sensors = 20 pts
Save your files as PDF and submit your outputs in the Chapter 5 Learning Activity
Submission Portal until April 21, 2023, 12PM.
NOTE: If your file is not in PDF, your output will be marked zero.
5
Recommended Learning Materials and Resources for Supplementary Reading
Books:
Ceceri, Kathy (2012). Making Simple Robots. Maker Media, Inc.
Joseph, Lentin (2018). Robot Operating System for Absolute Beginners: Robotics Programming Made
Easy. New York: Springer Science + Business Media Finance Inc(SSBM Finance Inc)
Online Resources:
http://www.robotplatform.com/knowledge/sensors/types_of_robot_sensors.html
https://www.javatpoint.com/types-of-robot-sensors
https://roboticsbiz.com/sensors-in-robotics-7-common-sensors-used-in-robots/
https://www.futurelearn.com/info/courses/robotics-with-raspberry-pi/0/steps/75888
https://link.springer.com/content/pdf/10.1007/978-94-011-7050-5_5.pdf
https://create.arduino.cc/projecthub/projects/tags/sensor
6
7